Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Updated code base to new version of OpenQBMM, using Ur instead of calculating Urelative for each iteration | a7b30fcee90cfe4fd6c3e8befa2a14e87df05ce3 | Anurag Misra | 2019-12-20 17:04:49 |
Updated coalescence efficiency so it is limited to 1.0 in certain cases | 0845bb5240e98a155065130b4ac34a71947d09aa | Anurag Misra | 2019-12-12 15:56:40 |
Updated OpenQBMM code base | d79f6a5e703145ce57b27980ec75443e390ac288 | Anurag Misra | 2019-05-15 13:23:25 |
Update OpenQBMM code base | 0ef2e7e1462125ecb2efb03904ce1649271b7aae | Anurag Misra | 2018-11-05 15:35:04 |
Updated code to reflect latest changes in upstream OpenQBMM | 1764c04587a9f47865f353ffa857e04fd369cb81 | Anurag Misra | 2018-09-18 13:14:48 |
Updated case mesh, dictionaries and boundary conditions, merged squaredSettler case with batchSettler using a separate blockMeshDict file | 0db9d9362d1ef519dfd48ed79eb7fb69dbfdc74a | Anurag M | 2018-08-24 21:02:19 |
Disabled -DFULLDEBUG option from OpenQBMM library compilation | 802f24f41f1fc065a7d4cc203584f6d68c0b3e03 | Anurag Misra | 2018-08-21 13:18:38 |
Updated Grimes Kernel | 2be4035a22eb74ca3af27524cd162db8851581c8 | Anurag Misra | 2018-08-21 13:08:21 |
Added temperature-dependence in Grimes Kernel | f3a435a0c455df0e4e4908f562f26f5b86ffb63a | Anurag M | 2018-08-20 06:55:19 |
Fixed conflict in the use of T in TEqns.H and UEqns.H | bb96a2c1c38d89aeef45bc2614c0abce3e2bac37 | Anurag M | 2018-08-17 08:59:30 |
Fixed division by zero errors in Grimes kernel | e0a0aa507d1159306afae9f7885a9f57e7698eff | Anurag M | 2018-08-17 08:58:50 |
Updated Grimes kernel with collision frequency limits, Added mixture temperature equation | 2294a5b9a45433d75edee92e86db104a3b94ab65 | Anurag M | 2018-08-16 21:36:02 |
Updated Grimes Kernel | f608acb3b6da226f28f41de412f6af9f55dc1f42 | Anurag M | 2018-08-16 13:35:57 |
Minor changes to Grimes kernel, still not functional | cc44c1e64b44719780ae6b0f3445055854f7cf99 | Anurag M | 2018-08-16 08:12:02 |
Updated code to be compatible with OpenFOAM6, integrated latest commits from OpenQBMM-dev | a6cab1ad0759989cf0d8b3d5a3dafa7e25fdde82 | Anurag M | 2018-08-15 17:29:12 |
update coalescence buoyancyInducedSI, small speedup | ce96614597feb467bc73ff4b3d8d3b622c2942f2 | Cyrille Bonamy | 2018-05-17 22:38:21 |
Updated test cases to work with OF5.0 | a94165663b5086612bd57bed9915bb0b13c616ae | Anurag.Misra | 2018-04-27 11:57:40 |
Moved ifPorous back to time directory due to problems with case decomposition, changed write settings instead | d7c92de5c17607f86b7fe614ac49964762826e84 | Anurag M | 2018-04-27 09:29:51 |
moved location of ifPorous to constant directory to avoid problems with restarting case | 7765cfdc95e2733af395f004754f21d4310fb249 | Anurag M | 2018-04-27 08:17:50 |
Added lower bound for the efficiency term in buoyancyInduced kernel | 37484d897975e1c3ecb20462a68bd0cd09925f9e | Anurag M | 2018-04-26 13:16:23 |
File multiphaseEulerPbeFoam/Make/options changed (mode: 100644) (index 52fb43c..8db1873) | |||
... | ... | EXE_INC = \ | |
10 | 10 | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ | -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ |
11 | 11 | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ | -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ |
12 | 12 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
13 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
14 | 13 | -I$(LIB_SRC)/fvOptions/lnInclude \ | -I$(LIB_SRC)/fvOptions/lnInclude \ |
14 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
15 | 15 | -I$../quadratureMethods/momentSets/lnInclude \ | -I$../quadratureMethods/momentSets/lnInclude \ |
16 | 16 | -I$../quadratureMethods/momentInversion/lnInclude \ | -I$../quadratureMethods/momentInversion/lnInclude \ |
17 | 17 | -I$../quadratureMethods/quadratureNode \ | -I$../quadratureMethods/quadratureNode \ |
File multiphaseEulerPbeFoam/Vandermonde/Vandermonde.C changed (mode: 100644) (index 88cc3a6..6fc0a62) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | void Foam::Vandermonde::solve | |
104 | 104 | { | { |
105 | 105 | c[j] += xx*c[j + 1]; | c[j] += xx*c[j + 1]; |
106 | 106 | } | } |
107 | |||
107 | 108 | c[m_ - 1] += xx; | c[m_ - 1] += xx; |
108 | 109 | } | } |
109 | 110 |
File multiphaseEulerPbeFoam/Vandermonde/Vandermonde.H changed (mode: 100644) (index f5f9ce2..f893546) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
103 | 103 | // Member Operators | // Member Operators |
104 | 104 | ||
105 | 105 | //- Return the complete Vandermonde matrix | //- Return the complete Vandermonde matrix |
106 | scalarSquareMatrix operator()(); | ||
106 | inline scalarSquareMatrix operator()(); | ||
107 | 107 | ||
108 | 108 | //- Return a given component of the Vandermonde matrix | //- Return a given component of the Vandermonde matrix |
109 | scalar operator()(label i, label j); | ||
109 | inline scalar operator()(label i, label j); | ||
110 | 110 | }; | }; |
111 | 111 | ||
112 | 112 |
File multiphaseEulerPbeFoam/Vandermonde/VandermondeI.H changed (mode: 100755) (index d6266fb..99de1b6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 |
File multiphaseEulerPbeFoam/eigenSolver/eigenSolver.C changed (mode: 100644) (index 6e1d3a9..c381fc8) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/eigenSolver/eigenSolver.H changed (mode: 100644) (index dbcecec..b99a228) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2012-2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2012-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | private: | |
65 | 65 | ||
66 | 66 | // Private data | // Private data |
67 | 67 | ||
68 | //- Real part of eigenvalues | ||
69 | scalarDiagonalMatrix eigenvaluesRe_; | ||
68 | //- Real part of eigenvalues | ||
69 | scalarDiagonalMatrix eigenvaluesRe_; | ||
70 | 70 | ||
71 | //- Imaginary part of eigenvalues | ||
72 | scalarDiagonalMatrix eigenvaluesIm_; | ||
71 | //- Imaginary part of eigenvalues | ||
72 | scalarDiagonalMatrix eigenvaluesIm_; | ||
73 | 73 | ||
74 | //- Eigenvectors matrix | ||
75 | scalarSquareMatrix eigenvectors_; | ||
74 | //- Eigenvectors matrix | ||
75 | scalarSquareMatrix eigenvectors_; | ||
76 | 76 | ||
77 | //- Matrix with the same size of original matrix | ||
78 | scalarSquareMatrix H_; | ||
77 | //- Matrix with the same size of original matrix | ||
78 | scalarSquareMatrix H_; | ||
79 | 79 | ||
80 | //- Number of rows and columns | ||
81 | label n_; | ||
80 | //- Number of rows and columns | ||
81 | label n_; | ||
82 | 82 | ||
83 | //- Private member functions | ||
83 | // Private member functions | ||
84 | 84 | ||
85 | //- Disallow default bitwise copy construct | ||
86 | eigenSolver(const eigenSolver&); | ||
85 | //- Checks matrix for symmetry | ||
86 | bool isSymmetric(const scalarSquareMatrix& A); | ||
87 | 87 | ||
88 | //- Disallow default bitwise assignment | ||
89 | void operator=(const eigenSolver&); | ||
88 | //- Householder transform of a symmetric matrix to tri-diagonal form | ||
89 | void tridiagonaliseSymmMatrix(); | ||
90 | 90 | ||
91 | //- Checks matrix for symmetry | ||
92 | bool isSymmetric(const scalarSquareMatrix& A); | ||
91 | //- Symmetric tri-diagonal QL algorithm | ||
92 | void symmTridiagQL(); | ||
93 | 93 | ||
94 | //- Householder transform of a symmetric matrix to tri-diagonal form | ||
95 | void tridiagonaliseSymmMatrix(); | ||
94 | //- Reduction of non-symmetric matrix to Hessemberg form | ||
95 | void Hessenberg(); | ||
96 | 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(); | ||
97 | //- Reduction from Hessenberg to real Schur form | ||
98 | void realSchur(); | ||
105 | 99 | ||
106 | 100 | ||
107 | 101 | public: | public: |
108 | 102 | ||
109 | 103 | // Constructors | // Constructors |
110 | 104 | ||
111 | //- Construct from a scalarSquareMatrix | ||
112 | eigenSolver(const scalarSquareMatrix& A); | ||
105 | //- Construct from a scalarSquareMatrix | ||
106 | eigenSolver(const scalarSquareMatrix& A); | ||
107 | |||
108 | //- Construct from a scalarSquareMatrix and symmetry information | ||
109 | // Does not perform symmetric check | ||
110 | eigenSolver(const scalarSquareMatrix& A, bool symmetric); | ||
111 | |||
112 | //- Disallow default bitwise copy construct | ||
113 | eigenSolver(const eigenSolver&) = delete; | ||
113 | 114 | ||
114 | //- Construct from a scalarSquareMatrix and symmetry information | ||
115 | // Does not perform symmetric check | ||
116 | eigenSolver(const scalarSquareMatrix& A, bool symmetric); | ||
117 | 115 | ||
118 | 116 | // Access Functions | // Access Functions |
119 | 117 | ||
120 | 118 | //- Return real part of the eigenvalues | //- 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 | } | ||
119 | const scalarDiagonalMatrix& eigenvaluesRe() const | ||
120 | { | ||
121 | return eigenvaluesRe_; | ||
122 | } | ||
123 | |||
124 | const scalarDiagonalMatrix& eigenvaluesIm() const | ||
125 | { | ||
126 | return eigenvaluesIm_; | ||
127 | } | ||
128 | |||
129 | //- Return eigenvectors | ||
130 | const scalarSquareMatrix& eigenvectors() const | ||
131 | { | ||
132 | return eigenvectors_; | ||
133 | } | ||
134 | |||
135 | |||
136 | // Member Operators | ||
137 | |||
138 | //- Disallow default bitwise assignment | ||
139 | void operator=(const eigenSolver&) = delete; | ||
136 | 140 | }; | }; |
137 | 141 | ||
138 | 142 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/interfacialModels/Make/options changed (mode: 100644) (index 195a339..b0fe80a) | |||
1 | 1 | EXE_INC = \ | EXE_INC = \ |
2 | 2 | -I../quadratureMethods/populationBalanceModels/lnInclude \ | -I../quadratureMethods/populationBalanceModels/lnInclude \ |
3 | 3 | -I../multiphaseDisperseSystem/lnInclude \ | -I../multiphaseDisperseSystem/lnInclude \ |
4 | -I$(LIB_SRC)/finiteVolume/lnInclude | ||
4 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
5 | -I$(LIB_SRC)/meshTools/lnInclude | ||
5 | 6 | ||
6 | 7 | LIB_LIBS = \ | LIB_LIBS = \ |
7 | 8 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
8 | -lmultiphaseDisperseSystem | ||
9 | -lmultiphaseDisperseSystem \ | ||
10 | -lfiniteVolume \ | ||
11 | -lmeshTools |
File multiphaseEulerPbeFoam/mappedList/mappedList.C changed (mode: 100644) (index 2e5d91e..1693d2c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::mappedList<mappedType>::listToWord(const labelList& lst) | |
44 | 44 | ||
45 | 45 | template <class mappedType> | template <class mappedType> |
46 | 46 | Foam::label | Foam::label |
47 | Foam::mappedList<mappedType>::listToLabel(const labelList& lst) | ||
47 | Foam::mappedList<mappedType>::listToLabel | ||
48 | ( | ||
49 | const labelList& lst, | ||
50 | const label nDims | ||
51 | ) | ||
48 | 52 | { | { |
49 | 53 | label l = 0; | label l = 0; |
54 | label size = max(nDims, lst.size()); | ||
50 | 55 | ||
51 | 56 | forAll(lst, dimi) | forAll(lst, dimi) |
52 | 57 | { | { |
53 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
58 | l += lst[dimi]*pow(10, size - dimi - 1); | ||
54 | 59 | } | } |
55 | 60 | ||
56 | 61 | return l; | return l; |
... | ... | template <class mappedType> Foam::mappedList<mappedType>::mappedList | |
66 | 71 | ) | ) |
67 | 72 | : | : |
68 | 73 | List<mappedType>(size), | List<mappedType>(size), |
69 | map_(size) | ||
74 | map_(size), | ||
75 | nDims_(0) | ||
70 | 76 | { | { |
77 | forAll(indexes, i) | ||
78 | { | ||
79 | nDims_ = max(nDims_, indexes[i].size()); | ||
80 | } | ||
81 | |||
71 | 82 | forAll(*this, elemi) | forAll(*this, elemi) |
72 | 83 | { | { |
73 | 84 | map_.insert | map_.insert |
74 | 85 | ( | ( |
75 | listToLabel(indexes[elemi]), | ||
86 | listToLabel(indexes[elemi], nDims_), | ||
76 | 87 | elemi | elemi |
77 | 88 | ); | ); |
78 | 89 | } | } |
... | ... | template <class mappedType> Foam::mappedList<mappedType>::mappedList | |
86 | 97 | ) | ) |
87 | 98 | : | : |
88 | 99 | List<mappedType>(size, initValue), | List<mappedType>(size, initValue), |
89 | map_(size) | ||
100 | map_(size), | ||
101 | nDims_(0) | ||
90 | 102 | { | { |
103 | forAll(indexes, i) | ||
104 | { | ||
105 | nDims_ = max(nDims_, indexes[i].size()); | ||
106 | } | ||
107 | |||
91 | 108 | forAll(*this, elemi) | forAll(*this, elemi) |
92 | 109 | { | { |
93 | 110 | map_.insert | map_.insert |
94 | 111 | ( | ( |
95 | listToLabel(indexes[elemi]), | ||
112 | listToLabel(indexes[elemi], nDims_), | ||
96 | 113 | elemi | elemi |
97 | 114 | ); | ); |
98 | 115 | } | } |
... | ... | template <class mappedType> Foam::mappedList<mappedType>::mappedList | |
106 | 123 | ) | ) |
107 | 124 | : | : |
108 | 125 | List<mappedType>(size, initValue), | List<mappedType>(size, initValue), |
109 | map_(map) | ||
110 | {} | ||
126 | map_(map), | ||
127 | nDims_(0) | ||
128 | { | ||
129 | forAllConstIter(Map<label>, map_, iter) | ||
130 | { | ||
131 | label x = iter.key(); | ||
132 | label nD = 0; | ||
133 | |||
134 | while (x) | ||
135 | { | ||
136 | x /= 10; | ||
137 | nD++; | ||
138 | } | ||
139 | |||
140 | nDims_ = max(nDims_, nD); | ||
141 | } | ||
142 | } | ||
111 | 143 | ||
112 | 144 | template <class mappedType> Foam::mappedList<mappedType>::mappedList | template <class mappedType> Foam::mappedList<mappedType>::mappedList |
113 | 145 | ( | ( |
... | ... | template <class mappedType> Foam::mappedList<mappedType>::mappedList | |
116 | 148 | ) | ) |
117 | 149 | : | : |
118 | 150 | List<mappedType>(initList), | List<mappedType>(initList), |
119 | map_(initList.size()) | ||
151 | map_(initList.size()), | ||
152 | nDims_(0) | ||
120 | 153 | { | { |
154 | forAll(indexes, i) | ||
155 | { | ||
156 | nDims_ = max(nDims_, indexes[i].size()); | ||
157 | } | ||
158 | |||
121 | 159 | forAll(*this, elemi) | forAll(*this, elemi) |
122 | 160 | { | { |
123 | 161 | map_.insert | map_.insert |
124 | 162 | ( | ( |
125 | listToLabel(indexes[elemi]), | ||
163 | listToLabel(indexes[elemi], nDims_), | ||
126 | 164 | elemi | elemi |
127 | 165 | ); | ); |
128 | 166 | } | } |
... | ... | Foam::label Foam::mappedList<mappedType>::calcMapIndex | |
144 | 182 | std::initializer_list<Foam::label> indexes | std::initializer_list<Foam::label> indexes |
145 | 183 | ) const | ) const |
146 | 184 | { | { |
147 | label argSize = indexes.size(); | ||
148 | 185 | label mapIndex = 0; | label mapIndex = 0; |
149 | 186 | ||
150 | if (argSize > 0) | ||
187 | if (indexes.size() > 0) | ||
151 | 188 | { | { |
152 | 189 | for | for |
153 | 190 | ( | ( |
... | ... | Foam::label Foam::mappedList<mappedType>::calcMapIndex | |
157 | 194 | ) | ) |
158 | 195 | { | { |
159 | 196 | label argIndex = std::distance(indexes.begin(), iter); | label argIndex = std::distance(indexes.begin(), iter); |
160 | mapIndex += (*iter)*pow(10, argSize - argIndex - 1); | ||
197 | mapIndex += (*iter)*pow(10, nDims_ - argIndex - 1); | ||
161 | 198 | } | } |
162 | 199 | } | } |
163 | 200 | ||
... | ... | void Foam::mappedList<mappedType>::resize(const label newSize) | |
177 | 214 | (*this).setSize(newSize); | (*this).setSize(newSize); |
178 | 215 | } | } |
179 | 216 | ||
217 | template <class mappedType> | ||
218 | bool Foam::mappedList<mappedType>::found(const labelList& l) const | ||
219 | { | ||
220 | if (l.size() > nDims_) | ||
221 | { | ||
222 | return false; | ||
223 | } | ||
224 | |||
225 | forAllConstIter(Map<label>, map_, iter) | ||
226 | { | ||
227 | label x = iter.key(); | ||
228 | |||
229 | if (x == listToLabel(l, nDims_)) | ||
230 | { | ||
231 | return true; | ||
232 | } | ||
233 | } | ||
234 | |||
235 | return false; | ||
236 | } | ||
237 | |||
238 | template <class mappedType> | ||
239 | template <typename ...ArgsT> | ||
240 | bool Foam::mappedList<mappedType>::found(ArgsT...args) const | ||
241 | { | ||
242 | if (label(std::initializer_list<Foam::label>({args...}).size()) > nDims_) | ||
243 | { | ||
244 | return false; | ||
245 | } | ||
246 | |||
247 | forAllConstIter(Map<label>, map_, iter) | ||
248 | { | ||
249 | label x = iter.key(); | ||
250 | |||
251 | if (x == calcMapIndex({args...})) | ||
252 | { | ||
253 | return true; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | return false; | ||
258 | } | ||
259 | |||
180 | 260 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/mappedList/mappedList.H changed (mode: 100644) (index 139858e..c7e505b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
50 | 50 | #define mappedList_H | #define mappedList_H |
51 | 51 | ||
52 | 52 | #include "scalar.H" | #include "scalar.H" |
53 | #include "vector.H" | ||
53 | 54 | #include "labelList.H" | #include "labelList.H" |
54 | 55 | #include "Map.H" | #include "Map.H" |
55 | 56 | ||
... | ... | class mappedList | |
72 | 73 | //- Map from the label to its index within the List | //- Map from the label to its index within the List |
73 | 74 | Map<label> map_; | Map<label> map_; |
74 | 75 | ||
76 | //- Number of dimensions | ||
77 | label nDims_; | ||
75 | 78 | ||
76 | 79 | // Private Member Functions | // Private Member Functions |
77 | 80 | ||
... | ... | public: | |
127 | 130 | static word listToWord(const labelList& lst); | static word listToWord(const labelList& lst); |
128 | 131 | ||
129 | 132 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 |
130 | static label listToLabel(const labelList& lst); | ||
133 | static label listToLabel | ||
134 | ( | ||
135 | const labelList& lst, | ||
136 | const label nDims = 0 | ||
137 | ); | ||
131 | 138 | ||
132 | 139 | // Modifiers | // Modifiers |
133 | 140 | ||
134 | 141 | //- Resize mapped list | //- Resize mapped list |
135 | void resize (const label newSize); | ||
142 | void resize(const label newSize); | ||
136 | 143 | ||
137 | 144 | //- Set mapped list size | //- Set mapped list size |
138 | void setSize (const label newSize); | ||
145 | void setSize(const label newSize); | ||
139 | 146 | ||
140 | 147 | ||
141 | 148 | // Access | // Access |
142 | 149 | ||
150 | //- Is label list index used | ||
151 | bool found(const labelList& l) const; | ||
152 | |||
153 | //- Is label list index used | ||
154 | template <typename ...ArgsT> | ||
155 | bool found(ArgsT ...args) const; | ||
156 | |||
143 | 157 | //- Non-const access to a moment given the list of orders | //- Non-const access to a moment given the list of orders |
144 | 158 | template <typename ...ArgsT> | template <typename ...ArgsT> |
145 | 159 | inline mappedType& operator()(ArgsT ...args); | inline mappedType& operator()(ArgsT ...args); |
File multiphaseEulerPbeFoam/mappedList/mappedListI.H changed (mode: 100644) (index 3b77d5f..c4d4c3c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | const mappedType& Foam::mappedList<mappedType>::operator() | |
50 | 50 | const Foam::labelList& l | const Foam::labelList& l |
51 | 51 | ) const | ) const |
52 | 52 | { | { |
53 | return this->operator[](map_[listToLabel(l)]); | ||
53 | return this->operator[](map_[listToLabel(l, nDims_)]); | ||
54 | 54 | } | } |
55 | 55 | ||
56 | 56 | template <class mappedType> | template <class mappedType> |
... | ... | mappedType& Foam::mappedList<mappedType>::operator() | |
59 | 59 | const Foam::labelList& l | const Foam::labelList& l |
60 | 60 | ) | ) |
61 | 61 | { | { |
62 | return this->operator[](map_[listToLabel(l)]); | ||
62 | return this->operator[](map_[listToLabel(l, nDims_)]); | ||
63 | 63 | } | } |
64 | 64 | ||
65 | 65 | template <class mappedType> const Foam::Map<Foam::label>& | template <class mappedType> const Foam::Map<Foam::label>& |
File multiphaseEulerPbeFoam/mappedList/mappedLists.H changed (mode: 100644) (index c3da4aa..1cbbd40) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace Foam | |
41 | 41 | { | { |
42 | 42 | ||
43 | 43 | typedef mappedList<label> mappedLabelList; | typedef mappedList<label> mappedLabelList; |
44 | |||
45 | 44 | typedef mappedList<scalar> mappedScalarList; | typedef mappedList<scalar> mappedScalarList; |
45 | typedef mappedList<vector> mappedVectorList; | ||
46 | 46 | ||
47 | 47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
48 | 48 |
File multiphaseEulerPbeFoam/mappedPtrList/mappedPtrList.C changed (mode: 100644) (index 5a41e59..731093c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::mappedPtrList<mappedType>::listToWord(const labelList& lst) | |
42 | 42 | return w; | return w; |
43 | 43 | } | } |
44 | 44 | ||
45 | |||
45 | 46 | template <class mappedType> | template <class mappedType> |
46 | 47 | Foam::label | Foam::label |
47 | Foam::mappedPtrList<mappedType>::listToLabel(const labelList& lst) | ||
48 | Foam::mappedPtrList<mappedType>::listToLabel | ||
49 | ( | ||
50 | const labelList& lst, | ||
51 | const label nDims | ||
52 | ) | ||
48 | 53 | { | { |
49 | 54 | label l = 0; | label l = 0; |
55 | label size = max(nDims, lst.size()); | ||
50 | 56 | ||
51 | 57 | forAll(lst, dimi) | forAll(lst, dimi) |
52 | 58 | { | { |
53 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
59 | l += lst[dimi]*pow(10, size - dimi - 1); | ||
54 | 60 | } | } |
55 | 61 | ||
56 | 62 | return l; | return l; |
... | ... | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList | |
66 | 72 | ) | ) |
67 | 73 | : | : |
68 | 74 | PtrList<mappedType>(size), | PtrList<mappedType>(size), |
69 | map_(size) | ||
75 | map_(size), | ||
76 | nDims_(0) | ||
70 | 77 | { | { |
78 | forAll(indexes, i) | ||
79 | { | ||
80 | nDims_ = max(nDims_, indexes[i].size()); | ||
81 | } | ||
82 | |||
71 | 83 | forAll(*this, elemi) | forAll(*this, elemi) |
72 | 84 | { | { |
73 | 85 | map_.insert | map_.insert |
74 | 86 | ( | ( |
75 | listToLabel(indexes[elemi]), | ||
87 | listToLabel(indexes[elemi], nDims_), | ||
76 | 88 | elemi | elemi |
77 | 89 | ); | ); |
78 | 90 | } | } |
79 | 91 | } | } |
80 | 92 | ||
93 | |||
81 | 94 | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList |
82 | 95 | ( | ( |
83 | 96 | const label size, | const label size, |
... | ... | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList | |
85 | 98 | ) | ) |
86 | 99 | : | : |
87 | 100 | PtrList<mappedType>(size), | PtrList<mappedType>(size), |
88 | map_(map) | ||
89 | {} | ||
101 | map_(map), | ||
102 | nDims_(0) | ||
103 | { | ||
104 | forAllConstIter(Map<label>, map_, iter) | ||
105 | { | ||
106 | label x = iter.key(); | ||
107 | label nD = 0; | ||
108 | while (x) | ||
109 | { | ||
110 | x /= 10; | ||
111 | nD++; | ||
112 | } | ||
113 | nDims_ = max(nDims_, nD); | ||
114 | } | ||
115 | } | ||
116 | |||
90 | 117 | ||
91 | 118 | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList |
92 | 119 | ( | ( |
... | ... | template <class mappedType> Foam::mappedPtrList<mappedType>::mappedPtrList | |
95 | 122 | ) | ) |
96 | 123 | : | : |
97 | 124 | PtrList<mappedType>(initList), | PtrList<mappedType>(initList), |
98 | map_(initList.size()) | ||
125 | map_(initList.size()), | ||
126 | nDims_(0) | ||
99 | 127 | { | { |
128 | forAll(indexes, i) | ||
129 | { | ||
130 | nDims_ = max(nDims_, indexes[i].size()); | ||
131 | } | ||
132 | |||
100 | 133 | forAll(*this, elemi) | forAll(*this, elemi) |
101 | 134 | { | { |
102 | 135 | map_.insert | map_.insert |
103 | 136 | ( | ( |
104 | listToLabel(indexes[elemi]), | ||
137 | listToLabel(indexes[elemi], nDims_), | ||
105 | 138 | elemi | elemi |
106 | 139 | ); | ); |
107 | 140 | } | } |
... | ... | template <class mappedType> | |
111 | 144 | template<class INew> | template<class INew> |
112 | 145 | Foam::mappedPtrList<mappedType>::mappedPtrList(Istream& is, const INew& iNewt) | Foam::mappedPtrList<mappedType>::mappedPtrList(Istream& is, const INew& iNewt) |
113 | 146 | : | : |
114 | PtrList<mappedType>(is, iNewt) | ||
147 | PtrList<mappedType>(is, iNewt), | ||
148 | nDims_(0) | ||
115 | 149 | { | { |
116 | 150 | map_.resize(this->size()); | map_.resize(this->size()); |
117 | 151 | } | } |
... | ... | Foam::label Foam::mappedPtrList<mappedType>::calcMapIndex | |
132 | 166 | std::initializer_list<Foam::label> indexes | std::initializer_list<Foam::label> indexes |
133 | 167 | ) const | ) const |
134 | 168 | { | { |
135 | label argSize = indexes.size(); | ||
136 | 169 | label mapIndex = 0; | label mapIndex = 0; |
137 | 170 | ||
138 | if (argSize > 0) | ||
171 | if (indexes.size() > 0) | ||
139 | 172 | { | { |
140 | 173 | for | for |
141 | 174 | ( | ( |
... | ... | Foam::label Foam::mappedPtrList<mappedType>::calcMapIndex | |
145 | 178 | ) | ) |
146 | 179 | { | { |
147 | 180 | label argIndex = std::distance(indexes.begin(), iter); | label argIndex = std::distance(indexes.begin(), iter); |
148 | mapIndex += (*iter)*pow(10, argSize - argIndex - 1); | ||
181 | mapIndex += (*iter)*pow(10, nDims_ - argIndex - 1); | ||
149 | 182 | } | } |
150 | 183 | } | } |
151 | 184 | ||
152 | 185 | return mapIndex; | return mapIndex; |
153 | 186 | } | } |
154 | 187 | ||
188 | |||
155 | 189 | template <class mappedType> | template <class mappedType> |
156 | 190 | void Foam::mappedPtrList<mappedType>::setMap(const Map<label>& map) | void Foam::mappedPtrList<mappedType>::setMap(const Map<label>& map) |
157 | 191 | { | { |
158 | 192 | map_ = map; | map_ = map; |
193 | forAllConstIter(Map<label>, map_, iter) | ||
194 | { | ||
195 | label x = iter.key(); | ||
196 | label nD = 0; | ||
197 | while (x) | ||
198 | { | ||
199 | x /= 10; | ||
200 | nD++; | ||
201 | } | ||
202 | nDims_ = max(nDims_, nD); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | |||
207 | template <class mappedType> | ||
208 | bool Foam::mappedPtrList<mappedType>::set(const label i) const | ||
209 | { | ||
210 | return PtrList<mappedType>::set(i); | ||
211 | } | ||
212 | |||
213 | |||
214 | template <class mappedType> | ||
215 | bool Foam::mappedPtrList<mappedType>::set(const labelList& l) const | ||
216 | { | ||
217 | return PtrList<mappedType>::set(map_[listToLabel(l, nDims_)]); | ||
218 | } | ||
219 | |||
220 | template <class mappedType> | ||
221 | bool Foam::mappedPtrList<mappedType>::found(const labelList& l) const | ||
222 | { | ||
223 | if (l.size() > nDims_) | ||
224 | { | ||
225 | return false; | ||
226 | } | ||
227 | forAllConstIter(Map<label>, map_, iter) | ||
228 | { | ||
229 | label x = iter.key(); | ||
230 | if (x == listToLabel(l, nDims_)) | ||
231 | { | ||
232 | return true; | ||
233 | } | ||
234 | } | ||
235 | return false; | ||
236 | } | ||
237 | |||
238 | template <class mappedType> | ||
239 | template <typename ...ArgsT> | ||
240 | bool Foam::mappedPtrList<mappedType>::found(ArgsT...args) const | ||
241 | { | ||
242 | if (label(std::initializer_list<Foam::label>({args...}).size()) > nDims_) | ||
243 | { | ||
244 | return false; | ||
245 | } | ||
246 | forAllConstIter(Map<label>, map_, iter) | ||
247 | { | ||
248 | label x = iter.key(); | ||
249 | if (x == calcMapIndex({args...})) | ||
250 | { | ||
251 | return true; | ||
252 | } | ||
253 | } | ||
254 | return false; | ||
159 | 255 | } | } |
160 | 256 | ||
161 | 257 | template <class mappedType> | template <class mappedType> |
... | ... | void Foam::mappedPtrList<mappedType>::set | |
168 | 264 | PtrList<mappedType>::set(i, entry); | PtrList<mappedType>::set(i, entry); |
169 | 265 | } | } |
170 | 266 | ||
267 | |||
171 | 268 | template <class mappedType> | template <class mappedType> |
172 | 269 | void Foam::mappedPtrList<mappedType>::set | void Foam::mappedPtrList<mappedType>::set |
173 | 270 | ( | ( |
... | ... | void Foam::mappedPtrList<mappedType>::set | |
175 | 272 | mappedType* entry | mappedType* entry |
176 | 273 | ) | ) |
177 | 274 | { | { |
178 | PtrList<mappedType>::set(map_[listToLabel(l)], entry); | ||
275 | PtrList<mappedType>::set(map_[listToLabel(l, nDims_)], entry); | ||
179 | 276 | } | } |
180 | 277 | ||
278 | |||
181 | 279 | template <class mappedType> | template <class mappedType> |
182 | 280 | void Foam::mappedPtrList<mappedType>::set | void Foam::mappedPtrList<mappedType>::set |
183 | 281 | ( | ( |
... | ... | void Foam::mappedPtrList<mappedType>::set | |
185 | 283 | autoPtr<mappedType> entry | autoPtr<mappedType> entry |
186 | 284 | ) | ) |
187 | 285 | { | { |
188 | PtrList<mappedType>::set(map_[listToLabel(l)], entry); | ||
286 | PtrList<mappedType>::set(map_[listToLabel(l, nDims_)], entry); | ||
189 | 287 | } | } |
190 | 288 | ||
289 | |||
191 | 290 | template <class mappedType> | template <class mappedType> |
192 | 291 | void Foam::mappedPtrList<mappedType>::set | void Foam::mappedPtrList<mappedType>::set |
193 | 292 | ( | ( |
... | ... | void Foam::mappedPtrList<mappedType>::set | |
195 | 294 | tmp<mappedType> entry | tmp<mappedType> entry |
196 | 295 | ) | ) |
197 | 296 | { | { |
198 | PtrList<mappedType>::set(map_[listToLabel(l)], entry); | ||
297 | PtrList<mappedType>::set(map_[listToLabel(l, nDims_)], entry); | ||
199 | 298 | } | } |
200 | // ************************************************************************* // | ||
299 | |||
300 | |||
301 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/mappedPtrList/mappedPtrList.H changed (mode: 100644) (index 5fe403b..ce07d82) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class mappedPtrList | |
73 | 73 | //- Map from the label to its index within the List | //- Map from the label to its index within the List |
74 | 74 | Map<label> map_; | Map<label> map_; |
75 | 75 | ||
76 | //- Number of dimensions | ||
77 | label nDims_; | ||
76 | 78 | ||
77 | 79 | // Private Member Functions | // Private Member Functions |
78 | 80 | ||
... | ... | public: | |
122 | 124 | static word listToWord(const labelList& lst); | static word listToWord(const labelList& lst); |
123 | 125 | ||
124 | 126 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 |
125 | static label listToLabel(const labelList& lst); | ||
127 | static label listToLabel | ||
128 | ( | ||
129 | const labelList& lst, | ||
130 | const label nDims = 0 | ||
131 | ); | ||
126 | 132 | ||
127 | 133 | ||
128 | 134 | // Access functions | // Access functions |
... | ... | public: | |
145 | 151 | inline const Map<label>& map() const; | inline const Map<label>& map() const; |
146 | 152 | ||
147 | 153 | ||
154 | // Return functions | ||
155 | |||
156 | //- Is index i set | ||
157 | bool set(const label i) const; | ||
158 | |||
159 | //- Is label list index set | ||
160 | bool set(const labelList& l) const; | ||
161 | |||
162 | //- Is label list index used | ||
163 | bool found(const labelList& l) const; | ||
164 | |||
165 | //- Is label list index used | ||
166 | template <typename ...ArgsT> | ||
167 | bool found(ArgsT ...args) const; | ||
168 | |||
169 | |||
148 | 170 | // Edit functions | // Edit functions |
149 | 171 | ||
150 | 172 | //- Set map after PtrList has been constructed | //- Set map after PtrList has been constructed |
... | ... | public: | |
163 | 185 | void set(const labelList& l, tmp<mappedType> entry); | void set(const labelList& l, tmp<mappedType> entry); |
164 | 186 | }; | }; |
165 | 187 | ||
166 | |||
167 | 188 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
168 | 189 | ||
169 | 190 | } // End namespace Foam | } // End namespace Foam |
File multiphaseEulerPbeFoam/mappedPtrList/mappedPtrListI.H changed (mode: 100644) (index 88ba4e0..81bd7f9) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | const mappedType& Foam::mappedPtrList<mappedType>::operator() | |
50 | 50 | const Foam::labelList& l | const Foam::labelList& l |
51 | 51 | ) const | ) const |
52 | 52 | { | { |
53 | return this->operator[](map_[listToLabel(l)]); | ||
53 | return this->operator[](map_[listToLabel(l, nDims_)]); | ||
54 | 54 | } | } |
55 | 55 | ||
56 | 56 | template <class mappedType> | template <class mappedType> |
... | ... | mappedType& Foam::mappedPtrList<mappedType>::operator() | |
59 | 59 | const Foam::labelList& l | const Foam::labelList& l |
60 | 60 | ) | ) |
61 | 61 | { | { |
62 | return this->operator[](map_[listToLabel(l)]); | ||
62 | return this->operator[](map_[listToLabel(l, nDims_)]); | ||
63 | 63 | } | } |
64 | 64 | ||
65 | 65 | template <class mappedType> const Foam::Map<Foam::label>& | template <class mappedType> const Foam::Map<Foam::label>& |
... | ... | Foam::mappedPtrList<mappedType>::map() const | |
68 | 68 | return map_; | return map_; |
69 | 69 | } | } |
70 | 70 | ||
71 | // ************************************************************************* // | ||
71 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/phaseModel/phaseModel.C changed (mode: 100644) (index d65a4e4..2795dba) | |||
... | ... | Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const | |
293 | 293 | } | } |
294 | 294 | ||
295 | 295 | ||
296 | // ************************************************************************* // | ||
296 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/Make/options changed (mode: 100644) (index ea5b3c4..86912b5) | |||
1 | 1 | EXE_INC = \ | 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 | 2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
10 | 3 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
11 | 4 | -I../../eigenSolver/lnInclude \ | -I../../eigenSolver/lnInclude \ |
12 | 5 | -I../../mappedList \ | -I../../mappedList \ |
13 | 6 | -I../../mappedPtrList \ | -I../../mappedPtrList \ |
14 | 7 | -I../momentSets/lnInclude \ | -I../momentSets/lnInclude \ |
15 | -I../quadratureNode \ | ||
8 | -I../quadratureNode/lnInclude \ | ||
16 | 9 | -I../moments \ | -I../moments \ |
17 | 10 | -I../momentInversion/lnInclude \ | -I../momentInversion/lnInclude \ |
18 | 11 | -I../fieldMomentInversion/lnInclude \ | -I../fieldMomentInversion/lnInclude \ |
... | ... | EXE_INC = \ | |
20 | 13 | -I../momentAdvection/lnInclude | -I../momentAdvection/lnInclude |
21 | 14 | ||
22 | 15 | LIB_LIBS = \ | LIB_LIBS = \ |
23 | -lincompressibleTransportModels \ | ||
24 | -lcompressibleTransportModels \ | ||
25 | -lfluidThermophysicalModels \ | ||
26 | -lspecie \ | ||
27 | -lturbulenceModels \ | ||
28 | -lincompressibleTurbulenceModels \ | ||
29 | -lcompressibleTurbulenceModels \ | ||
30 | 16 | -lfiniteVolume \ | -lfiniteVolume \ |
31 | 17 | -lmeshTools \ | -lmeshTools \ |
32 | 18 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
33 | 19 | -leigenSolver \ | -leigenSolver \ |
20 | -lquadratureNode \ | ||
34 | 21 | -lmomentSets \ | -lmomentSets \ |
35 | 22 | -lmomentInversion \ | -lmomentInversion \ |
36 | 23 | -lfieldMomentInversion \ | -lfieldMomentInversion \ |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/PDFTransportModel/PDFTransportModel.C changed (mode: 100644) (index 4800ae6..bc8e078) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/PDFTransportModel/PDFTransportModel.H changed (mode: 100644) (index 6e2cf06..6389ffd) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class PDFTransportModel | |
56 | 56 | //- Name of the PDFTransportModel | //- Name of the PDFTransportModel |
57 | 57 | const word name_; | const word name_; |
58 | 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 | 59 | ||
68 | 60 | protected: | protected: |
69 | 61 | ||
... | ... | public: | |
85 | 77 | const fvMesh& mesh | const fvMesh& mesh |
86 | 78 | ); | ); |
87 | 79 | ||
80 | //- Disallow default bitwise copy construct | ||
81 | PDFTransportModel(const PDFTransportModel&) = delete; | ||
82 | |||
83 | |||
88 | 84 | //- Destructor | //- Destructor |
89 | 85 | virtual ~PDFTransportModel(); | virtual ~PDFTransportModel(); |
90 | 86 | ||
... | ... | public: | |
94 | 90 | //- Solve PDF transport equation | //- Solve PDF transport equation |
95 | 91 | virtual void solve() = 0; | virtual void solve() = 0; |
96 | 92 | ||
93 | |||
94 | // Member Operators | ||
95 | |||
96 | //- Disallow default bitwise assignment | ||
97 | void operator=(const PDFTransportModel&) = delete; | ||
98 | |||
97 | 99 | }; | }; |
98 | 100 | ||
99 | 101 |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.C changed (mode: 100644) (index 2f312ee..b5a069b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::univariatePDFTransportModel | |
38 | 38 | ) | ) |
39 | 39 | : | : |
40 | 40 | PDFTransportModel(name, dict, mesh), | PDFTransportModel(name, dict, mesh), |
41 | name_(name), | ||
42 | solveODESource_ | ||
43 | ( | ||
44 | dict.subDict("odeCoeffs").lookupOrDefault("solveODESource", true) | ||
45 | ), | ||
46 | ATol_(readScalar(dict.subDict("odeCoeffs").lookup("ATol"))), | ||
47 | RTol_(readScalar(dict.subDict("odeCoeffs").lookup("RTol"))), | ||
48 | fac_(readScalar(dict.subDict("odeCoeffs").lookup("fac"))), | ||
49 | facMin_(readScalar(dict.subDict("odeCoeffs").lookup("facMin"))), | ||
50 | facMax_(readScalar(dict.subDict("odeCoeffs").lookup("facMax"))), | ||
51 | minLocalDt_(readScalar(dict.subDict("odeCoeffs").lookup("minLocalDt"))), | ||
52 | localDt_(mesh.nCells(), mesh.time().deltaTValue()/10.0), | ||
53 | 41 | quadrature_(name, mesh, support), | quadrature_(name, mesh, support), |
54 | 42 | momentAdvection_ | momentAdvection_ |
55 | 43 | ( | ( |
... | ... | Foam::PDFTransportModels::univariatePDFTransportModel | |
71 | 59 | ||
72 | 60 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
73 | 61 | ||
74 | void Foam::PDFTransportModels::univariatePDFTransportModel | ||
75 | ::explicitMomentSource() | ||
76 | { | ||
77 | volUnivariateMomentFieldSet& moments(quadrature_.moments()); | ||
78 | label nMoments = quadrature_.nMoments(); | ||
79 | scalar globalDt = moments[0].mesh().time().deltaT().value(); | ||
80 | |||
81 | Info << "Solving source terms in realizable ODE solver." << endl; | ||
82 | |||
83 | forAll(moments[0], celli) | ||
84 | { | ||
85 | // Storing old moments to recover from failed step | ||
86 | |||
87 | scalarList oldMoments(nMoments, 0.0); | ||
88 | |||
89 | forAll(oldMoments, mi) | ||
90 | { | ||
91 | oldMoments[mi] = moments[mi][celli]; | ||
92 | } | ||
93 | |||
94 | //- Local time | ||
95 | scalar localT = 0.0; | ||
96 | |||
97 | // Initialize the local step | ||
98 | scalar localDt = localDt_[celli]; | ||
99 | |||
100 | // Initialize RK parameters | ||
101 | scalarList k1(nMoments, 0.0); | ||
102 | scalarList k2(nMoments, 0.0); | ||
103 | scalarList k3(nMoments, 0.0); | ||
104 | |||
105 | // Flag to indicate if the time step is complete | ||
106 | bool timeComplete = false; | ||
107 | |||
108 | // Check realizability of intermediate moment sets | ||
109 | bool realizableUpdate1 = false; | ||
110 | bool realizableUpdate2 = false; | ||
111 | bool realizableUpdate3 = false; | ||
112 | |||
113 | scalarList momentsSecondStep(nMoments, 0.0); | ||
114 | |||
115 | while (!timeComplete) | ||
116 | { | ||
117 | do | ||
118 | { | ||
119 | // First intermediate update | ||
120 | forAll(oldMoments, mi) | ||
121 | { | ||
122 | k1[mi] = localDt*cellMomentSource(mi, celli); | ||
123 | moments[mi][celli] = oldMoments[mi] + k1[mi]; | ||
124 | } | ||
125 | |||
126 | realizableUpdate1 = | ||
127 | quadrature_.updateLocalQuadrature(celli, false); | ||
128 | |||
129 | quadrature_.updateLocalMoments(celli); | ||
130 | |||
131 | // Second moment update | ||
132 | forAll(oldMoments, mi) | ||
133 | { | ||
134 | k2[mi] = localDt*cellMomentSource(mi, celli); | ||
135 | moments[mi][celli] = oldMoments[mi] + (k1[mi] + k2[mi])/4.0; | ||
136 | |||
137 | momentsSecondStep[mi] = moments[mi][celli]; | ||
138 | } | ||
139 | |||
140 | realizableUpdate2 = | ||
141 | quadrature_.updateLocalQuadrature(celli, false); | ||
142 | |||
143 | quadrature_.updateLocalMoments(celli); | ||
144 | |||
145 | // Third moment update | ||
146 | forAll(oldMoments, mi) | ||
147 | { | ||
148 | k3[mi] = localDt*cellMomentSource(mi, celli); | ||
149 | moments[mi][celli] = | ||
150 | oldMoments[mi] + (k1[mi] + k2[mi] + 4.0*k3[mi])/6.0; | ||
151 | } | ||
152 | |||
153 | realizableUpdate3 = | ||
154 | quadrature_.updateLocalQuadrature(celli, false); | ||
155 | |||
156 | quadrature_.updateLocalMoments(celli); | ||
157 | |||
158 | if | ||
159 | ( | ||
160 | !realizableUpdate1 | ||
161 | || !realizableUpdate2 | ||
162 | || !realizableUpdate3 | ||
163 | ) | ||
164 | { | ||
165 | Info << "Not realizable" << endl; | ||
166 | |||
167 | forAll(oldMoments, mi) | ||
168 | { | ||
169 | moments[mi][celli] = oldMoments[mi]; | ||
170 | } | ||
171 | |||
172 | // Updating local quadrature with old moments | ||
173 | quadrature_.updateLocalQuadrature(celli); | ||
174 | |||
175 | localDt /= 2.0; | ||
176 | |||
177 | if (localDt < minLocalDt_) | ||
178 | { | ||
179 | FatalErrorInFunction | ||
180 | << "Reached minimum local step in realizable ODE" | ||
181 | << nl | ||
182 | << " solver. Cannot ensure realizability." << nl | ||
183 | << abort(FatalError); | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | while | ||
188 | ( | ||
189 | !realizableUpdate1 | ||
190 | || !realizableUpdate2 | ||
191 | || !realizableUpdate3 | ||
192 | ); | ||
193 | |||
194 | scalar error = 0.0; | ||
195 | |||
196 | for (label mi = 0; mi < nMoments; mi++) | ||
197 | { | ||
198 | scalar scalei = | ||
199 | ATol_ | ||
200 | + max | ||
201 | ( | ||
202 | mag(momentsSecondStep[mi]), mag(oldMoments[mi]) | ||
203 | )*RTol_; | ||
204 | |||
205 | error += | ||
206 | sqr | ||
207 | ( | ||
208 | (momentsSecondStep[mi] - moments[mi][celli])/scalei | ||
209 | ); | ||
210 | } | ||
211 | |||
212 | error = sqrt(error/nMoments); | ||
213 | |||
214 | if (error < 1) | ||
215 | { | ||
216 | localDt *= min(facMax_, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
217 | |||
218 | scalar maxLocalDt = max(globalDt - localT, 0.0); | ||
219 | localDt = min(maxLocalDt, localDt); | ||
220 | |||
221 | forAll(oldMoments, mi) | ||
222 | { | ||
223 | oldMoments[mi] = moments[mi][celli]; | ||
224 | } | ||
225 | |||
226 | if (localDt == 0.0) | ||
227 | { | ||
228 | timeComplete = true; | ||
229 | localT = 0.0; | ||
230 | break; | ||
231 | } | ||
232 | |||
233 | localDt_[celli] = localDt; | ||
234 | localT += localDt; | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | localDt *= min(1.0, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
239 | |||
240 | forAll(oldMoments, mi) | ||
241 | { | ||
242 | moments[mi][celli] = oldMoments[mi]; | ||
243 | } | ||
244 | } | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | 62 | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() |
250 | 63 | { | { |
251 | 64 | momentAdvection_().update(); | momentAdvection_().update(); |
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | |
256 | 69 | // Solve moment transport equations | // Solve moment transport equations |
257 | 70 | forAll(quadrature_.moments(), momenti) | forAll(quadrature_.moments(), momenti) |
258 | 71 | { | { |
259 | volUnivariateMoment& m = quadrature_.moments()[momenti]; | ||
72 | volScalarMoment& m = quadrature_.moments()[momenti]; | ||
260 | 73 | ||
261 | 74 | momentEqns.set | momentEqns.set |
262 | 75 | ( | ( |
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | |
265 | 78 | ( | ( |
266 | 79 | fvm::ddt(m) | fvm::ddt(m) |
267 | 80 | + momentAdvection_().divMoments()[momenti] | + momentAdvection_().divMoments()[momenti] |
268 | - momentDiffusion(m) | ||
269 | 81 | == | == |
270 | 82 | implicitMomentSource(m) | implicitMomentSource(m) |
271 | 83 | ) | ) |
272 | 84 | ); | ); |
273 | 85 | } | } |
274 | |||
275 | if (solveODESource_) | ||
276 | { | ||
277 | explicitMomentSource(); | ||
278 | } | ||
279 | |||
86 | |||
280 | 87 | forAll (momentEqns, mEqni) | forAll (momentEqns, mEqni) |
281 | 88 | { | { |
282 | volUnivariateMoment& m = quadrature_.moments()[mEqni]; | ||
283 | |||
284 | if (solveODESource_) | ||
285 | { | ||
286 | momentEqns[mEqni] -= fvc::ddt(m); | ||
287 | } | ||
288 | |||
289 | 89 | momentEqns[mEqni].relax(); | momentEqns[mEqni].relax(); |
290 | 90 | momentEqns[mEqni].solve(); | momentEqns[mEqni].solve(); |
291 | 91 | } | } |
292 | |||
92 | |||
293 | 93 | quadrature_.updateQuadrature(); | quadrature_.updateQuadrature(); |
294 | //quadrature_.updateMoments(); | ||
94 | |||
95 | if (solveMomentSources()) | ||
96 | { | ||
97 | this->explicitMomentSource(); | ||
98 | } | ||
295 | 99 | } | } |
296 | 100 | ||
297 | 101 |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.H changed (mode: 100644) (index 9fb6b8d..ddb2056) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class univariatePDFTransportModel | |
55 | 55 | : | : |
56 | 56 | public PDFTransportModel | public PDFTransportModel |
57 | 57 | { | { |
58 | // Private data | ||
59 | |||
60 | //- Name of the univariatePDFTransportModel | ||
61 | const word name_; | ||
62 | |||
63 | Switch solveODESource_; | ||
64 | |||
65 | //- Absolute tolerance for realizable ODE solver | ||
66 | scalar ATol_; | ||
67 | |||
68 | //- Relative tolerance for realizable ODE solver | ||
69 | scalar RTol_; | ||
70 | |||
71 | //- Time-step change factor | ||
72 | scalar fac_; | ||
73 | |||
74 | //- Minimum time-step change factor | ||
75 | scalar facMin_; | ||
76 | |||
77 | //- Maximum time-step change factor | ||
78 | scalar facMax_; | ||
79 | |||
80 | //- Minimum local step in realizable ODE solver | ||
81 | scalar minLocalDt_; | ||
82 | |||
83 | //- Stored time step values | ||
84 | scalarField localDt_; | ||
85 | |||
86 | |||
87 | 58 | protected: | protected: |
88 | 59 | ||
89 | 60 | // Protected data | // Protected data |
90 | 61 | ||
91 | 62 | //- Univariate quadrature approximation used to solve PDF transport | //- Univariate quadrature approximation used to solve PDF transport |
92 | univariateQuadratureApproximation quadrature_; | ||
63 | scalarQuadratureApproximation quadrature_; | ||
93 | 64 | ||
94 | 65 | //- Moment advection | //- Moment advection |
95 | 66 | autoPtr<univariateMomentAdvection> momentAdvection_; | autoPtr<univariateMomentAdvection> momentAdvection_; |
96 | 67 | ||
97 | 68 | // Protected member functions | // Protected member functions |
98 | 69 | ||
99 | //- Diffusion term | ||
100 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
101 | ( | ||
102 | const volUnivariateMoment& moment | ||
103 | ) = 0; | ||
104 | 70 | ||
105 | 71 | //- Calculate implicit source terms | //- Calculate implicit source terms |
106 | 72 | virtual tmp<fvScalarMatrix> implicitMomentSource | virtual tmp<fvScalarMatrix> implicitMomentSource |
107 | 73 | ( | ( |
108 | const volUnivariateMoment& moment | ||
74 | const volScalarMoment& moment | ||
109 | 75 | ) = 0; | ) = 0; |
110 | 76 | ||
111 | 77 | //- Calculate explicit source terms with realizable ODE solver | //- Calculate explicit source terms with realizable ODE solver |
112 | virtual void explicitMomentSource(); | ||
78 | virtual void explicitMomentSource() = 0; | ||
113 | 79 | ||
114 | //- Calculate source term for moment equation in the specified cell | ||
115 | virtual scalar cellMomentSource | ||
116 | ( | ||
117 | label& momentOrder, | ||
118 | label& celli | ||
119 | ) = 0; | ||
80 | //- Are moments updated due to sources | ||
81 | virtual bool solveMomentSources() const = 0; | ||
82 | |||
83 | //- Is the realizable ode solver used to solve sources | ||
84 | virtual bool solveMomentOde() const = 0; | ||
120 | 85 | ||
121 | 86 | ||
122 | 87 | public: | public: |
... | ... | public: | |
143 | 108 | //- Access | //- Access |
144 | 109 | ||
145 | 110 | //- Returns a const reference to the quadrature approximation | //- Returns a const reference to the quadrature approximation |
146 | inline const univariateQuadratureApproximation& quadrature() const; | ||
111 | inline const scalarQuadratureApproximation& quadrature() const; | ||
147 | 112 | ||
148 | 113 | //- Return the maximum Courant number ensuring moment realizability | //- Return the maximum Courant number ensuring moment realizability |
149 | 114 | inline scalar realizableCo() const; | inline scalar realizableCo() const; |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H changed (mode: 100755) (index c407ebf..0f64b89) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
25 | 25 | ||
26 | 26 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
27 | 27 | ||
28 | const Foam::univariateQuadratureApproximation& | ||
28 | const Foam::scalarQuadratureApproximation& | ||
29 | 29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const |
30 | 30 | { | { |
31 | 31 | return quadrature_; | return quadrature_; |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/velocityPDFTransportModel/velocityPDFTransportModel.C changed (mode: 100644) (index 778a2c9..a0e91bb) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::velocityPDFTransportModel::velocityPDFTransportModel | |
36 | 36 | ) | ) |
37 | 37 | : | : |
38 | 38 | PDFTransportModel(name, dict, mesh), | PDFTransportModel(name, dict, mesh), |
39 | name_(name), | ||
40 | solveODESource_ | ||
41 | ( | ||
42 | dict.subDict("odeCoeffs").lookupOrDefault("solveODESource", false) | ||
43 | ), | ||
44 | ATol_(readScalar(dict.subDict("odeCoeffs").lookup("ATol"))), | ||
45 | RTol_(readScalar(dict.subDict("odeCoeffs").lookup("RTol"))), | ||
46 | fac_(readScalar(dict.subDict("odeCoeffs").lookup("fac"))), | ||
47 | facMin_(readScalar(dict.subDict("odeCoeffs").lookup("facMin"))), | ||
48 | facMax_(readScalar(dict.subDict("odeCoeffs").lookup("facMax"))), | ||
49 | minLocalDt_(readScalar(dict.subDict("odeCoeffs").lookup("minLocalDt"))), | ||
50 | localDt_(mesh.nCells(), mesh.time().deltaTValue()/10.0), | ||
51 | 39 | quadrature_(name, mesh, support), | quadrature_(name, mesh, support), |
52 | 40 | momentAdvection_ | momentAdvection_ |
53 | 41 | ( | ( |
... | ... | Foam::PDFTransportModels::velocityPDFTransportModel::~velocityPDFTransportModel( | |
67 | 55 | ||
68 | 56 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
69 | 57 | ||
70 | void Foam::PDFTransportModels::velocityPDFTransportModel::explicitMomentSource() | ||
71 | { | ||
72 | volVectorMomentFieldSet& moments(quadrature_.moments()); | ||
73 | label nMoments = quadrature_.nMoments(); | ||
74 | scalar globalDt = moments[0].mesh().time().deltaT().value(); | ||
75 | |||
76 | Info << "Solving source terms in realizable ODE solver." << endl; | ||
77 | |||
78 | forAll(moments[0], celli) | ||
79 | { | ||
80 | // Storing old moments to recover from failed step | ||
81 | |||
82 | scalarList oldMoments(nMoments, 0.0); | ||
83 | |||
84 | forAll(oldMoments, mi) | ||
85 | { | ||
86 | oldMoments[mi] = moments[mi][celli]; | ||
87 | } | ||
88 | |||
89 | //- Local time | ||
90 | scalar localT = 0.0; | ||
91 | |||
92 | // Initialize the local step | ||
93 | scalar localDt = localDt_[celli]; | ||
94 | |||
95 | // Initialize RK parameters | ||
96 | scalarList k1(nMoments, 0.0); | ||
97 | scalarList k2(nMoments, 0.0); | ||
98 | scalarList k3(nMoments, 0.0); | ||
99 | |||
100 | // Flag to indicate if the time step is complete | ||
101 | bool timeComplete = false; | ||
102 | |||
103 | // Check realizability of intermediate moment sets | ||
104 | bool realizableUpdate1 = false; | ||
105 | bool realizableUpdate2 = false; | ||
106 | bool realizableUpdate3 = false; | ||
107 | |||
108 | scalarList momentsSecondStep(nMoments, 0.0); | ||
109 | |||
110 | while (!timeComplete) | ||
111 | { | ||
112 | do | ||
113 | { | ||
114 | // First intermediate update | ||
115 | updateExplicitCollisionSource(celli); | ||
116 | forAll(oldMoments, mi) | ||
117 | { | ||
118 | k1[mi] = localDt*cellMomentSource(mi, celli); | ||
119 | moments[mi][celli] = oldMoments[mi] + k1[mi]; | ||
120 | } | ||
121 | |||
122 | realizableUpdate1 = | ||
123 | quadrature_.updateLocalQuadrature(celli, false); | ||
124 | |||
125 | quadrature_.updateLocalMoments(celli); | ||
126 | |||
127 | // Second moment update | ||
128 | updateExplicitCollisionSource(celli); | ||
129 | forAll(oldMoments, mi) | ||
130 | { | ||
131 | k2[mi] = localDt*cellMomentSource(mi, celli); | ||
132 | moments[mi][celli] = oldMoments[mi] + (k1[mi] + k2[mi])/4.0; | ||
133 | |||
134 | momentsSecondStep[mi] = moments[mi][celli]; | ||
135 | } | ||
136 | |||
137 | realizableUpdate2 = | ||
138 | quadrature_.updateLocalQuadrature(celli, false); | ||
139 | |||
140 | quadrature_.updateLocalMoments(celli); | ||
141 | |||
142 | // Third moment update | ||
143 | updateExplicitCollisionSource(celli); | ||
144 | forAll(oldMoments, mi) | ||
145 | { | ||
146 | k3[mi] = localDt*cellMomentSource(mi, celli); | ||
147 | moments[mi][celli] = | ||
148 | oldMoments[mi] + (k1[mi] + k2[mi] + 4.0*k3[mi])/6.0; | ||
149 | } | ||
150 | |||
151 | realizableUpdate3 = | ||
152 | quadrature_.updateLocalQuadrature(celli, false); | ||
153 | |||
154 | quadrature_.updateLocalMoments(celli); | ||
155 | |||
156 | if | ||
157 | ( | ||
158 | !realizableUpdate1 | ||
159 | || !realizableUpdate2 | ||
160 | || !realizableUpdate3 | ||
161 | ) | ||
162 | { | ||
163 | Info << "Not realizable" << endl; | ||
164 | |||
165 | forAll(oldMoments, mi) | ||
166 | { | ||
167 | moments[mi][celli] = oldMoments[mi]; | ||
168 | } | ||
169 | |||
170 | localDt /= 2.0; | ||
171 | |||
172 | if (localDt < minLocalDt_) | ||
173 | { | ||
174 | FatalErrorInFunction | ||
175 | << "Reached minimum local step in realizable ODE" | ||
176 | << nl | ||
177 | << " solver. Cannot ensure realizability." << nl | ||
178 | << abort(FatalError); | ||
179 | } | ||
180 | } | ||
181 | } | ||
182 | while | ||
183 | ( | ||
184 | !realizableUpdate1 | ||
185 | || !realizableUpdate2 | ||
186 | || !realizableUpdate3 | ||
187 | ); | ||
188 | |||
189 | scalar error = 0.0; | ||
190 | |||
191 | for (label mi = 0; mi < nMoments; mi++) | ||
192 | { | ||
193 | scalar scalei = | ||
194 | ATol_ | ||
195 | + max | ||
196 | ( | ||
197 | mag(momentsSecondStep[mi]), mag(oldMoments[mi]) | ||
198 | )*RTol_; | ||
199 | |||
200 | error += | ||
201 | sqr | ||
202 | ( | ||
203 | (momentsSecondStep[mi] - moments[mi][celli])/scalei | ||
204 | ); | ||
205 | } | ||
206 | |||
207 | error = max(sqrt(error/nMoments), SMALL); | ||
208 | |||
209 | if (error < 1) | ||
210 | { | ||
211 | localDt *= min(facMax_, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
212 | |||
213 | scalar maxLocalDt = max(globalDt - localT, 0.0); | ||
214 | localDt = min(maxLocalDt, localDt); | ||
215 | |||
216 | forAll(oldMoments, mi) | ||
217 | { | ||
218 | oldMoments[mi] = moments[mi][celli]; | ||
219 | } | ||
220 | |||
221 | if (localDt == 0.0) | ||
222 | { | ||
223 | timeComplete = true; | ||
224 | localT = 0.0; | ||
225 | break; | ||
226 | } | ||
227 | |||
228 | localDt_[celli] = localDt; | ||
229 | localT += localDt; | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | localDt *= min(1.0, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
234 | |||
235 | forAll(oldMoments, mi) | ||
236 | { | ||
237 | moments[mi][celli] = oldMoments[mi]; | ||
238 | } | ||
239 | } | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | |||
244 | 58 | void Foam::PDFTransportModels::velocityPDFTransportModel::solve() | void Foam::PDFTransportModels::velocityPDFTransportModel::solve() |
245 | 59 | { | { |
246 | 60 | momentAdvection_().update(); | momentAdvection_().update(); |
247 | 61 | ||
248 | // List of moment transport equations | ||
249 | PtrList<fvScalarMatrix> momentEqns(quadrature_.nMoments()); | ||
250 | |||
251 | 62 | // Solve moment transport equations | // Solve moment transport equations |
63 | updateImplicitMomentSource(); | ||
64 | |||
252 | 65 | forAll(quadrature_.moments(), momenti) | forAll(quadrature_.moments(), momenti) |
253 | 66 | { | { |
254 | volVectorMoment& m = quadrature_.moments()[momenti]; | ||
255 | momentEqns.set | ||
256 | ( | ||
257 | momenti, | ||
258 | new fvScalarMatrix | ||
259 | ( | ||
260 | fvm::ddt(m) | ||
261 | + momentAdvection_().divMoments()[momenti] | ||
262 | ) | ||
263 | ); | ||
264 | } | ||
265 | |||
266 | if (collision()) | ||
267 | { | ||
268 | if (solveODESource_) | ||
269 | { | ||
270 | explicitMomentSource(); | ||
271 | } | ||
272 | else | ||
273 | { | ||
274 | updateImplicitCollisionSource(); | ||
275 | } | ||
276 | |||
277 | forAll(quadrature_.moments(), mEqni) | ||
278 | { | ||
279 | volVectorMoment& m = quadrature_.moments()[mEqni]; | ||
280 | |||
281 | if (solveODESource_) | ||
282 | { | ||
283 | momentEqns[mEqni] -= fvc::ddt(m); | ||
284 | } | ||
285 | else | ||
286 | { | ||
287 | // Solve moment transport excluding collisions | ||
288 | momentEqns[mEqni].relax(); | ||
289 | momentEqns[mEqni].solve(); | ||
290 | |||
291 | // Set moments.oldTime to moments transport is not neglected due to | ||
292 | // large collision source terms | ||
293 | m.oldTime() = m; | ||
294 | |||
295 | // Solve collisions | ||
296 | momentEqns.set | ||
297 | ( | ||
298 | mEqni, | ||
299 | new fvScalarMatrix | ||
300 | ( | ||
301 | fvm::ddt(m) | ||
302 | == | ||
303 | implicitCollisionSource(m) | ||
304 | ) | ||
305 | ); | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | |||
310 | forAll(quadrature_.moments(), mEqni) | ||
311 | { | ||
312 | momentEqns[mEqni].relax(); | ||
313 | momentEqns[mEqni].solve(); | ||
314 | } | ||
315 | |||
316 | quadrature_.updateQuadrature(); | ||
317 | } | ||
318 | |||
319 | void Foam::PDFTransportModels::velocityPDFTransportModel::meanTransport | ||
320 | ( | ||
321 | const surfaceScalarField& phi, | ||
322 | const bool wallCollisions | ||
323 | ) | ||
324 | { | ||
325 | Info<< "Solving mean transport" << endl; | ||
326 | |||
327 | momentAdvection_().update(phi, wallCollisions); | ||
328 | |||
329 | // Solve moment transport equations | ||
330 | forAll(quadrature_.moments(), momenti) | ||
331 | { | ||
332 | volScalarField& m = quadrature_.moments()[momenti]; | ||
333 | fvScalarMatrix mEqn | ||
67 | volVelocityMoment& m = quadrature_.moments()[momenti]; | ||
68 | fvScalarMatrix momentEqn | ||
334 | 69 | ( | ( |
335 | 70 | fvm::ddt(m) | fvm::ddt(m) |
336 | - fvc::ddt(m) | ||
337 | 71 | + momentAdvection_().divMoments()[momenti] | + momentAdvection_().divMoments()[momenti] |
72 | == | ||
73 | implicitMomentSource(m) | ||
338 | 74 | ); | ); |
339 | |||
340 | mEqn.relax(); | ||
341 | mEqn.solve(); | ||
75 | momentEqn.relax(); | ||
76 | momentEqn.solve(); | ||
342 | 77 | } | } |
343 | } | ||
344 | |||
345 | void Foam::PDFTransportModels::velocityPDFTransportModel::relativeTransport | ||
346 | ( | ||
347 | const mappedPtrList<volVectorField>& Vs, | ||
348 | const bool wallCollisions | ||
349 | ) | ||
350 | { | ||
351 | Info<< "Solving relative transport" << endl; | ||
352 | 78 | ||
353 | momentAdvection_().update(Vs, wallCollisions); | ||
79 | quadrature_.updateQuadrature(); | ||
354 | 80 | ||
355 | // Solve moment transport equations | ||
356 | forAll(quadrature_.moments(), momenti) | ||
81 | if (solveMomentSources()) | ||
357 | 82 | { | { |
358 | volScalarField& m = quadrature_.moments()[momenti]; | ||
359 | fvScalarMatrix mEqn | ||
360 | ( | ||
361 | fvm::ddt(m) | ||
362 | + momentAdvection_().divMoments()[momenti] | ||
363 | ); | ||
364 | |||
365 | mEqn.relax(); | ||
366 | mEqn.solve(); | ||
83 | this->explicitMomentSource(); | ||
367 | 84 | } | } |
368 | 85 | } | } |
369 | 86 | ||
87 | |||
370 | 88 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/velocityPDFTransportModel/velocityPDFTransportModel.H changed (mode: 100644) (index 0c407be..fa2e481) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class velocityPDFTransportModel | |
55 | 55 | : | : |
56 | 56 | public PDFTransportModel | public PDFTransportModel |
57 | 57 | { | { |
58 | // Private data | ||
59 | |||
60 | //- Name of the velocityPDFTransportModel | ||
61 | const word name_; | ||
62 | |||
63 | //- Switch to solve source terms with ode solver | ||
64 | Switch solveODESource_; | ||
65 | |||
66 | //- Absolute tolerance for realizable ODE solver | ||
67 | scalar ATol_; | ||
68 | |||
69 | //- Relative tolerance for realizable ODE solver | ||
70 | scalar RTol_; | ||
71 | |||
72 | //- Time-step change factor | ||
73 | scalar fac_; | ||
74 | |||
75 | //- Minimum time-step change factor | ||
76 | scalar facMin_; | ||
77 | |||
78 | //- Maximum time-step change factor | ||
79 | scalar facMax_; | ||
80 | |||
81 | //- Minimum local step in realizable ODE solver | ||
82 | label minLocalDt_; | ||
83 | |||
84 | //- Stored time step values | ||
85 | scalarField localDt_; | ||
86 | |||
87 | |||
88 | 58 | protected: | protected: |
89 | 59 | ||
90 | 60 | // Protected data | // Protected data |
... | ... | protected: | |
97 | 67 | ||
98 | 68 | // Protected member functions | // Protected member functions |
99 | 69 | ||
100 | //- Return if collisions are used | ||
101 | virtual bool collision() const = 0; | ||
102 | |||
103 | 70 | //- Update implicit collison source terms | //- Update implicit collison source terms |
104 | virtual void updateImplicitCollisionSource() = 0; | ||
105 | |||
106 | //- Update explicit collison source terms | ||
107 | virtual void updateExplicitCollisionSource(const label celli) = 0; | ||
71 | virtual void updateImplicitMomentSource() = 0; | ||
108 | 72 | ||
109 | 73 | //- Calculate implicit source terms | //- Calculate implicit source terms |
110 | virtual tmp<fvScalarMatrix> implicitCollisionSource | ||
111 | ( | ||
112 | const volVectorMoment& moment | ||
113 | ) = 0; | ||
114 | |||
115 | virtual scalar explicitCollisionSource | ||
74 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
116 | 75 | ( | ( |
117 | const label momenti, | ||
118 | const label celli | ||
76 | const volVelocityMoment& moment | ||
119 | 77 | ) = 0; | ) = 0; |
120 | 78 | ||
121 | 79 | //- Calculate explicit source terms with realizable ODE solver | //- Calculate explicit source terms with realizable ODE solver |
122 | virtual void explicitMomentSource(); | ||
80 | virtual void explicitMomentSource() = 0; | ||
123 | 81 | ||
124 | //- Calculate source term for moment equation in the specified cell | ||
125 | virtual scalar cellMomentSource | ||
126 | ( | ||
127 | const label momentOrder, | ||
128 | const label celli | ||
129 | ) = 0; | ||
82 | //- Are moments updated due to sources | ||
83 | virtual bool solveMomentSources() const = 0; | ||
84 | |||
85 | //- Is the realizable ode solver used to solve sources | ||
86 | virtual bool solveMomentOde() const = 0; | ||
130 | 87 | ||
131 | 88 | ||
132 | 89 | public: | public: |
... | ... | public: | |
165 | 122 | ||
166 | 123 | //- Solve velocity PDF transport equation | //- Solve velocity PDF transport equation |
167 | 124 | virtual void solve(); | virtual void solve(); |
168 | |||
169 | //- Solve mean tranport | ||
170 | virtual void meanTransport | ||
171 | ( | ||
172 | const surfaceScalarField& phi, | ||
173 | const bool wallCollisions | ||
174 | ); | ||
175 | |||
176 | //- Solve relative transport | ||
177 | virtual void relativeTransport | ||
178 | ( | ||
179 | const mappedPtrList<volVectorField>& Vs, | ||
180 | const bool wallCollisions | ||
181 | ); | ||
182 | 125 | }; | }; |
183 | 126 | ||
184 | 127 |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/velocityPDFTransportModel/velocityPDFTransportModelI.H changed (mode: 100755) (index 5cb40ea..6e1dbd3) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/Make/files changed (mode: 100644) (index b8302a0..2c13f68) | |||
... | ... | fieldMomentInversion/fieldMomentInversion.C | |
2 | 2 | fieldMomentInversion/newFieldMomentInversion.C | fieldMomentInversion/newFieldMomentInversion.C |
3 | 3 | basicFieldMomentInversion/basicFieldMomentInversion.C | basicFieldMomentInversion/basicFieldMomentInversion.C |
4 | 4 | extendedFieldMomentInversion/extendedFieldMomentInversion.C | extendedFieldMomentInversion/extendedFieldMomentInversion.C |
5 | hyperbolicFieldMomentInversion/hyperbolicFieldMomentInversion.C | ||
5 | basicVelocityFieldMomentInversion/basicVelocityFieldMomentInversion.C | ||
6 | 6 | ||
7 | 7 | LIB = $(FOAM_USER_LIBBIN)/libfieldMomentInversion | LIB = $(FOAM_USER_LIBBIN)/libfieldMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/Make/options changed (mode: 100644) (index 64012c8..3b64806) | |||
... | ... | EXE_INC = \ | |
3 | 3 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
4 | 4 | -I../../mappedList \ | -I../../mappedList \ |
5 | 5 | -I../../mappedPtrList \ | -I../../mappedPtrList \ |
6 | -I../quadratureNode \ | ||
6 | -I../../Vandermonde \ | ||
7 | -I../quadratureNode/lnInclude \ | ||
7 | 8 | -I../moments \ | -I../moments \ |
8 | 9 | -I../momentSets/lnInclude \ | -I../momentSets/lnInclude \ |
9 | -I../momentInversion/lnInclude \ | ||
10 | -I../momentInversion/lnInclude | ||
10 | 11 | ||
11 | 12 | LIB_LIBS = \ | LIB_LIBS = \ |
12 | 13 | -lfiniteVolume \ | -lfiniteVolume \ |
13 | 14 | -lmeshTools \ | -lmeshTools \ |
14 | 15 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
16 | -lquadratureNode \ | ||
15 | 17 | -lmomentSets \ | -lmomentSets \ |
16 | -lmomentInversion | ||
18 | -lmomentInversion \ | ||
19 | -lvandermonde |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/basicFieldMomentInversion/basicFieldMomentInversion.C changed (mode: 100755) (index 2de240f..dadcab9) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::basicFieldMomentInversion::basicFieldMomentInversion | |
48 | 48 | const fvMesh& mesh, | const fvMesh& mesh, |
49 | 49 | const labelListList& momentOrders, | const labelListList& momentOrders, |
50 | 50 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
51 | const labelList& velocityIndexes, | ||
51 | 52 | const label nSecondaryNodes | const label nSecondaryNodes |
52 | 53 | ) | ) |
53 | 54 | : | : |
... | ... | Foam::basicFieldMomentInversion::basicFieldMomentInversion | |
57 | 58 | mesh, | mesh, |
58 | 59 | momentOrders, | momentOrders, |
59 | 60 | nodeIndexes, | nodeIndexes, |
61 | velocityIndexes, | ||
60 | 62 | nSecondaryNodes | nSecondaryNodes |
61 | 63 | ), | ), |
62 | 64 | minKnownAbscissa_(dict.lookupOrDefault("minKnownAbscissa", 0.0)), | minKnownAbscissa_(dict.lookupOrDefault("minKnownAbscissa", 0.0)), |
... | ... | Foam::basicFieldMomentInversion::~basicFieldMomentInversion() | |
90 | 92 | ||
91 | 93 | void Foam::basicFieldMomentInversion::invert | void Foam::basicFieldMomentInversion::invert |
92 | 94 | ( | ( |
93 | const volUnivariateMomentFieldSet& moments, | ||
95 | const volScalarMomentFieldSet& moments, | ||
94 | 96 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
95 | 97 | ) | ) |
96 | 98 | { | { |
97 | const volUnivariateMoment& m0(moments[0]); | ||
99 | const volScalarField& m0(moments(0)); | ||
98 | 100 | ||
99 | 101 | forAll(m0, celli) | forAll(m0, celli) |
100 | 102 | { | { |
... | ... | void Foam::basicFieldMomentInversion::invert | |
106 | 108 | ||
107 | 109 | void Foam::basicFieldMomentInversion::invertBoundaryMoments | void Foam::basicFieldMomentInversion::invertBoundaryMoments |
108 | 110 | ( | ( |
109 | const volUnivariateMomentFieldSet& moments, | ||
111 | const volScalarMomentFieldSet& moments, | ||
110 | 112 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
111 | 113 | ) | ) |
112 | 114 | { | { |
... | ... | void Foam::basicFieldMomentInversion::invertBoundaryMoments | |
154 | 156 | = node.primaryWeight().boundaryFieldRef(); | = node.primaryWeight().boundaryFieldRef(); |
155 | 157 | ||
156 | 158 | volScalarField::Boundary& abscissaBf | volScalarField::Boundary& abscissaBf |
157 | = node.primaryAbscissa().boundaryFieldRef(); | ||
159 | = node.primaryAbscissae()[0].boundaryFieldRef(); | ||
158 | 160 | ||
159 | 161 | if (nodei < actualNodes) | if (nodei < actualNodes) |
160 | 162 | { | { |
... | ... | void Foam::basicFieldMomentInversion::invertBoundaryMoments | |
176 | 178 | ||
177 | 179 | bool Foam::basicFieldMomentInversion::invertLocalMoments | bool Foam::basicFieldMomentInversion::invertLocalMoments |
178 | 180 | ( | ( |
179 | const volUnivariateMomentFieldSet& moments, | ||
181 | const volScalarMomentFieldSet& moments, | ||
180 | 182 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
181 | 183 | const label celli, | const label celli, |
182 | 184 | const bool fatalErrorOnFailedRealizabilityTest | const bool fatalErrorOnFailedRealizabilityTest |
... | ... | bool Foam::basicFieldMomentInversion::invertLocalMoments | |
226 | 228 | if (nodei < actualNodes) | if (nodei < actualNodes) |
227 | 229 | { | { |
228 | 230 | node.primaryWeight()[celli] = weights[nodei]; | node.primaryWeight()[celli] = weights[nodei]; |
229 | node.primaryAbscissa()[celli] = abscissae[nodei]; | ||
231 | node.primaryAbscissae()[0][celli] = abscissae[nodei]; | ||
230 | 232 | } | } |
231 | 233 | else | else |
232 | 234 | { | { |
233 | 235 | node.primaryWeight()[celli] = 0.0; | node.primaryWeight()[celli] = 0.0; |
234 | node.primaryAbscissa()[celli] = 0.0; | ||
236 | node.primaryAbscissae()[0][celli] = 0.0; | ||
235 | 237 | } | } |
236 | 238 | } | } |
237 | 239 | ||
... | ... | bool Foam::basicFieldMomentInversion::invertLocalMoments | |
240 | 242 | ||
241 | 243 | void Foam::basicFieldMomentInversion::invert | void Foam::basicFieldMomentInversion::invert |
242 | 244 | ( | ( |
243 | const volVectorMomentFieldSet& moments, | ||
244 | mappedPtrList<volVectorNode>& nodes | ||
245 | const volVelocityMomentFieldSet& moments, | ||
246 | mappedPtrList<volVelocityNode>& nodes | ||
245 | 247 | ) | ) |
246 | 248 | { | { |
247 | 249 | NotImplemented; | NotImplemented; |
... | ... | void Foam::basicFieldMomentInversion::invert | |
249 | 251 | ||
250 | 252 | void Foam::basicFieldMomentInversion::invertBoundaryMoments | void Foam::basicFieldMomentInversion::invertBoundaryMoments |
251 | 253 | ( | ( |
252 | const volVectorMomentFieldSet& moments, | ||
253 | mappedPtrList<volVectorNode>& nodes | ||
254 | const volVelocityMomentFieldSet& moments, | ||
255 | mappedPtrList<volVelocityNode>& nodes | ||
254 | 256 | ) | ) |
255 | 257 | { | { |
256 | 258 | NotImplemented; | NotImplemented; |
... | ... | void Foam::basicFieldMomentInversion::invertBoundaryMoments | |
258 | 260 | ||
259 | 261 | bool Foam::basicFieldMomentInversion::invertLocalMoments | bool Foam::basicFieldMomentInversion::invertLocalMoments |
260 | 262 | ( | ( |
261 | const volVectorMomentFieldSet& moments, | ||
262 | mappedPtrList<volVectorNode>& nodes, | ||
263 | const volVelocityMomentFieldSet& moments, | ||
264 | mappedPtrList<volVelocityNode>& nodes, | ||
263 | 265 | const label celli, | const label celli, |
264 | 266 | const bool fatalErrorOnFailedRealizabilityTest | const bool fatalErrorOnFailedRealizabilityTest |
265 | 267 | ) | ) |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/basicFieldMomentInversion/basicFieldMomentInversion.H changed (mode: 100755) (index b5c55cc..8eb1310) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class basicFieldMomentInversion | |
70 | 70 | //- Moment inverter | //- Moment inverter |
71 | 71 | autoPtr<univariateMomentInversion> momentInverter_; | autoPtr<univariateMomentInversion> momentInverter_; |
72 | 72 | ||
73 | //- Disallow default bitwise copy construct | ||
74 | basicFieldMomentInversion(const basicFieldMomentInversion&); | ||
75 | |||
76 | //- Disallow default bitwise assignment | ||
77 | void operator=(const basicFieldMomentInversion&); | ||
78 | |||
79 | 73 | ||
80 | 74 | public: | public: |
81 | 75 | ||
... | ... | public: | |
92 | 86 | const fvMesh& mesh, | const fvMesh& mesh, |
93 | 87 | const labelListList& momentOrders, | const labelListList& momentOrders, |
94 | 88 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
89 | const labelList& velocityIndexes, | ||
95 | 90 | const label nSecondaryNodes | const label nSecondaryNodes |
96 | 91 | ); | ); |
97 | 92 | ||
93 | //- Disallow default bitwise copy construct | ||
94 | basicFieldMomentInversion(const basicFieldMomentInversion&) = delete; | ||
95 | |||
98 | 96 | ||
99 | 97 | //- Destructor | //- Destructor |
100 | 98 | ~basicFieldMomentInversion(); | ~basicFieldMomentInversion(); |
... | ... | public: | |
102 | 100 | ||
103 | 101 | // Public member Functions | // Public member Functions |
104 | 102 | ||
105 | // Univariate moment inversions | ||
103 | // Scalar moment inversions | ||
106 | 104 | ||
107 | 105 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
108 | 106 | virtual void invert | virtual void invert |
109 | 107 | ( | ( |
110 | const volUnivariateMomentFieldSet& moments, | ||
108 | const volScalarMomentFieldSet& moments, | ||
111 | 109 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
112 | 110 | ); | ); |
113 | 111 | ||
114 | 112 | //- Invert moments on boundaries | //- Invert moments on boundaries |
115 | 113 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
116 | 114 | ( | ( |
117 | const volUnivariateMomentFieldSet& moments, | ||
115 | const volScalarMomentFieldSet& moments, | ||
118 | 116 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
119 | 117 | ); | ); |
120 | 118 | ||
121 | 119 | //- Invert moments in a single cell | //- Invert moments in a single cell |
122 | 120 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
123 | 121 | ( | ( |
124 | const volUnivariateMomentFieldSet& moments, | ||
122 | const volScalarMomentFieldSet& moments, | ||
125 | 123 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
126 | 124 | const label celli, | const label celli, |
127 | 125 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
128 | 126 | ); | ); |
129 | 127 | ||
130 | 128 | ||
131 | // Multivriate moment inversions | ||
129 | // Velocity moment inversions | ||
132 | 130 | ||
133 | 131 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
134 | 132 | virtual void invert | virtual void invert |
135 | 133 | ( | ( |
136 | const volVectorMomentFieldSet& moments, | ||
137 | mappedPtrList<volVectorNode>& nodes | ||
134 | const volVelocityMomentFieldSet& moments, | ||
135 | mappedPtrList<volVelocityNode>& nodes | ||
138 | 136 | ); | ); |
139 | 137 | ||
140 | 138 | //- Invert moments on boundaries | //- Invert moments on boundaries |
141 | 139 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
142 | 140 | ( | ( |
143 | const volVectorMomentFieldSet& moments, | ||
144 | mappedPtrList<volVectorNode>& nodes | ||
141 | const volVelocityMomentFieldSet& moments, | ||
142 | mappedPtrList<volVelocityNode>& nodes | ||
145 | 143 | ); | ); |
146 | 144 | ||
147 | 145 | //- Invert moments in a single cell | //- Invert moments in a single cell |
148 | 146 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
149 | 147 | ( | ( |
150 | const volVectorMomentFieldSet& moments, | ||
151 | mappedPtrList<volVectorNode>& nodes, | ||
148 | const volVelocityMomentFieldSet& moments, | ||
149 | mappedPtrList<volVelocityNode>& nodes, | ||
152 | 150 | const label celli, | const label celli, |
153 | 151 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
154 | 152 | ); | ); |
153 | |||
154 | // Member Operators | ||
155 | |||
156 | //- Disallow default bitwise assignment | ||
157 | void operator=(const basicFieldMomentInversion&) = delete; | ||
155 | 158 | }; | }; |
156 | 159 | ||
157 | 160 |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/basicVelocityFieldMomentInversion/basicVelocityFieldMomentInversion.C renamed from multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/hyperbolicFieldMomentInversion/hyperbolicFieldMomentInversion.C (similarity 58%) (mode: 100755) (index 6a63b5a..491fd9d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "hyperbolicFieldMomentInversion.H" | ||
26 | #include "basicVelocityFieldMomentInversion.H" | ||
27 | 27 | ||
28 | 28 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
29 | 29 | ||
... | ... | License | |
31 | 31 | ||
32 | 32 | namespace Foam | namespace Foam |
33 | 33 | { | { |
34 | defineTypeNameAndDebug(hyperbolicFieldMomentInversion, 0); | ||
34 | defineTypeNameAndDebug(basicVelocityFieldMomentInversion, 0); | ||
35 | 35 | ||
36 | 36 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
37 | 37 | ( | ( |
38 | 38 | fieldMomentInversion, | fieldMomentInversion, |
39 | hyperbolicFieldMomentInversion, | ||
39 | basicVelocityFieldMomentInversion, | ||
40 | 40 | dictionary | dictionary |
41 | 41 | ); | ); |
42 | 42 | } | } |
43 | 43 | ||
44 | 44 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
45 | 45 | ||
46 | Foam::hyperbolicFieldMomentInversion::hyperbolicFieldMomentInversion | ||
46 | Foam::basicVelocityFieldMomentInversion::basicVelocityFieldMomentInversion | ||
47 | 47 | ( | ( |
48 | 48 | const dictionary& dict, | const dictionary& dict, |
49 | 49 | const fvMesh& mesh, | const fvMesh& mesh, |
50 | 50 | const labelListList& momentOrders, | const labelListList& momentOrders, |
51 | 51 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
52 | const labelList& velocityIndexes, | ||
52 | 53 | const label nSecondaryNodes | const label nSecondaryNodes |
53 | 54 | ) | ) |
54 | 55 | : | : |
... | ... | Foam::hyperbolicFieldMomentInversion::hyperbolicFieldMomentInversion | |
58 | 59 | mesh, | mesh, |
59 | 60 | momentOrders, | momentOrders, |
60 | 61 | nodeIndexes, | nodeIndexes, |
62 | velocityIndexes, | ||
61 | 63 | nSecondaryNodes | nSecondaryNodes |
62 | 64 | ), | ), |
63 | 65 | momentInverter_ | momentInverter_ |
64 | 66 | ( | ( |
65 | new hyperbolicConditionalMomentInversion | ||
67 | multivariateMomentInversion::New | ||
66 | 68 | ( | ( |
67 | dict.subDict("basicMomentInversion"), | ||
68 | momentOrders[0].size() | ||
69 | dict.subDict("basicVelocityMomentInversion"), | ||
70 | momentOrders, | ||
71 | nodeIndexes, | ||
72 | velocityIndexes | ||
69 | 73 | ) | ) |
70 | 74 | ) | ) |
71 | 75 | {} | {} |
... | ... | Foam::hyperbolicFieldMomentInversion::hyperbolicFieldMomentInversion | |
73 | 77 | ||
74 | 78 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
75 | 79 | ||
76 | Foam::hyperbolicFieldMomentInversion::~hyperbolicFieldMomentInversion() | ||
80 | Foam::basicVelocityFieldMomentInversion::~basicVelocityFieldMomentInversion() | ||
77 | 81 | {} | {} |
78 | 82 | ||
79 | 83 | ||
80 | 84 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
81 | 85 | ||
82 | void Foam::hyperbolicFieldMomentInversion::invert | ||
86 | void Foam::basicVelocityFieldMomentInversion::invert | ||
83 | 87 | ( | ( |
84 | const volUnivariateMomentFieldSet& moments, | ||
88 | const volScalarMomentFieldSet& moments, | ||
85 | 89 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
86 | 90 | ) | ) |
87 | 91 | { | { |
88 | 92 | NotImplemented; | NotImplemented; |
89 | 93 | } | } |
90 | 94 | ||
91 | void Foam::hyperbolicFieldMomentInversion::invertBoundaryMoments | ||
95 | void Foam::basicVelocityFieldMomentInversion::invertBoundaryMoments | ||
92 | 96 | ( | ( |
93 | const volUnivariateMomentFieldSet& moments, | ||
97 | const volScalarMomentFieldSet& moments, | ||
94 | 98 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
95 | 99 | ) | ) |
96 | 100 | { | { |
97 | 101 | NotImplemented; | NotImplemented; |
98 | 102 | } | } |
99 | 103 | ||
100 | bool Foam::hyperbolicFieldMomentInversion::invertLocalMoments | ||
104 | bool Foam::basicVelocityFieldMomentInversion::invertLocalMoments | ||
101 | 105 | ( | ( |
102 | const volUnivariateMomentFieldSet& moments, | ||
106 | const volScalarMomentFieldSet& moments, | ||
103 | 107 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
104 | 108 | const label celli, | const label celli, |
105 | 109 | const bool fatalErrorOnFailedRealizabilityTest | const bool fatalErrorOnFailedRealizabilityTest |
... | ... | bool Foam::hyperbolicFieldMomentInversion::invertLocalMoments | |
110 | 114 | return true; | return true; |
111 | 115 | } | } |
112 | 116 | ||
113 | void Foam::hyperbolicFieldMomentInversion::invert | ||
117 | void Foam::basicVelocityFieldMomentInversion::invert | ||
114 | 118 | ( | ( |
115 | const volVectorMomentFieldSet& moments, | ||
116 | mappedPtrList<volVectorNode>& nodes | ||
119 | const volVelocityMomentFieldSet& moments, | ||
120 | mappedPtrList<volVelocityNode>& nodes | ||
117 | 121 | ) | ) |
118 | 122 | { | { |
119 | const volVectorMoment& m0(moments[0]); | ||
123 | const volScalarField& m0(moments(0)); | ||
120 | 124 | ||
121 | 125 | forAll(m0, celli) | forAll(m0, celli) |
122 | 126 | { | { |
... | ... | void Foam::hyperbolicFieldMomentInversion::invert | |
126 | 130 | invertBoundaryMoments(moments, nodes); | invertBoundaryMoments(moments, nodes); |
127 | 131 | } | } |
128 | 132 | ||
129 | void Foam::hyperbolicFieldMomentInversion::invertBoundaryMoments | ||
133 | void Foam::basicVelocityFieldMomentInversion::invertBoundaryMoments | ||
130 | 134 | ( | ( |
131 | const volVectorMomentFieldSet& moments, | ||
132 | mappedPtrList<volVectorNode>& nodes | ||
135 | const volVelocityMomentFieldSet& moments, | ||
136 | mappedPtrList<volVelocityNode>& nodes | ||
133 | 137 | ) | ) |
134 | 138 | { | { |
135 | 139 | // Recover reference to boundaryField of zero-order moment. | // Recover reference to boundaryField of zero-order moment. |
... | ... | void Foam::hyperbolicFieldMomentInversion::invertBoundaryMoments | |
152 | 156 | forAll(momentsToInvert, momenti) | forAll(momentsToInvert, momenti) |
153 | 157 | { | { |
154 | 158 | const labelList& momentOrder = momentOrders_[momenti]; | const labelList& momentOrder = momentOrders_[momenti]; |
159 | |||
155 | 160 | momentsToInvert(momentOrder) | momentsToInvert(momentOrder) |
156 | 161 | = moments(momentOrder).boundaryField()[patchi][facei]; | = moments(momentOrder).boundaryField()[patchi][facei]; |
157 | 162 | } | } |
... | ... | void Foam::hyperbolicFieldMomentInversion::invertBoundaryMoments | |
160 | 165 | momentInverter_().invert(momentsToInvert); | momentInverter_().invert(momentsToInvert); |
161 | 166 | ||
162 | 167 | const mappedList<scalar>& weights(momentInverter_->weights()); | const mappedList<scalar>& weights(momentInverter_->weights()); |
163 | const mappedList<vector>& abscissae(momentInverter_->abscissae()); | ||
168 | |||
169 | const mappedList<scalarList>& abscissae | ||
170 | ( | ||
171 | momentInverter_->abscissae() | ||
172 | ); | ||
173 | |||
174 | const mappedList<vector>& velocityAbscissae | ||
175 | ( | ||
176 | momentInverter_->velocityAbscissae() | ||
177 | ); | ||
164 | 178 | ||
165 | 179 | // Copy quadrature data to boundary face | // Copy quadrature data to boundary face |
166 | 180 | forAll(weights, nodei) | forAll(weights, nodei) |
167 | 181 | { | { |
168 | 182 | const labelList& nodeIndex = nodeIndexes_[nodei]; | const labelList& nodeIndex = nodeIndexes_[nodei]; |
169 | volVectorNode& node = nodes[nodei]; | ||
183 | volVelocityNode& node = nodes[nodei]; | ||
170 | 184 | ||
171 | volScalarField::Boundary& weightBf | ||
172 | = node.primaryWeight().boundaryFieldRef(); | ||
185 | volScalarField::Boundary& weightBf = | ||
186 | node.primaryWeight().boundaryFieldRef(); | ||
173 | 187 | ||
174 | volVectorField::Boundary& abscissaBf | ||
175 | = node.primaryAbscissa().boundaryFieldRef(); | ||
188 | volVectorField::Boundary& velocityAbscissaBf = | ||
189 | node.velocityAbscissae().boundaryFieldRef(); | ||
176 | 190 | ||
177 | 191 | weightBf[patchi][facei] = weights(nodeIndex); | weightBf[patchi][facei] = weights(nodeIndex); |
178 | abscissaBf[patchi][facei] = abscissae(nodeIndex); | ||
192 | |||
193 | velocityAbscissaBf[patchi][facei] = | ||
194 | velocityAbscissae(nodeIndex); | ||
195 | |||
196 | forAll(node.scalarIndexes(), cmpt) | ||
197 | { | ||
198 | volScalarField::Boundary& abscissaBf = | ||
199 | node.primaryAbscissae()[cmpt].boundaryFieldRef(); | ||
200 | |||
201 | abscissaBf[patchi][facei] = abscissae(nodeIndex)[cmpt]; | ||
202 | } | ||
179 | 203 | } | } |
180 | 204 | } | } |
181 | 205 | } | } |
182 | 206 | } | } |
183 | 207 | ||
184 | bool Foam::hyperbolicFieldMomentInversion::invertLocalMoments | ||
208 | bool Foam::basicVelocityFieldMomentInversion::invertLocalMoments | ||
185 | 209 | ( | ( |
186 | const volVectorMomentFieldSet& moments, | ||
187 | mappedPtrList<volVectorNode>& nodes, | ||
210 | const volVelocityMomentFieldSet& moments, | ||
211 | mappedPtrList<volVelocityNode>& nodes, | ||
188 | 212 | const label celli, | const label celli, |
189 | 213 | const bool fatalErrorOnFailedRealizabilityTest | const bool fatalErrorOnFailedRealizabilityTest |
190 | 214 | ) | ) |
... | ... | bool Foam::hyperbolicFieldMomentInversion::invertLocalMoments | |
203 | 227 | momentsToInvert(momentOrder) = moments(momentOrder)[celli]; | momentsToInvert(momentOrder) = moments(momentOrder)[celli]; |
204 | 228 | } | } |
205 | 229 | ||
206 | // if (!fatalErrorOnFailedRealizabilityTest) | ||
207 | // { | ||
208 | // if (!momentsToInvert.isRealizable(fatalErrorOnFailedRealizabilityTest)) | ||
209 | // { | ||
210 | // return false; | ||
211 | // } | ||
212 | // } | ||
213 | |||
214 | // Find quadrature | ||
215 | momentInverter_().invert(momentsToInvert); | ||
230 | if (!momentInverter_().invert(momentsToInvert)) | ||
231 | { | ||
232 | return false; | ||
233 | } | ||
216 | 234 | ||
217 | 235 | // Recovering quadrature | // Recovering quadrature |
218 | const mappedList<scalar>& weights(momentInverter_().weights()); | ||
219 | const mappedList<vector>& abscissae(momentInverter_().abscissae()); | ||
236 | const mappedScalarList& weights(momentInverter_().weights()); | ||
237 | const mappedList<scalarList>& abscissae(momentInverter_().abscissae()); | ||
238 | const mappedVectorList& velocityAbscissae | ||
239 | ( | ||
240 | momentInverter_().velocityAbscissae() | ||
241 | ); | ||
220 | 242 | ||
221 | forAll(weights, nodei) | ||
243 | forAll(nodes, nodei) | ||
222 | 244 | { | { |
223 | 245 | const labelList& nodeIndex = nodeIndexes_[nodei]; | const labelList& nodeIndex = nodeIndexes_[nodei]; |
224 | volVectorNode& node(nodes[nodei]); | ||
246 | volVelocityNode& node(nodes[nodei]); | ||
225 | 247 | ||
226 | 248 | node.primaryWeight()[celli] = weights(nodeIndex); | node.primaryWeight()[celli] = weights(nodeIndex); |
227 | node.primaryAbscissa()[celli] = abscissae(nodeIndex); | ||
249 | node.velocityAbscissae()[celli] = velocityAbscissae(nodeIndex); | ||
250 | |||
251 | forAll(node.scalarIndexes(), cmpt) | ||
252 | { | ||
253 | node.primaryAbscissae()[cmpt][celli] = abscissae(nodeIndex)[cmpt]; | ||
254 | } | ||
228 | 255 | } | } |
229 | 256 | ||
230 | 257 | return true; | return true; |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/basicVelocityFieldMomentInversion/basicVelocityFieldMomentInversion.H renamed from multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/hyperbolicFieldMomentInversion/hyperbolicFieldMomentInversion.H (similarity 71%) (mode: 100755) (index 52f39c0..18d8f7a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::hyperbolicFieldMomentInversion | ||
25 | Foam::basicVelocityFieldMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Invert volVectorMomentFieldSet using basic hyperbolic conditional | Invert volVectorMomentFieldSet using basic hyperbolic conditional |
29 | 29 | moment inversion. | moment inversion. |
30 | 30 | ||
31 | 31 | SourceFiles | SourceFiles |
32 | hyperbolicFieldMomentInversion.C | ||
32 | basicVelocityFieldMomentInversion.C | ||
33 | 33 | ||
34 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
35 | 35 | ||
36 | #ifndef hyperbolicFieldMomentInversion_H | ||
37 | #define hyperbolicFieldMomentInversion_H | ||
36 | #ifndef basicVelocityFieldMomentInversion_H | ||
37 | #define basicVelocityFieldMomentInversion_H | ||
38 | 38 | ||
39 | 39 | #include "fieldMomentInversion.H" | #include "fieldMomentInversion.H" |
40 | 40 | #include "multivariateMomentSet.H" | #include "multivariateMomentSet.H" |
41 | #include "hyperbolicConditionalMomentInversion.H" | ||
41 | #include "multivariateMomentInversion.H" | ||
42 | 42 | ||
43 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 44 | ||
... | ... | namespace Foam | |
46 | 46 | { | { |
47 | 47 | ||
48 | 48 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
49 | Class hyperbolicFieldMomentInversion Declaration | ||
49 | Class basicVelocityFieldMomentInversion Declaration | ||
50 | 50 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
51 | 51 | ||
52 | class hyperbolicFieldMomentInversion | ||
52 | class basicVelocityFieldMomentInversion | ||
53 | 53 | : | : |
54 | 54 | public fieldMomentInversion | public fieldMomentInversion |
55 | 55 | { | { |
56 | 56 | // Private Member Functions | // Private Member Functions |
57 | 57 | ||
58 | 58 | //- Moment inverter | //- Moment inverter |
59 | autoPtr<hyperbolicConditionalMomentInversion> momentInverter_; | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | hyperbolicFieldMomentInversion(const hyperbolicFieldMomentInversion&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const hyperbolicFieldMomentInversion&); | ||
59 | autoPtr<multivariateMomentInversion> momentInverter_; | ||
66 | 60 | ||
67 | 61 | ||
68 | 62 | public: | public: |
69 | 63 | ||
70 | 64 | //- Runtime type information | //- Runtime type information |
71 | TypeName("hyperbolicFieldMomentInversion"); | ||
65 | TypeName("basicVelocityFieldMomentInversion"); | ||
72 | 66 | ||
73 | 67 | ||
74 | 68 | // Constructors | // Constructors |
75 | 69 | ||
76 | 70 | //- Construct from dictionary | //- Construct from dictionary |
77 | hyperbolicFieldMomentInversion | ||
71 | basicVelocityFieldMomentInversion | ||
78 | 72 | ( | ( |
79 | 73 | const dictionary& dict, | const dictionary& dict, |
80 | 74 | const fvMesh& mesh, | const fvMesh& mesh, |
81 | 75 | const labelListList& momentOrders, | const labelListList& momentOrders, |
82 | 76 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
77 | const labelList& velocityIndexes, | ||
83 | 78 | const label nSecondaryNodes | const label nSecondaryNodes |
84 | 79 | ); | ); |
85 | 80 | ||
86 | 81 | ||
82 | //- Disallow default bitwise copy construct | ||
83 | basicVelocityFieldMomentInversion | ||
84 | ( | ||
85 | const basicVelocityFieldMomentInversion& | ||
86 | ) = delete; | ||
87 | |||
88 | |||
87 | 89 | //- Destructor | //- Destructor |
88 | ~hyperbolicFieldMomentInversion(); | ||
90 | ~basicVelocityFieldMomentInversion(); | ||
89 | 91 | ||
90 | 92 | ||
91 | 93 | // Public member Functions | // Public member Functions |
92 | 94 | ||
93 | // Univariate moment inversions | ||
95 | // Scalar moment inversions | ||
94 | 96 | ||
95 | 97 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
96 | 98 | virtual void invert | virtual void invert |
97 | 99 | ( | ( |
98 | const volUnivariateMomentFieldSet& moments, | ||
100 | const volScalarMomentFieldSet& moments, | ||
99 | 101 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
100 | 102 | ); | ); |
101 | 103 | ||
102 | 104 | //- Invert moments on boundaries | //- Invert moments on boundaries |
103 | 105 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
104 | 106 | ( | ( |
105 | const volUnivariateMomentFieldSet& moments, | ||
107 | const volScalarMomentFieldSet& moments, | ||
106 | 108 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
107 | 109 | ); | ); |
108 | 110 | ||
109 | 111 | //- Invert moments in a single cell | //- Invert moments in a single cell |
110 | 112 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
111 | 113 | ( | ( |
112 | const volUnivariateMomentFieldSet& moments, | ||
114 | const volScalarMomentFieldSet& moments, | ||
113 | 115 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
114 | 116 | const label celli, | const label celli, |
115 | 117 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
116 | 118 | ); | ); |
117 | 119 | ||
118 | 120 | ||
119 | // Multivriate moment inversions | ||
121 | // Velocity moment inversions | ||
120 | 122 | ||
121 | 123 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
122 | 124 | virtual void invert | virtual void invert |
123 | 125 | ( | ( |
124 | const volVectorMomentFieldSet& moments, | ||
125 | mappedPtrList<volVectorNode>& nodes | ||
126 | const volVelocityMomentFieldSet& moments, | ||
127 | mappedPtrList<volVelocityNode>& nodes | ||
126 | 128 | ); | ); |
127 | 129 | ||
128 | 130 | //- Invert moments on boundaries | //- Invert moments on boundaries |
129 | 131 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
130 | 132 | ( | ( |
131 | const volVectorMomentFieldSet& moments, | ||
132 | mappedPtrList<volVectorNode>& nodes | ||
133 | const volVelocityMomentFieldSet& moments, | ||
134 | mappedPtrList<volVelocityNode>& nodes | ||
133 | 135 | ); | ); |
134 | 136 | ||
135 | 137 | //- Invert moments in a single cell | //- Invert moments in a single cell |
136 | 138 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
137 | 139 | ( | ( |
138 | const volVectorMomentFieldSet& moments, | ||
139 | mappedPtrList<volVectorNode>& nodes, | ||
140 | const volVelocityMomentFieldSet& moments, | ||
141 | mappedPtrList<volVelocityNode>& nodes, | ||
140 | 142 | const label celli, | const label celli, |
141 | 143 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
142 | 144 | ); | ); |
145 | |||
146 | // Member Operators | ||
147 | |||
148 | //- Disallow default bitwise assignment | ||
149 | void operator=(const basicVelocityFieldMomentInversion&) = delete; | ||
143 | 150 | }; | }; |
144 | 151 | ||
145 | 152 |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/extendedFieldMomentInversion/extendedFieldMomentInversion.C changed (mode: 100755) (index 6f55566..221017a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::extendedFieldMomentInversion::extendedFieldMomentInversion | |
48 | 48 | const fvMesh& mesh, | const fvMesh& mesh, |
49 | 49 | const labelListList& momentOrders, | const labelListList& momentOrders, |
50 | 50 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
51 | const labelList& velocityIndexes, | ||
51 | 52 | const label nSecondaryNodes | const label nSecondaryNodes |
52 | 53 | ) | ) |
53 | 54 | : | : |
... | ... | Foam::extendedFieldMomentInversion::extendedFieldMomentInversion | |
57 | 58 | mesh, | mesh, |
58 | 59 | momentOrders, | momentOrders, |
59 | 60 | nodeIndexes, | nodeIndexes, |
61 | velocityIndexes, | ||
60 | 62 | nSecondaryNodes | nSecondaryNodes |
61 | 63 | ), | ), |
62 | 64 | momentInverter_ | momentInverter_ |
... | ... | Foam::extendedFieldMomentInversion::~extendedFieldMomentInversion() | |
83 | 85 | ||
84 | 86 | void Foam::extendedFieldMomentInversion::invert | void Foam::extendedFieldMomentInversion::invert |
85 | 87 | ( | ( |
86 | const volUnivariateMomentFieldSet& moments, | ||
88 | const volScalarMomentFieldSet& moments, | ||
87 | 89 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
88 | 90 | ) | ) |
89 | 91 | { | { |
90 | const volScalarField& m0(moments[0]); | ||
92 | const volScalarField& m0(moments(0)); | ||
91 | 93 | ||
92 | 94 | forAll(m0, celli) | forAll(m0, celli) |
93 | 95 | { | { |
... | ... | void Foam::extendedFieldMomentInversion::invert | |
99 | 101 | ||
100 | 102 | void Foam::extendedFieldMomentInversion::invertBoundaryMoments | void Foam::extendedFieldMomentInversion::invertBoundaryMoments |
101 | 103 | ( | ( |
102 | const volUnivariateMomentFieldSet& moments, | ||
104 | const volScalarMomentFieldSet& moments, | ||
103 | 105 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
104 | 106 | ) | ) |
105 | 107 | { | { |
... | ... | void Foam::extendedFieldMomentInversion::invertBoundaryMoments | |
129 | 131 | // Inverting moments for EQMOM | // Inverting moments for EQMOM |
130 | 132 | momentInverter_->invert(momentsToInvert); | momentInverter_->invert(momentsToInvert); |
131 | 133 | ||
134 | // Recovering primary weights and abscissae from moment inverter | ||
135 | const scalarList& pWeights(momentInverter_().primaryWeights()); | ||
136 | |||
137 | const scalarList& pAbscissae | ||
138 | ( | ||
139 | momentInverter_().primaryAbscissae() | ||
140 | ); | ||
141 | |||
132 | 142 | // Copying quadrature data to boundary face | // Copying quadrature data to boundary face |
133 | for (label pNodei = 0; pNodei < nodes.size(); pNodei++) | ||
143 | for (label pNodei = 0; pNodei < pWeights.size(); pNodei++) | ||
134 | 144 | { | { |
135 | 145 | volScalarNode& node = nodes[pNodei]; | volScalarNode& node = nodes[pNodei]; |
136 | 146 | ||
137 | 147 | node.primaryWeight().boundaryFieldRef()[patchi][facei] | node.primaryWeight().boundaryFieldRef()[patchi][facei] |
138 | = momentInverter_->primaryWeights()[pNodei]; | ||
148 | = pWeights[pNodei]; | ||
139 | 149 | ||
140 | node.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
141 | = momentInverter_->primaryAbscissae()[pNodei]; | ||
150 | node.primaryAbscissae()[0].boundaryFieldRef()[patchi][facei] | ||
151 | = pAbscissae[pNodei]; | ||
142 | 152 | ||
143 | node.sigma().boundaryFieldRef()[patchi][facei] | ||
153 | node.sigmas()[0].boundaryFieldRef()[patchi][facei] | ||
144 | 154 | = momentInverter_->sigma(); | = momentInverter_->sigma(); |
145 | 155 | ||
146 | 156 | for | for |
... | ... | void Foam::extendedFieldMomentInversion::invertBoundaryMoments | |
150 | 160 | sNodei++ | sNodei++ |
151 | 161 | ) | ) |
152 | 162 | { | { |
153 | node.secondaryWeights()[sNodei].boundaryFieldRef()[patchi][facei] | ||
163 | node.secondaryWeights()[0][sNodei].boundaryFieldRef()[patchi][facei] | ||
154 | 164 | = momentInverter_().secondaryWeights()[pNodei][sNodei]; | = momentInverter_().secondaryWeights()[pNodei][sNodei]; |
155 | 165 | ||
156 | node.secondaryAbscissae()[sNodei].boundaryFieldRef()[patchi][facei] | ||
166 | node.secondaryAbscissae()[0][sNodei].boundaryFieldRef()[patchi][facei] | ||
157 | 167 | = momentInverter_().secondaryAbscissae()[pNodei][sNodei]; | = momentInverter_().secondaryAbscissae()[pNodei][sNodei]; |
158 | 168 | } | } |
159 | 169 | } | } |
170 | for | ||
171 | ( | ||
172 | label pNodei = pWeights.size(); | ||
173 | pNodei < nodes.size(); | ||
174 | pNodei++ | ||
175 | ) | ||
176 | { | ||
177 | volScalarNode& node = nodes[pNodei]; | ||
178 | |||
179 | node.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
180 | = 0.0; | ||
181 | node.primaryAbscissae()[0].boundaryFieldRef()[patchi][facei] | ||
182 | = 0.0; | ||
183 | |||
184 | node.sigmas()[0].boundaryFieldRef()[patchi][facei] | ||
185 | = 0.0; | ||
186 | |||
187 | for | ||
188 | ( | ||
189 | label sNodei = 0; | ||
190 | sNodei < node.nSecondaryNodes(); | ||
191 | sNodei++ | ||
192 | ) | ||
193 | { | ||
194 | node.secondaryWeights()[0][sNodei].boundaryFieldRef()[patchi][facei] | ||
195 | = 0.0; | ||
196 | |||
197 | node.secondaryAbscissae()[0][sNodei].boundaryFieldRef()[patchi][facei] | ||
198 | = 0.0; | ||
199 | } | ||
200 | } | ||
160 | 201 | } | } |
161 | 202 | } | } |
162 | 203 | } | } |
163 | 204 | ||
164 | 205 | bool Foam::extendedFieldMomentInversion::invertLocalMoments | bool Foam::extendedFieldMomentInversion::invertLocalMoments |
165 | 206 | ( | ( |
166 | const volUnivariateMomentFieldSet& moments, | ||
207 | const volScalarMomentFieldSet& moments, | ||
167 | 208 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
168 | 209 | const label celli, | const label celli, |
169 | 210 | const bool fatalErrorOnFailedRealizabilityTest | const bool fatalErrorOnFailedRealizabilityTest |
... | ... | bool Foam::extendedFieldMomentInversion::invertLocalMoments | |
201 | 242 | ); | ); |
202 | 243 | ||
203 | 244 | // Copying EQMOM quadrature to fields | // Copying EQMOM quadrature to fields |
204 | for (label pNodei = 0; pNodei < nodes.size(); pNodei++) | ||
245 | for (label pNodei = 0; pNodei < pWeights.size(); pNodei++) | ||
205 | 246 | { | { |
206 | 247 | volScalarNode& node(nodes[pNodei]); | volScalarNode& node(nodes[pNodei]); |
207 | 248 | ||
208 | 249 | // Copy primary node | // Copy primary node |
209 | 250 | node.primaryWeight()[celli] = pWeights[pNodei]; | node.primaryWeight()[celli] = pWeights[pNodei]; |
210 | node.primaryAbscissa()[celli] = pAbscissae[pNodei]; | ||
251 | node.primaryAbscissae()[0][celli] = pAbscissae[pNodei]; | ||
211 | 252 | ||
212 | 253 | // Copy secondary nodes | // Copy secondary nodes |
213 | PtrList<volScalarField>& sWeightFields(node.secondaryWeights()); | ||
214 | PtrList<volScalarField>& sAbscissaFields(node.secondaryAbscissae()); | ||
254 | PtrList<volScalarField>& sWeightFields(node.secondaryWeights()[0]); | ||
255 | PtrList<volScalarField>& sAbscissaFields(node.secondaryAbscissae()[0]); | ||
215 | 256 | ||
216 | 257 | const scalarRectangularMatrix& sWeights | const scalarRectangularMatrix& sWeights |
217 | 258 | ( | ( |
... | ... | bool Foam::extendedFieldMomentInversion::invertLocalMoments | |
235 | 276 | } | } |
236 | 277 | ||
237 | 278 | // Copy sigma | // Copy sigma |
238 | node.sigma()[celli] = momentInverter_().sigma(); | ||
279 | node.sigmas()[0][celli] = momentInverter_().sigma(); | ||
239 | 280 | } | } |
240 | 281 | ||
241 | 282 | return true; | return true; |
... | ... | bool Foam::extendedFieldMomentInversion::invertLocalMoments | |
243 | 284 | ||
244 | 285 | void Foam::extendedFieldMomentInversion::invert | void Foam::extendedFieldMomentInversion::invert |
245 | 286 | ( | ( |
246 | const volVectorMomentFieldSet& moments, | ||
247 | mappedPtrList<volVectorNode>& nodes | ||
287 | const volVelocityMomentFieldSet& moments, | ||
288 | mappedPtrList<volVelocityNode>& nodes | ||
248 | 289 | ) | ) |
249 | 290 | { | { |
250 | 291 | NotImplemented; | NotImplemented; |
... | ... | void Foam::extendedFieldMomentInversion::invert | |
252 | 293 | ||
253 | 294 | void Foam::extendedFieldMomentInversion::invertBoundaryMoments | void Foam::extendedFieldMomentInversion::invertBoundaryMoments |
254 | 295 | ( | ( |
255 | const volVectorMomentFieldSet& moments, | ||
256 | mappedPtrList<volVectorNode>& nodes | ||
296 | const volVelocityMomentFieldSet& moments, | ||
297 | mappedPtrList<volVelocityNode>& nodes | ||
257 | 298 | ) | ) |
258 | 299 | { | { |
259 | 300 | NotImplemented; | NotImplemented; |
... | ... | void Foam::extendedFieldMomentInversion::invertBoundaryMoments | |
261 | 302 | ||
262 | 303 | bool Foam::extendedFieldMomentInversion::invertLocalMoments | bool Foam::extendedFieldMomentInversion::invertLocalMoments |
263 | 304 | ( | ( |
264 | const volVectorMomentFieldSet& moments, | ||
265 | mappedPtrList<volVectorNode>& nodes, | ||
305 | const volVelocityMomentFieldSet& moments, | ||
306 | mappedPtrList<volVelocityNode>& nodes, | ||
266 | 307 | const label celli, | const label celli, |
267 | 308 | const bool fatalErrorOnFailedRealizabilityTest | const bool fatalErrorOnFailedRealizabilityTest |
268 | 309 | ) | ) |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/extendedFieldMomentInversion/extendedFieldMomentInversion.H changed (mode: 100755) (index 8061b30..2679c69) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class extendedFieldMomentInversion | |
58 | 58 | //- Moment inverter | //- Moment inverter |
59 | 59 | autoPtr<extendedMomentInversion> momentInverter_; | autoPtr<extendedMomentInversion> momentInverter_; |
60 | 60 | ||
61 | //- Disallow default bitwise copy construct | ||
62 | extendedFieldMomentInversion(const extendedFieldMomentInversion&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const extendedFieldMomentInversion&); | ||
66 | |||
67 | 61 | ||
68 | 62 | public: | public: |
69 | 63 | ||
... | ... | public: | |
80 | 74 | const fvMesh& mesh, | const fvMesh& mesh, |
81 | 75 | const labelListList& momentOrders, | const labelListList& momentOrders, |
82 | 76 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
77 | const labelList& velocityIndexes, | ||
83 | 78 | const label nSecondaryNodes | const label nSecondaryNodes |
84 | 79 | ); | ); |
85 | 80 | ||
81 | //- Disallow default bitwise copy construct | ||
82 | extendedFieldMomentInversion | ||
83 | ( | ||
84 | const extendedFieldMomentInversion& | ||
85 | ) = delete; | ||
86 | |||
86 | 87 | ||
87 | 88 | //- Destructor | //- Destructor |
88 | 89 | ~extendedFieldMomentInversion(); | ~extendedFieldMomentInversion(); |
... | ... | public: | |
90 | 91 | ||
91 | 92 | // Public member Functions | // Public member Functions |
92 | 93 | ||
93 | // Univariate moment inversions | ||
94 | // Scalar moment inversions | ||
94 | 95 | ||
95 | 96 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
96 | 97 | virtual void invert | virtual void invert |
97 | 98 | ( | ( |
98 | const volUnivariateMomentFieldSet& moments, | ||
99 | const volScalarMomentFieldSet& moments, | ||
99 | 100 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
100 | 101 | ); | ); |
101 | 102 | ||
102 | 103 | //- Invert moments on boundaries | //- Invert moments on boundaries |
103 | 104 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
104 | 105 | ( | ( |
105 | const volUnivariateMomentFieldSet& moments, | ||
106 | const volScalarMomentFieldSet& moments, | ||
106 | 107 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
107 | 108 | ); | ); |
108 | 109 | ||
109 | 110 | //- Invert moments in a single cell | //- Invert moments in a single cell |
110 | 111 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
111 | 112 | ( | ( |
112 | const volUnivariateMomentFieldSet& moments, | ||
113 | const volScalarMomentFieldSet& moments, | ||
113 | 114 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
114 | 115 | const label celli, | const label celli, |
115 | 116 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
116 | 117 | ); | ); |
117 | 118 | ||
118 | 119 | ||
119 | // Multivriate moment inversions | ||
120 | // Velocity moment inversions | ||
120 | 121 | ||
121 | 122 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
122 | 123 | virtual void invert | virtual void invert |
123 | 124 | ( | ( |
124 | const volVectorMomentFieldSet& moments, | ||
125 | mappedPtrList<volVectorNode>& nodes | ||
125 | const volVelocityMomentFieldSet& moments, | ||
126 | mappedPtrList<volVelocityNode>& nodes | ||
126 | 127 | ); | ); |
127 | 128 | ||
128 | 129 | //- Invert moments on boundaries | //- Invert moments on boundaries |
129 | 130 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
130 | 131 | ( | ( |
131 | const volVectorMomentFieldSet& moments, | ||
132 | mappedPtrList<volVectorNode>& nodes | ||
132 | const volVelocityMomentFieldSet& moments, | ||
133 | mappedPtrList<volVelocityNode>& nodes | ||
133 | 134 | ); | ); |
134 | 135 | ||
135 | 136 | //- Invert moments in a single cell | //- Invert moments in a single cell |
136 | 137 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
137 | 138 | ( | ( |
138 | const volVectorMomentFieldSet& moments, | ||
139 | mappedPtrList<volVectorNode>& nodes, | ||
139 | const volVelocityMomentFieldSet& moments, | ||
140 | mappedPtrList<volVelocityNode>& nodes, | ||
140 | 141 | const label celli, | const label celli, |
141 | 142 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
142 | 143 | ); | ); |
144 | |||
145 | // Member Operators | ||
146 | |||
147 | //- Disallow default bitwise assignment | ||
148 | void operator=(const extendedFieldMomentInversion&) = delete; | ||
143 | 149 | }; | }; |
144 | 150 | ||
145 | 151 |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/fieldMomentInversion.C changed (mode: 100644) (index bc8d256..73cf64f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::fieldMomentInversion::fieldMomentInversion | |
42 | 42 | const fvMesh& mesh, | const fvMesh& mesh, |
43 | 43 | const labelListList& momentOrders, | const labelListList& momentOrders, |
44 | 44 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
45 | const labelList& velocityIndexes, | ||
45 | 46 | const label nSecondaryNodes | const label nSecondaryNodes |
46 | 47 | ) | ) |
47 | 48 | : | : |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/fieldMomentInversion.H changed (mode: 100644) (index 16bcb52..520dc5d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace Foam | |
52 | 52 | ||
53 | 53 | class fieldMomentInversion | class fieldMomentInversion |
54 | 54 | { | { |
55 | // Private member functions | ||
56 | |||
57 | //- Disallow default bitwise copy construct | ||
58 | fieldMomentInversion(const fieldMomentInversion&); | ||
59 | |||
60 | //- Disallow default bitwise assignment | ||
61 | void operator=(const fieldMomentInversion&); | ||
62 | |||
63 | |||
64 | 55 | protected: | protected: |
65 | 56 | ||
66 | 57 | // Protected data | // Protected data |
... | ... | public: | |
96 | 87 | const fvMesh& mesh, | const fvMesh& mesh, |
97 | 88 | const labelListList& momentOrders, | const labelListList& momentOrders, |
98 | 89 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
90 | const labelList& velocityIndexes, | ||
99 | 91 | const label nSecondaryNodes | const label nSecondaryNodes |
100 | 92 | ), | ), |
101 | (dict, mesh, momentOrders, nodeIndexes, nSecondaryNodes) | ||
93 | ( | ||
94 | dict, | ||
95 | mesh, | ||
96 | momentOrders, | ||
97 | nodeIndexes, | ||
98 | velocityIndexes, | ||
99 | nSecondaryNodes | ||
100 | ) | ||
102 | 101 | ); | ); |
103 | 102 | ||
104 | 103 | ||
... | ... | public: | |
111 | 110 | const fvMesh& mesh, | const fvMesh& mesh, |
112 | 111 | const labelListList& momentOrders, | const labelListList& momentOrders, |
113 | 112 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
113 | const labelList& velocityIndexes, | ||
114 | 114 | const label nSecondaryNodes | const label nSecondaryNodes |
115 | 115 | ); | ); |
116 | 116 | ||
117 | //- Disallow default bitwise copy construct | ||
118 | fieldMomentInversion(const fieldMomentInversion&) = delete; | ||
119 | |||
117 | 120 | ||
118 | 121 | //- Destructor | //- Destructor |
119 | 122 | virtual ~fieldMomentInversion(); | virtual ~fieldMomentInversion(); |
... | ... | public: | |
127 | 130 | const fvMesh& mesh, | const fvMesh& mesh, |
128 | 131 | const labelListList& momentOrders, | const labelListList& momentOrders, |
129 | 132 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
133 | const labelList& velocityIndexes, | ||
130 | 134 | const label nSecondaryNodes | const label nSecondaryNodes |
131 | 135 | ); | ); |
132 | 136 | ||
133 | 137 | ||
134 | // Member Functions | ||
138 | // Public member Functions | ||
135 | 139 | ||
136 | // Univariate moment inversions | ||
140 | // Scalar moment inversions | ||
137 | 141 | ||
138 | 142 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
139 | 143 | virtual void invert | virtual void invert |
140 | 144 | ( | ( |
141 | const volUnivariateMomentFieldSet& moments, | ||
145 | const volScalarMomentFieldSet& moments, | ||
142 | 146 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
143 | 147 | ) = 0; | ) = 0; |
144 | 148 | ||
145 | 149 | //- Invert moments on boundaries | //- Invert moments on boundaries |
146 | 150 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
147 | 151 | ( | ( |
148 | const volUnivariateMomentFieldSet& moments, | ||
152 | const volScalarMomentFieldSet& moments, | ||
149 | 153 | mappedPtrList<volScalarNode>& nodes | mappedPtrList<volScalarNode>& nodes |
150 | 154 | ) = 0; | ) = 0; |
151 | 155 | ||
152 | 156 | //- Invert moments in a single cell | //- Invert moments in a single cell |
153 | 157 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
154 | 158 | ( | ( |
155 | const volUnivariateMomentFieldSet& moments, | ||
159 | const volScalarMomentFieldSet& moments, | ||
156 | 160 | mappedPtrList<volScalarNode>& nodes, | mappedPtrList<volScalarNode>& nodes, |
157 | 161 | const label celli, | const label celli, |
158 | 162 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
159 | 163 | ) = 0; | ) = 0; |
160 | 164 | ||
161 | 165 | ||
162 | // Multivriate moment inversions | ||
166 | // Velocity moment inversions | ||
163 | 167 | ||
164 | 168 | //- Invert moments in the entire computational domain | //- Invert moments in the entire computational domain |
165 | 169 | virtual void invert | virtual void invert |
166 | 170 | ( | ( |
167 | const volVectorMomentFieldSet& moments, | ||
168 | mappedPtrList<volVectorNode>& nodes | ||
171 | const volVelocityMomentFieldSet& moments, | ||
172 | mappedPtrList<volVelocityNode>& nodes | ||
169 | 173 | ) = 0; | ) = 0; |
170 | 174 | ||
171 | 175 | //- Invert moments on boundaries | //- Invert moments on boundaries |
172 | 176 | virtual void invertBoundaryMoments | virtual void invertBoundaryMoments |
173 | 177 | ( | ( |
174 | const volVectorMomentFieldSet& moments, | ||
175 | mappedPtrList<volVectorNode>& nodes | ||
178 | const volVelocityMomentFieldSet& moments, | ||
179 | mappedPtrList<volVelocityNode>& nodes | ||
176 | 180 | ) = 0; | ) = 0; |
177 | 181 | ||
178 | 182 | //- Invert moments in a single cell | //- Invert moments in a single cell |
179 | 183 | virtual bool invertLocalMoments | virtual bool invertLocalMoments |
180 | 184 | ( | ( |
181 | const volVectorMomentFieldSet& moments, | ||
182 | mappedPtrList<volVectorNode>& nodes, | ||
185 | const volVelocityMomentFieldSet& moments, | ||
186 | mappedPtrList<volVelocityNode>& nodes, | ||
183 | 187 | const label celli, | const label celli, |
184 | 188 | const bool fatalErrorOnFailedRealizabilityTest = true | const bool fatalErrorOnFailedRealizabilityTest = true |
185 | 189 | ) = 0; | ) = 0; |
186 | 190 | ||
187 | 191 | //- Return extended type | //- Return extended type |
188 | 192 | inline bool extended(); | inline bool extended(); |
193 | |||
194 | // Member Operators | ||
195 | |||
196 | //- Disallow default bitwise assignment | ||
197 | void operator=(const fieldMomentInversion&) = delete; | ||
189 | 198 | }; | }; |
190 | 199 | ||
191 | 200 |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/fieldMomentInversionI.H changed (mode: 100644) (index 80b6d52..971d805) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/newFieldMomentInversion.C changed (mode: 100644) (index 9d50818..fa57e93) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::autoPtr<Foam::fieldMomentInversion> Foam::fieldMomentInversion::New | |
33 | 33 | const fvMesh& mesh, | const fvMesh& mesh, |
34 | 34 | const labelListList& momentOrders, | const labelListList& momentOrders, |
35 | 35 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
36 | const labelList& velocityIndexes, | ||
36 | 37 | const label nSecondaryNodes | const label nSecondaryNodes |
37 | 38 | ) | ) |
38 | 39 | { | { |
... | ... | Foam::autoPtr<Foam::fieldMomentInversion> Foam::fieldMomentInversion::New | |
57 | 58 | << exit(FatalError); | << exit(FatalError); |
58 | 59 | } | } |
59 | 60 | ||
60 | return cstrIter()(dict, mesh, momentOrders, nodeIndexes, nSecondaryNodes); | ||
61 | return cstrIter() | ||
62 | ( | ||
63 | dict, | ||
64 | mesh, | ||
65 | momentOrders, | ||
66 | nodeIndexes, | ||
67 | velocityIndexes, | ||
68 | nSecondaryNodes | ||
69 | ); | ||
61 | 70 | } | } |
62 | 71 | ||
63 | 72 |
File multiphaseEulerPbeFoam/quadratureMethods/hermiteQuadrature/hermiteQuadrature.C changed (mode: 100644) (index f7844ca..424b95d) | |||
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | 5 | \\ / A nd | Copyright (C) 2010-2014 Bo Kong | \\ / A nd | Copyright (C) 2010-2014 Bo Kong |
6 | \\/ M anipulation | | ||
6 | \\/ M anipulation | Copyright (C) 2019 Alberto Passalacqua | ||
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
9 | 9 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
File multiphaseEulerPbeFoam/quadratureMethods/hermiteQuadrature/hermiteQuadrature.H changed (mode: 100644) (index a9e36cb..84e384a) | |||
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | 5 | \\ / A nd | Copyright (C) 2010-2014 Bo Kong | \\ / A nd | Copyright (C) 2010-2014 Bo Kong |
6 | \\/ M anipulation | | ||
6 | \\/ M anipulation | Copyright (C) 2019 Alberto Passalacqua | ||
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
9 | 9 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | class hermiteQuadrature | |
51 | 51 | { | { |
52 | 52 | // Private data | // Private data |
53 | 53 | ||
54 | static const scalar thetaLimit_; | ||
54 | static const scalar thetaLimit_; | ||
55 | 55 | ||
56 | //- Number of weights and abscissas | ||
57 | const label nDim_; | ||
56 | //- Number of weights and abscissas | ||
57 | const label nDim_; | ||
58 | 58 | ||
59 | const label nOrder_; | ||
59 | const label nOrder_; | ||
60 | 60 | ||
61 | const label nTolNodes_; | ||
61 | const label nTolNodes_; | ||
62 | 62 | ||
63 | scalarList origWei_; | ||
63 | scalarList origWei_; | ||
64 | 64 | ||
65 | vectorList origAbs_; | ||
65 | vectorList origAbs_; | ||
66 | 66 | ||
67 | vectorList resAbs_; | ||
67 | vectorList resAbs_; | ||
68 | 68 | ||
69 | scalar maxAbs_; | ||
69 | scalar maxAbs_; | ||
70 | 70 | ||
71 | //- Private member functions | ||
72 | 71 | ||
73 | //- Disallow default bitwise copy construct | ||
74 | hermiteQuadrature(const hermiteQuadrature&); | ||
72 | public: | ||
75 | 73 | ||
76 | //- Disallow default bitwise assignment | ||
77 | void operator=(const hermiteQuadrature&); | ||
74 | // Constructors | ||
78 | 75 | ||
76 | //- Construct from a scalarDiagonalMatrix | ||
77 | hermiteQuadrature | ||
78 | ( | ||
79 | const label& nDim, | ||
80 | const label& nOrder | ||
81 | ); | ||
79 | 82 | ||
80 | public: | ||
81 | 83 | ||
82 | // Constructors | ||
84 | void calcHermiteQuadrature | ||
85 | ( | ||
86 | const vector& mu, | ||
87 | const symmTensor& Pp | ||
88 | ); | ||
83 | 89 | ||
84 | //- Construct from a scalarDiagonalMatrix | ||
85 | hermiteQuadrature | ||
86 | ( | ||
87 | const label& nDim, | ||
88 | const label& nOrder | ||
89 | ); | ||
90 | //- Disallow default bitwise copy construct | ||
91 | hermiteQuadrature(const hermiteQuadrature&) = delete; | ||
90 | 92 | ||
93 | // Access Methods | ||
91 | 94 | ||
92 | void calcHermiteQuadrature | ||
93 | ( | ||
94 | const vector& mu, | ||
95 | const symmTensor& Pp | ||
96 | ) ; | ||
95 | //- Return eigenvalues | ||
96 | const scalarList& hermiteWeights() const | ||
97 | { | ||
98 | return origWei_; | ||
99 | } | ||
97 | 100 | ||
101 | //- Return eigenvectors | ||
102 | const vectorList& hermiteAbscissas() const | ||
103 | { | ||
104 | return resAbs_; | ||
105 | } | ||
98 | 106 | ||
99 | //- Return eigenvalues | ||
100 | const scalarList& hermiteWeights() const | ||
101 | { | ||
102 | return origWei_; | ||
103 | } | ||
107 | vectorList& hermiteAbscissas() | ||
108 | { | ||
109 | return resAbs_; | ||
110 | } | ||
104 | 111 | ||
105 | //- Return eigenvectors | ||
106 | const vectorList& hermiteAbscissas() const | ||
107 | { | ||
108 | return resAbs_; | ||
109 | } | ||
112 | const vectorList& hermiteOriginalAbscissas() const | ||
113 | { | ||
114 | return origAbs_; | ||
115 | } | ||
110 | 116 | ||
111 | vectorList& hermiteAbscissas() | ||
112 | { | ||
113 | return resAbs_; | ||
114 | } | ||
117 | const scalar& maxAbs() const | ||
118 | { | ||
119 | return maxAbs_; | ||
120 | } | ||
115 | 121 | ||
116 | const vectorList& hermiteOriginalAbscissas() const | ||
117 | { | ||
118 | return origAbs_; | ||
119 | } | ||
120 | 122 | ||
121 | const scalar& maxAbs() const | ||
122 | { | ||
123 | return maxAbs_; | ||
124 | } | ||
123 | // Member Operators | ||
125 | 124 | ||
125 | //- Disallow default bitwise assignment | ||
126 | void operator=(const hermiteQuadrature&) = delete; | ||
126 | 127 | }; | }; |
127 | 128 | ||
128 | 129 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/Make/options changed (mode: 100644) (index a6d650e..a16ece1) | |||
... | ... | EXE_INC = \ | |
12 | 12 | -I../../mappedList \ | -I../../mappedList \ |
13 | 13 | -I../../mappedPtrList\ | -I../../mappedPtrList\ |
14 | 14 | -I../momentSets/lnInclude \ | -I../momentSets/lnInclude \ |
15 | -I../quadratureNode \ | ||
15 | -I../quadratureNode/lnInclude \ | ||
16 | 16 | -I../moments \ | -I../moments \ |
17 | 17 | -I../momentInversion/lnInclude \ | -I../momentInversion/lnInclude \ |
18 | 18 | -I../fieldMomentInversion/lnInclude \ | -I../fieldMomentInversion/lnInclude \ |
... | ... | LIB_LIBS = \ | |
32 | 32 | -lmeshTools \ | -lmeshTools \ |
33 | 33 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
34 | 34 | -leigenSolver \ | -leigenSolver \ |
35 | -lquadratureNode \ | ||
35 | 36 | -lmomentSets \ | -lmomentSets \ |
36 | 37 | -lmomentInversion \ | -lmomentInversion \ |
37 | 38 | -lfieldMomentInversion \ | -lfieldMomentInversion \ |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.C changed (mode: 100644) (index 4040ec7..e9939f5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.H changed (mode: 100644) (index 22f0d66..e9bcb05) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class mixingModel | |
56 | 56 | //- Name of the mixingModel | //- Name of the mixingModel |
57 | 57 | const word name_; | const word name_; |
58 | 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 | 59 | protected: | protected: |
69 | 60 | ||
70 | 61 | // Protected data | // Protected data |
... | ... | public: | |
103 | 94 | const surfaceScalarField& phi | const surfaceScalarField& phi |
104 | 95 | ); | ); |
105 | 96 | ||
97 | //- Disallow default bitwise copy construct | ||
98 | mixingModel(const mixingModel&) = delete; | ||
99 | |||
106 | 100 | ||
107 | 101 | // Selectors | // Selectors |
108 | 102 | ||
... | ... | public: | |
127 | 121 | //- Solve mixing model | //- Solve mixing model |
128 | 122 | virtual void solve() = 0; | virtual void solve() = 0; |
129 | 123 | ||
124 | |||
125 | // Member Operators | ||
126 | |||
127 | //- Disallow default bitwise assignment | ||
128 | void operator=(const mixingModel&) = delete; | ||
130 | 129 | }; | }; |
131 | 130 | ||
132 | 131 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/newMixingModel.C changed (mode: 100644) (index 2d4228f..e179cc6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/mixingDiffusionModel/mixingDiffusionModel.C changed (mode: 100644) (index dc29a55..c1c785c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/mixingDiffusionModel/mixingDiffusionModel.H changed (mode: 100644) (index 2e89e75..46191d4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace mixingSubModels | |
54 | 54 | ||
55 | 55 | class mixingDiffusionModel | class mixingDiffusionModel |
56 | 56 | { | { |
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | mixingDiffusionModel(const mixingDiffusionModel&); | ||
61 | |||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const mixingDiffusionModel&); | ||
64 | |||
65 | |||
66 | 57 | protected: | protected: |
67 | 58 | ||
68 | 59 | // Protected data | // Protected data |
... | ... | public: | |
93 | 84 | //- Construct from components | //- Construct from components |
94 | 85 | mixingDiffusionModel(const dictionary& dict); | mixingDiffusionModel(const dictionary& dict); |
95 | 86 | ||
87 | //- Disallow default bitwise copy construct | ||
88 | mixingDiffusionModel(const mixingDiffusionModel&) = delete; | ||
89 | |||
96 | 90 | ||
97 | 91 | // Selectors | // Selectors |
98 | 92 | ||
... | ... | public: | |
113 | 107 | ( | ( |
114 | 108 | const volScalarField& moment | const volScalarField& moment |
115 | 109 | ) const = 0; | ) const = 0; |
110 | |||
111 | |||
112 | // Member Operators | ||
113 | |||
114 | //- Disallow default bitwise assignment | ||
115 | void operator=(const mixingDiffusionModel&) = delete; | ||
116 | 116 | }; | }; |
117 | 117 | ||
118 | 118 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/mixingDiffusionModel/newMixingDiffusionModel.C changed (mode: 100644) (index 3d1c568..563aad9) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C changed (mode: 100644) (index 149b793..3424d81) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.H changed (mode: 100644) (index 6baddd2..f0a74ec) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/noDiffusion/noDiffusion.C changed (mode: 100644) (index f9ee76b..9dee2b5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/noDiffusion/noDiffusion.H changed (mode: 100644) (index 7ddb60d..eb133b6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C changed (mode: 100644) (index 2df0c57..43aaf37) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.H changed (mode: 100644) (index a127e6f..1490a92) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.C changed (mode: 100644) (index bce97f0..98f21cc) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::mixingSubModels::mixingKernels::FokkerPlanck::~FokkerPlanck() | |
72 | 72 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
73 | 73 | Foam::mixingSubModels::mixingKernels::FokkerPlanck::K | Foam::mixingSubModels::mixingKernels::FokkerPlanck::K |
74 | 74 | ( | ( |
75 | const volUnivariateMoment& moment, | ||
76 | const volUnivariateMomentFieldSet& moments | ||
75 | const volScalarMoment& moment, | ||
76 | const volScalarMomentFieldSet& moments | ||
77 | 77 | ) const | ) const |
78 | 78 | { | { |
79 | 79 | typedef compressible::turbulenceModel cmpTurbModel; | typedef compressible::turbulenceModel cmpTurbModel; |
... | ... | Foam::mixingSubModels::mixingKernels::FokkerPlanck::K | |
108 | 108 | ) | ) |
109 | 109 | ); | ); |
110 | 110 | ||
111 | dimensionedScalar oneMoment("oneMoment", moments[1].dimensions(), 1.0); | ||
111 | dimensionedScalar oneMoment("oneMoment", moments(1).dimensions(), 1.0); | ||
112 | 112 | ||
113 | 113 | if (momentOrder == 0) | if (momentOrder == 0) |
114 | 114 | { | { |
... | ... | Foam::mixingSubModels::mixingKernels::FokkerPlanck::K | |
118 | 118 | { | { |
119 | 119 | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() |
120 | 120 | *moments[momentOrder - 1] | *moments[momentOrder - 1] |
121 | *((Cmixing_ + 1.0)*moments[1] + Cmixing_*(momentOrder - 1)*oneMoment | ||
122 | *((moments[2] - sqr(moments[1]))/(moments[1]*oneMoment | ||
123 | - moments[2]))) - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon() | ||
121 | *((Cmixing_ + 1.0)*moments(1) + Cmixing_*(momentOrder - 1)*oneMoment | ||
122 | *((moments(2) - sqr(moments(1)))/(moments(1)*oneMoment | ||
123 | - moments(2)))) - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon() | ||
124 | 124 | /flTurb.k()*((Cmixing_ + 1.0) + Cmixing_*(momentOrder - 1) | /flTurb.k()*((Cmixing_ + 1.0) + Cmixing_*(momentOrder - 1) |
125 | *((moments[2] - sqr(moments[1]))/(moments[1]*oneMoment | ||
126 | - moments[2]))), moment); | ||
125 | *((moments(2) - sqr(moments(1)))/(moments(1)*oneMoment | ||
126 | - moments(2)))), moment); | ||
127 | 127 | } | } |
128 | 128 | ||
129 | 129 | return mixingK; | return mixingK; |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.H changed (mode: 100644) (index 931e5a1..61f0f0b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
82 | 82 | //- Mixing kernel | //- Mixing kernel |
83 | 83 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
84 | 84 | ( | ( |
85 | const volUnivariateMoment& moment, | ||
86 | const volUnivariateMomentFieldSet& moments | ||
85 | const volScalarMoment& moment, | ||
86 | const volScalarMomentFieldSet& moments | ||
87 | 87 | ) const; | ) const; |
88 | 88 | ||
89 | 89 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.C changed (mode: 100644) (index dfa6a85..55c1ade) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::mixingSubModels::mixingKernels::IEM | |
72 | 72 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
73 | 73 | Foam::mixingSubModels::mixingKernels::IEM::K | Foam::mixingSubModels::mixingKernels::IEM::K |
74 | 74 | ( | ( |
75 | const volUnivariateMoment& moment, | ||
76 | const volUnivariateMomentFieldSet& moments | ||
75 | const volScalarMoment& moment, | ||
76 | const volScalarMomentFieldSet& moments | ||
77 | 77 | ) const | ) const |
78 | 78 | { | { |
79 | 79 | typedef compressible::turbulenceModel cmpTurbModel; | typedef compressible::turbulenceModel cmpTurbModel; |
... | ... | Foam::mixingSubModels::mixingKernels::IEM::K | |
115 | 115 | else | else |
116 | 116 | { | { |
117 | 117 | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() |
118 | *(moments[momentOrder - 1]*moments[1]) | ||
118 | *(moments(momentOrder - 1)*moments(1)) | ||
119 | 119 | - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon()/flTurb.k(), moment); | - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon()/flTurb.k(), moment); |
120 | 120 | } | } |
121 | 121 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.H changed (mode: 100644) (index c4245bd..c678b3a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
82 | 82 | //- Mixing kernel | //- Mixing kernel |
83 | 83 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
84 | 84 | ( | ( |
85 | const volUnivariateMoment& moment, | ||
86 | const volUnivariateMomentFieldSet& moments | ||
85 | const volScalarMoment& moment, | ||
86 | const volScalarMomentFieldSet& moments | ||
87 | 87 | ) const; | ) const; |
88 | 88 | ||
89 | 89 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/mixingKernel/mixingKernel.C changed (mode: 100644) (index efdf990..57d2acc) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/mixingKernel/mixingKernel.H changed (mode: 100644) (index c9a5e2a..10f56b0) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace mixingSubModels | |
56 | 56 | ||
57 | 57 | class mixingKernel | class mixingKernel |
58 | 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 | 59 | protected: | protected: |
69 | 60 | ||
70 | 61 | // Protected data | // Protected data |
... | ... | public: | |
101 | 92 | //- Construct from components | //- Construct from components |
102 | 93 | mixingKernel(const dictionary& dict); | mixingKernel(const dictionary& dict); |
103 | 94 | ||
95 | //- Disallow default bitwise copy construct | ||
96 | mixingKernel(const mixingKernel&) = delete; | ||
97 | |||
104 | 98 | ||
105 | 99 | // Selectors | // Selectors |
106 | 100 | ||
... | ... | public: | |
119 | 113 | //- Aggregation kernel | //- Aggregation kernel |
120 | 114 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
121 | 115 | ( | ( |
122 | const volUnivariateMoment& moment, | ||
123 | const volUnivariateMomentFieldSet& moments | ||
116 | const volScalarMoment& moment, | ||
117 | const volScalarMomentFieldSet& moments | ||
124 | 118 | ) const = 0; | ) const = 0; |
119 | |||
120 | |||
121 | // Member Operators | ||
122 | |||
123 | //- Disallow default bitwise assignment | ||
124 | void operator=(const mixingKernel&) = delete; | ||
125 | 125 | }; | }; |
126 | 126 | ||
127 | 127 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/mixingKernel/newMixingKernel.C changed (mode: 100644) (index 6c21bc7..f296c4f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/noMixingKernel/noMixingKernel.C changed (mode: 100644) (index 62543a0..6a239f7) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::mixingSubModels::mixingKernels::noMixingKernel | |
72 | 72 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
73 | 73 | Foam::mixingSubModels::mixingKernels::noMixingKernel::K | Foam::mixingSubModels::mixingKernels::noMixingKernel::K |
74 | 74 | ( | ( |
75 | const volUnivariateMoment& moment, | ||
76 | const volUnivariateMomentFieldSet& moments | ||
75 | const volScalarMoment& moment, | ||
76 | const volScalarMomentFieldSet& moments | ||
77 | 77 | ) const | ) const |
78 | 78 | { | { |
79 | 79 | tmp<fvScalarMatrix> mixingK | tmp<fvScalarMatrix> mixingK |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/noMixingKernel/noMixingKernel.H changed (mode: 100644) (index 90c3654..4eb5002) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
75 | 75 | //- Mixing kernel | //- Mixing kernel |
76 | 76 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
77 | 77 | ( | ( |
78 | const volUnivariateMoment& moment, | ||
79 | const volUnivariateMomentFieldSet& moments | ||
78 | const volScalarMoment& moment, | ||
79 | const volScalarMomentFieldSet& moments | ||
80 | 80 | ) const; | ) const; |
81 | 81 | ||
82 | 82 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.C changed (mode: 100644) (index 5672d69..dae649d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H changed (mode: 100644) (index 63c8f61..a885d8c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.C changed (mode: 100644) (index 6881f2c..0fe0460) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::mixingModels::turbulentMixing::~turbulentMixing() | |
82 | 82 | ||
83 | 83 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
84 | 84 | ||
85 | Foam::tmp<fvScalarMatrix> Foam::PDFTransportModels::mixingModels | ||
86 | ::turbulentMixing::momentDiffusion | ||
87 | ( | ||
88 | const volUnivariateMoment& moment | ||
89 | ) | ||
85 | |||
86 | void Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
87 | ::explicitMomentSource() | ||
88 | {} | ||
89 | |||
90 | |||
91 | bool Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
92 | ::solveMomentSources() const | ||
90 | 93 | { | { |
91 | return diffusionModel_->momentDiff(moment); | ||
94 | return true; | ||
92 | 95 | } | } |
93 | 96 | ||
94 | Foam::tmp<Foam::volScalarField> | ||
95 | Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
96 | ::phaseSpaceConvection | ||
97 | ( | ||
98 | const volUnivariateMoment& moment | ||
99 | ) | ||
100 | { | ||
101 | tmp<volScalarField> gSource | ||
102 | ( | ||
103 | new volScalarField | ||
104 | ( | ||
105 | IOobject | ||
106 | ( | ||
107 | "gSource", | ||
108 | phi_.mesh().time().timeName(), | ||
109 | phi_.mesh(), | ||
110 | IOobject::NO_READ, | ||
111 | IOobject::NO_WRITE, | ||
112 | false | ||
113 | ), | ||
114 | phi_.mesh(), | ||
115 | dimensionedScalar("zero", moment.dimensions()/dimTime, 0.0) | ||
116 | ) | ||
117 | ); | ||
118 | 97 | ||
119 | return gSource; | ||
98 | bool Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
99 | ::solveMomentOde() const | ||
100 | { | ||
101 | return false; | ||
120 | 102 | } | } |
121 | 103 | ||
122 | void Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
123 | ::explicitMomentSource() | ||
124 | {} | ||
104 | |||
125 | 105 | ||
126 | 106 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
127 | 107 | Foam::PDFTransportModels::mixingModels::turbulentMixing::implicitMomentSource | Foam::PDFTransportModels::mixingModels::turbulentMixing::implicitMomentSource |
128 | 108 | ( | ( |
129 | const volUnivariateMoment& moment | ||
109 | const volScalarMoment& moment | ||
130 | 110 | ) | ) |
131 | 111 | { | { |
132 | const volUnivariateMomentFieldSet& moments = (*this).quadrature().moments(); | ||
112 | const volScalarMomentFieldSet& moments = (*this).quadrature().moments(); | ||
133 | 113 | ||
134 | return mixingKernel_->K(moment, moments); | ||
114 | return | ||
115 | mixingKernel_->K(moment, moments) | ||
116 | + diffusionModel_->momentDiff(moment); | ||
135 | 117 | } | } |
136 | 118 | ||
137 | Foam::scalar | ||
138 | Foam::PDFTransportModels::mixingModels::turbulentMixing::cellMomentSource | ||
139 | ( | ||
140 | label& momentOrder, | ||
141 | label& celli | ||
142 | ) | ||
143 | { | ||
144 | return 0.0; | ||
145 | } | ||
146 | 119 | ||
147 | Foam::scalar Foam::PDFTransportModels::mixingModels::turbulentMixing::realizableCo | ||
148 | () | ||
120 | Foam::scalar Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
121 | ::realizableCo() | ||
149 | 122 | { | { |
150 | 123 | return univariatePDFTransportModel::realizableCo(); | return univariatePDFTransportModel::realizableCo(); |
151 | 124 | } | } |
152 | 125 | ||
126 | |||
153 | 127 | void Foam::PDFTransportModels::mixingModels::turbulentMixing::solve | void Foam::PDFTransportModels::mixingModels::turbulentMixing::solve |
154 | 128 | () | () |
155 | 129 | { | { |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.H changed (mode: 100644) (index 265f213..3a766bc) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class turbulentMixing | |
75 | 75 | ||
76 | 76 | // Private member functions | // Private member functions |
77 | 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 | ||
78 | //- Calculate implicit source terms | ||
79 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
86 | 80 | ( | ( |
87 | const volUnivariateMoment& moment | ||
81 | const volScalarMoment& moment | ||
88 | 82 | ); | ); |
89 | 83 | ||
90 | //- Calculate explicit source terms | ||
84 | //- Calculate explicit source terms with realizable ODE solver | ||
91 | 85 | virtual void explicitMomentSource(); | virtual void explicitMomentSource(); |
92 | 86 | ||
93 | //- Calculate implicit source terms | ||
94 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
95 | ( | ||
96 | const volUnivariateMoment& moment | ||
97 | ); | ||
87 | //- Are moments updated due to sources | ||
88 | virtual bool solveMomentSources() const; | ||
98 | 89 | ||
99 | //- Calculate source term for moment equation in the specified cell | ||
100 | virtual scalar cellMomentSource | ||
101 | ( | ||
102 | label& momentOrder, | ||
103 | label& celli | ||
104 | ); | ||
90 | //- Is the realizable ode solver used to solve sources | ||
91 | virtual bool solveMomentOde() const; | ||
105 | 92 | ||
106 | 93 | ||
107 | 94 | public: | public: |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/Make/files changed (mode: 100644) (index db3fbd1..2d195a5) | |||
... | ... | univariate/firstOrderKineticUnivariateAdvection/firstOrderKineticUnivariateAdvec | |
5 | 5 | univariate/noUnivariateAdvection/noUnivariateAdvection.C | univariate/noUnivariateAdvection/noUnivariateAdvection.C |
6 | 6 | univariate/zetaUnivariateAdvection/zetaUnivariateAdvection.C | univariate/zetaUnivariateAdvection/zetaUnivariateAdvection.C |
7 | 7 | ||
8 | |||
9 | 8 | velocity/velocityMomentAdvection/velocityMomentAdvection.C | velocity/velocityMomentAdvection/velocityMomentAdvection.C |
10 | 9 | velocity/velocityMomentAdvection/newVelocityMomentAdvection.C | velocity/velocityMomentAdvection/newVelocityMomentAdvection.C |
11 | |||
10 | velocity/noVelocityAdvection/noVelocityAdvection.C | ||
12 | 11 | velocity/firstOrderKineticVelocityAdvection/firstOrderKineticVelocityAdvection.C | velocity/firstOrderKineticVelocityAdvection/firstOrderKineticVelocityAdvection.C |
12 | velocity/VikasQuasiSecondOrderVelocityAdvection/VikasQuasiSecondOrderVelocityAdvection.C | ||
13 | |||
14 | velocity/fvQuadraturePatch/fvQuadraturePatch/fvQuadraturePatch.C | ||
15 | velocity/fvQuadraturePatch/fvQuadraturePatch/newFvQuadraturePatch.C | ||
16 | velocity/fvQuadraturePatch/calculated/calculatedFvQuadraturePatch.C | ||
17 | velocity/fvQuadraturePatch/symmetry/symmetryFvQuadraturePatch.C | ||
18 | velocity/fvQuadraturePatch/noFlux/noFluxFvQuadraturePatch.C | ||
19 | velocity/fvQuadraturePatch/reflective/reflectiveFvQuadraturePatch.C | ||
20 | velocity/fvQuadraturePatch/reflectiveMovingWall/reflectiveMovingWallFvQuadraturePatch.C | ||
21 | velocity/fvQuadraturePatch/reflectiveRotatingWall/reflectiveRotatingWallFvQuadraturePatch.C | ||
22 | velocity/fvQuadraturePatch/outflow/outflowFvQuadraturePatch.C | ||
23 | velocity/fvQuadraturePatch/fixedTemperature/fixedTemperatureFvQuadraturePatch.C | ||
13 | 24 | ||
14 | 25 | LIB = $(FOAM_USER_LIBBIN)/libmomentAdvection | LIB = $(FOAM_USER_LIBBIN)/libmomentAdvection |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/Make/options changed (mode: 100644) (index b2e7ffa..a5cb960) | |||
... | ... | EXE_INC = \ | |
3 | 3 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
4 | 4 | -I../../mappedList \ | -I../../mappedList \ |
5 | 5 | -I../../mappedPtrList \ | -I../../mappedPtrList \ |
6 | -I../quadratureNode \ | ||
6 | -I../quadratureNode/lnInclude \ | ||
7 | 7 | -I../moments \ | -I../moments \ |
8 | 8 | -I../momentSets/lnInclude \ | -I../momentSets/lnInclude \ |
9 | 9 | -I../momentInversion/lnInclude \ | -I../momentInversion/lnInclude \ |
... | ... | LIB_LIBS = \ | |
14 | 14 | -lfiniteVolume \ | -lfiniteVolume \ |
15 | 15 | -lmeshTools \ | -lmeshTools \ |
16 | 16 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
17 | -lquadratureNode \ | ||
17 | 18 | -lmomentSets \ | -lmomentSets \ |
18 | 19 | -lmomentInversion \ | -lmomentInversion \ |
19 | 20 | -lfieldMomentInversion \ | -lfieldMomentInversion \ |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/firstOrderKineticUnivariateAdvection/firstOrderKineticUnivariateAdvection.C changed (mode: 100644) (index 3ce2e07..0c1f89c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace univariateAdvection | |
48 | 48 | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic |
49 | 49 | ( | ( |
50 | 50 | const dictionary& dict, | const dictionary& dict, |
51 | const univariateQuadratureApproximation& quadrature, | ||
51 | const scalarQuadratureApproximation& quadrature, | ||
52 | 52 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
53 | 53 | const word& support | const word& support |
54 | 54 | ) | ) |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
65 | 65 | ( | ( |
66 | 66 | name_, nMoments_, nodesOwn_, nDimensions_, moments_.map(), support | name_, nMoments_, nodesOwn_, nDimensions_, moments_.map(), support |
67 | 67 | ), | ), |
68 | momentFieldInverter_ | ||
69 | ( | ||
70 | new basicFieldMomentInversion | ||
71 | ( | ||
72 | quadrature.subDict("momentAdvection"), | ||
73 | own_.mesh(), | ||
74 | quadrature.momentOrders(), | ||
75 | quadrature.nodeIndexes(), | ||
76 | 0 | ||
77 | ) | ||
78 | ) | ||
68 | momentFieldInverter_() | ||
79 | 69 | { | { |
80 | 70 | if (nMoments_ % 2 == 0) | if (nMoments_ % 2 == 0) |
81 | 71 | { | { |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
87 | 77 | } | } |
88 | 78 | ||
89 | 79 | const Map<label> map = quadrature.nodes().map(); | const Map<label> map = quadrature.nodes().map(); |
80 | |||
90 | 81 | nodes_ = autoPtr<mappedPtrList<volScalarNode>> | nodes_ = autoPtr<mappedPtrList<volScalarNode>> |
91 | 82 | ( | ( |
92 | 83 | new mappedPtrList<volScalarNode>(nNodes_, map) | new mappedPtrList<volScalarNode>(nNodes_, map) |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
106 | 97 | mappedPtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | mappedPtrList<surfaceScalarNode>& nodesNei = nodesNei_(); |
107 | 98 | mappedPtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | mappedPtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); |
108 | 99 | ||
100 | PtrList<dimensionSet> abscissaDimensions(1); | ||
101 | |||
102 | abscissaDimensions.set | ||
103 | ( | ||
104 | 0, | ||
105 | new dimensionSet(moments_(1).dimensions()/moments_(0).dimensions()) | ||
106 | ); | ||
107 | |||
109 | 108 | // Populating nodes and interpolated nodes | // Populating nodes and interpolated nodes |
110 | 109 | forAll(nodes, nodei) | forAll(nodes, nodei) |
111 | 110 | { | { |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
116 | 115 | ( | ( |
117 | 116 | "nodeAdvection" + Foam::name(nodei), | "nodeAdvection" + Foam::name(nodei), |
118 | 117 | name_, | name_, |
119 | moments_[0].mesh(), | ||
120 | moments_[0].dimensions(), | ||
121 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
118 | moments_(0).mesh(), | ||
119 | moments_(0).dimensions(), | ||
120 | abscissaDimensions, | ||
122 | 121 | false | false |
123 | 122 | ) | ) |
124 | 123 | ); | ); |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
130 | 129 | ( | ( |
131 | 130 | "nodeRadau" + Foam::name(nodei) + "Nei", | "nodeRadau" + Foam::name(nodei) + "Nei", |
132 | 131 | name_, | name_, |
133 | moments_[0].mesh(), | ||
134 | moments_[0].dimensions(), | ||
135 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
132 | moments_(0).mesh(), | ||
133 | moments_(0).dimensions(), | ||
134 | abscissaDimensions, | ||
136 | 135 | false | false |
137 | 136 | ) | ) |
138 | 137 | ); | ); |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
144 | 143 | ( | ( |
145 | 144 | "nodeRadau" + Foam::name(nodei) + "Own", | "nodeRadau" + Foam::name(nodei) + "Own", |
146 | 145 | name_, | name_, |
147 | moments_[0].mesh(), | ||
148 | moments_[0].dimensions(), | ||
149 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
146 | moments_(0).mesh(), | ||
147 | moments_(0).dimensions(), | ||
148 | abscissaDimensions, | ||
150 | 149 | false | false |
151 | 150 | ) | ) |
152 | 151 | ); | ); |
... | ... | Foam::univariateAdvection::firstOrderKinetic::firstOrderKinetic | |
158 | 157 | momentsNei_.set | momentsNei_.set |
159 | 158 | ( | ( |
160 | 159 | momenti, | momenti, |
161 | new Foam::surfaceUnivariateMoment | ||
160 | new surfaceScalarMoment | ||
162 | 161 | ( | ( |
163 | 162 | name_, | name_, |
164 | moments_[momenti].cmptOrders(), | ||
163 | moments_(momenti).cmptOrders(), | ||
165 | 164 | nodesNei_, | nodesNei_, |
166 | fvc::interpolate(moments_[momenti]) | ||
165 | fvc::interpolate(moments_(momenti)), | ||
166 | "Nei" | ||
167 | 167 | ) | ) |
168 | 168 | ); | ); |
169 | 169 | ||
170 | 170 | momentsOwn_.set | momentsOwn_.set |
171 | 171 | ( | ( |
172 | 172 | momenti, | momenti, |
173 | new Foam::surfaceUnivariateMoment | ||
173 | new surfaceScalarMoment | ||
174 | 174 | ( | ( |
175 | 175 | name_, | name_, |
176 | moments_[momenti].cmptOrders(), | ||
176 | moments_(momenti).cmptOrders(), | ||
177 | 177 | nodesOwn_, | nodesOwn_, |
178 | fvc::interpolate(moments_[momenti]) | ||
178 | fvc::interpolate(moments_(momenti)), | ||
179 | "Own" | ||
179 | 180 | ) | ) |
180 | 181 | ); | ); |
181 | 182 | } | } |
183 | |||
184 | momentFieldInverter_.set | ||
185 | ( | ||
186 | new basicFieldMomentInversion | ||
187 | ( | ||
188 | quadrature.subDict("momentAdvection"), | ||
189 | moments_[0].mesh(), | ||
190 | quadrature.momentOrders(), | ||
191 | quadrature.nodeIndexes(), | ||
192 | nodes_()[0].velocityIndexes(), | ||
193 | 0 | ||
194 | ) | ||
195 | ); | ||
182 | 196 | } | } |
183 | 197 | ||
184 | 198 | ||
... | ... | void Foam::univariateAdvection::firstOrderKinetic::interpolateNodes() | |
196 | 210 | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); |
197 | 211 | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); |
198 | 212 | ||
213 | IStringStream weightOwnLimiter("upwind"); | ||
214 | IStringStream abscissaOwnLimiter("upwind"); | ||
215 | |||
216 | tmp<surfaceInterpolationScheme<scalar>> weightOwnScheme | ||
217 | ( | ||
218 | fvc::scheme<scalar>(own_, weightOwnLimiter) | ||
219 | ); | ||
220 | |||
221 | tmp<surfaceInterpolationScheme<scalar>> abscissaOwnScheme | ||
222 | ( | ||
223 | fvc::scheme<scalar>(own_, abscissaOwnLimiter) | ||
224 | ); | ||
225 | |||
226 | IStringStream weightNeiLimiter("upwind"); | ||
227 | IStringStream abscissaNeiLimiter("upwind"); | ||
228 | |||
229 | tmp<surfaceInterpolationScheme<scalar>> weightNeiScheme | ||
230 | ( | ||
231 | fvc::scheme<scalar>(nei_, weightNeiLimiter) | ||
232 | ); | ||
233 | |||
234 | tmp<surfaceInterpolationScheme<scalar>> abscissaNeiScheme | ||
235 | ( | ||
236 | fvc::scheme<scalar>(nei_, abscissaNeiLimiter) | ||
237 | ); | ||
238 | |||
199 | 239 | forAll(nodes, rNodei) | forAll(nodes, rNodei) |
200 | 240 | { | { |
201 | 241 | const volScalarNode& node(nodes[rNodei]); | const volScalarNode& node(nodes[rNodei]); |
... | ... | void Foam::univariateAdvection::firstOrderKinetic::interpolateNodes() | |
203 | 243 | surfaceScalarNode& nodeOwn(nodesOwn[rNodei]); | surfaceScalarNode& nodeOwn(nodesOwn[rNodei]); |
204 | 244 | ||
205 | 245 | nodeOwn.primaryWeight() = | nodeOwn.primaryWeight() = |
206 | fvc::interpolate(node.primaryWeight(), own_, "reconstruct(weight)"); | ||
207 | |||
208 | nodeOwn.primaryAbscissa() = | ||
209 | fvc::interpolate | ||
210 | ( | ||
211 | node.primaryAbscissa(), | ||
212 | own_, | ||
213 | "reconstruct(abscissa)" | ||
214 | ); | ||
246 | weightOwnScheme().interpolate(node.primaryWeight()); | ||
215 | 247 | ||
216 | 248 | nodeNei.primaryWeight() = | nodeNei.primaryWeight() = |
217 | fvc::interpolate(node.primaryWeight(), nei_, "reconstruct(weight)"); | ||
218 | |||
219 | nodeNei.primaryAbscissa() = | ||
220 | fvc::interpolate | ||
221 | ( | ||
222 | node.primaryAbscissa(), | ||
223 | nei_, | ||
224 | "reconstruct(abscissa)" | ||
225 | ); | ||
249 | weightNeiScheme().interpolate(node.primaryWeight()); | ||
250 | |||
251 | forAll(node.primaryAbscissae(), cmpt) | ||
252 | { | ||
253 | nodeOwn.primaryAbscissae()[cmpt] = | ||
254 | abscissaOwnScheme().interpolate | ||
255 | ( | ||
256 | node.primaryAbscissae()[cmpt] | ||
257 | ); | ||
258 | |||
259 | nodeNei.primaryAbscissae()[cmpt] = | ||
260 | abscissaNeiScheme().interpolate | ||
261 | ( | ||
262 | node.primaryAbscissae()[cmpt] | ||
263 | ); | ||
264 | } | ||
226 | 265 | } | } |
227 | 266 | } | } |
228 | 267 | ||
... | ... | void Foam::univariateAdvection::firstOrderKinetic::update() | |
245 | 284 | ||
246 | 285 | forAll(divMoments_, divi) | forAll(divMoments_, divi) |
247 | 286 | { | { |
248 | volScalarField divMoment | ||
249 | ( | ||
250 | IOobject | ||
287 | divMoments_(divi) = | ||
288 | fvc::surfaceIntegrate | ||
251 | 289 | ( | ( |
252 | "divMoment", | ||
253 | moments_[0].mesh().time().timeName(), | ||
254 | moments_[0].mesh(), | ||
255 | IOobject::NO_READ, | ||
256 | IOobject::NO_WRITE, | ||
257 | false | ||
258 | ), | ||
259 | moments_[0].mesh(), | ||
260 | dimensionedScalar("zero", dimless, 0.0) | ||
261 | ); | ||
262 | |||
263 | surfaceScalarField mFlux | ||
264 | ( | ||
265 | momentsNei_[divi]*min(phi_, zeroPhi) | ||
266 | + momentsOwn_[divi]*max(phi_, zeroPhi) | ||
267 | ); | ||
268 | |||
269 | fvc::surfaceIntegrate(divMoment.ref(), mFlux); | ||
270 | divMoment.ref().dimensions().reset(moments_[divi].dimensions()/dimTime); | ||
271 | |||
272 | divMoments_[divi].replace(0, divMoment); | ||
290 | momentsNei_[divi]*min(phi_, zeroPhi) | ||
291 | + momentsOwn_[divi]*max(phi_, zeroPhi) | ||
292 | ); | ||
273 | 293 | } | } |
274 | 294 | } | } |
275 | 295 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/firstOrderKineticUnivariateAdvection/firstOrderKineticUnivariateAdvection.H changed (mode: 100644) (index 64e8e7e..f4e4dd3) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class firstOrderKinetic | |
65 | 65 | autoPtr<mappedPtrList<surfaceScalarNode>> nodesOwn_; | autoPtr<mappedPtrList<surfaceScalarNode>> nodesOwn_; |
66 | 66 | ||
67 | 67 | //- List of interpolated moments (neighbour) | //- List of interpolated moments (neighbour) |
68 | surfaceUnivariateMomentFieldSet momentsNei_; | ||
68 | surfaceScalarMomentFieldSet momentsNei_; | ||
69 | 69 | ||
70 | 70 | //- List of interpolated moments (owner) | //- List of interpolated moments (owner) |
71 | surfaceUnivariateMomentFieldSet momentsOwn_; | ||
71 | surfaceScalarMomentFieldSet momentsOwn_; | ||
72 | 72 | ||
73 | 73 | //- Flux moment inversion method | //- Flux moment inversion method |
74 | 74 | autoPtr<basicFieldMomentInversion> momentFieldInverter_; | autoPtr<basicFieldMomentInversion> momentFieldInverter_; |
... | ... | public: | |
95 | 95 | firstOrderKinetic | firstOrderKinetic |
96 | 96 | ( | ( |
97 | 97 | const dictionary& dict, | const dictionary& dict, |
98 | const univariateQuadratureApproximation& quadrature, | ||
98 | const scalarQuadratureApproximation& quadrature, | ||
99 | 99 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
100 | 100 | const word& support | const word& support |
101 | 101 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.C changed (mode: 100644) (index 2e1c456..cea79ad) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace univariateAdvection | |
48 | 48 | Foam::univariateAdvection::noAdvection::noAdvection | Foam::univariateAdvection::noAdvection::noAdvection |
49 | 49 | ( | ( |
50 | 50 | const dictionary& dict, | const dictionary& dict, |
51 | const univariateQuadratureApproximation& quadrature, | ||
51 | const scalarQuadratureApproximation& quadrature, | ||
52 | 52 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
53 | 53 | const word& support | const word& support |
54 | 54 | ) | ) |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.H changed (mode: 100644) (index 72a323d..d912b67) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
65 | 65 | noAdvection | noAdvection |
66 | 66 | ( | ( |
67 | 67 | const dictionary& dict, | const dictionary& dict, |
68 | const univariateQuadratureApproximation& quadrature, | ||
68 | const scalarQuadratureApproximation& quadrature, | ||
69 | 69 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
70 | 70 | const word& support | const word& support |
71 | 71 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/univariateMomentAdvection/newUnivariateMomentAdvection.C changed (mode: 100644) (index c7442b7..0f8b514) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::autoPtr<Foam::univariateMomentAdvection> | |
31 | 31 | Foam::univariateMomentAdvection::New | Foam::univariateMomentAdvection::New |
32 | 32 | ( | ( |
33 | 33 | const dictionary& dict, | const dictionary& dict, |
34 | const univariateQuadratureApproximation& quadrature, | ||
34 | const scalarQuadratureApproximation& quadrature, | ||
35 | 35 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
36 | 36 | const word& support | const word& support |
37 | 37 | ) | ) |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/univariateMomentAdvection/univariateMomentAdvection.C changed (mode: 100644) (index 7f49416..dc9c003) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace Foam | |
39 | 39 | Foam::univariateMomentAdvection::univariateMomentAdvection | Foam::univariateMomentAdvection::univariateMomentAdvection |
40 | 40 | ( | ( |
41 | 41 | const dictionary& dict, | const dictionary& dict, |
42 | const univariateQuadratureApproximation& quadrature, | ||
42 | const scalarQuadratureApproximation& quadrature, | ||
43 | 43 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
44 | 44 | const word& support | const word& support |
45 | 45 | ) | ) |
... | ... | Foam::univariateMomentAdvection::univariateMomentAdvection | |
52 | 52 | ( | ( |
53 | 53 | IOobject | IOobject |
54 | 54 | ( | ( |
55 | "own", | ||
56 | moments_[0].mesh().time().timeName(), | ||
57 | moments_[0].mesh() | ||
55 | IOobject::groupName("univariateMomentAdvection:own", name_), | ||
56 | moments_(0).mesh().time().timeName(), | ||
57 | moments_(0).mesh() | ||
58 | 58 | ), | ), |
59 | moments_[0].mesh(), | ||
59 | moments_(0).mesh(), | ||
60 | 60 | dimensionedScalar("own", dimless, 1.0) | dimensionedScalar("own", dimless, 1.0) |
61 | 61 | ), | ), |
62 | 62 | nei_ | nei_ |
63 | 63 | ( | ( |
64 | 64 | IOobject | IOobject |
65 | 65 | ( | ( |
66 | "nei", | ||
67 | moments_[0].mesh().time().timeName(), | ||
68 | moments_[0].mesh() | ||
66 | IOobject::groupName("univariateMomentAdvection:nei", name_), | ||
67 | moments_(0).mesh().time().timeName(), | ||
68 | moments_(0).mesh() | ||
69 | 69 | ), | ), |
70 | moments_[0].mesh(), | ||
70 | moments_(0).mesh(), | ||
71 | 71 | dimensionedScalar("nei", dimless, -1.0) | dimensionedScalar("nei", dimless, -1.0) |
72 | 72 | ), | ), |
73 | 73 | phi_(phi), | phi_(phi), |
... | ... | Foam::univariateMomentAdvection::univariateMomentAdvection | |
83 | 83 | ( | ( |
84 | 84 | IOobject | IOobject |
85 | 85 | ( | ( |
86 | "divMoment" + Foam::name(momenti) + name_, | ||
87 | moments_[0].mesh().time().timeName(), | ||
88 | moments_[0].mesh(), | ||
86 | fieldName("divMoment", {momenti}), | ||
87 | moments_(0).mesh().time().timeName(), | ||
88 | moments_(0).mesh(), | ||
89 | 89 | IOobject::NO_READ, | IOobject::NO_READ, |
90 | IOobject::NO_WRITE, | ||
91 | false | ||
90 | IOobject::NO_WRITE | ||
92 | 91 | ), | ), |
93 | moments_[0].mesh(), | ||
92 | moments_(0).mesh(), | ||
94 | 93 | dimensionedScalar | dimensionedScalar |
95 | 94 | ( | ( |
96 | 95 | "zero", moments_[momenti].dimensions()/dimTime, 0 | "zero", moments_[momenti].dimensions()/dimTime, 0 |
... | ... | Foam::univariateMomentAdvection::~univariateMomentAdvection() | |
109 | 108 | ||
110 | 109 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
111 | 110 | ||
112 | |||
111 | Foam::word Foam::univariateMomentAdvection::fieldName | ||
112 | ( | ||
113 | const word& name, | ||
114 | const labelList& order | ||
115 | ) const | ||
116 | { | ||
117 | return | ||
118 | IOobject::groupName | ||
119 | ( | ||
120 | IOobject::groupName | ||
121 | ( | ||
122 | name, | ||
123 | mappedPtrList<label>::listToWord(order) | ||
124 | ), | ||
125 | name_ | ||
126 | ); | ||
127 | } | ||
113 | 128 | ||
114 | 129 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/univariateMomentAdvection/univariateMomentAdvection.H changed (mode: 100644) (index c24da12..f1c8d60) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
46 | 46 | #include "momentFieldSets.H" | #include "momentFieldSets.H" |
47 | 47 | #include "basicFieldMomentInversion.H" | #include "basicFieldMomentInversion.H" |
48 | 48 | #include "quadratureApproximations.H" | #include "quadratureApproximations.H" |
49 | #include "surfaceInterpolationScheme.H" | ||
49 | 50 | ||
50 | 51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
51 | 52 | ||
... | ... | namespace Foam | |
57 | 58 | ||
58 | 59 | class univariateMomentAdvection | class univariateMomentAdvection |
59 | 60 | { | { |
60 | // Private member functions | ||
61 | |||
62 | //- Disallow default bitwise copy construct | ||
63 | univariateMomentAdvection(const univariateMomentAdvection&); | ||
64 | |||
65 | //- Disallow default bitwise assignment | ||
66 | void operator=(const univariateMomentAdvection&); | ||
67 | |||
68 | |||
69 | 61 | protected: | protected: |
70 | 62 | ||
71 | 63 | // Protected data | // Protected data |
... | ... | protected: | |
74 | 66 | const word name_; | const word name_; |
75 | 67 | ||
76 | 68 | //- Reference to the moments to advect | //- Reference to the moments to advect |
77 | const volUnivariateMomentFieldSet& moments_; | ||
69 | const volScalarMomentFieldSet& moments_; | ||
78 | 70 | ||
79 | 71 | //- Number of moments | //- Number of moments |
80 | 72 | const label nMoments_; | const label nMoments_; |
... | ... | protected: | |
97 | 89 | //- Dimensions of the underlying distribution | //- Dimensions of the underlying distribution |
98 | 90 | label nDimensions_; | label nDimensions_; |
99 | 91 | ||
92 | //- Construct field name from name, order | ||
93 | word fieldName | ||
94 | ( | ||
95 | const word& name, | ||
96 | const labelList& order | ||
97 | ) const; | ||
98 | |||
100 | 99 | ||
101 | 100 | public: | public: |
102 | 101 | ||
... | ... | public: | |
113 | 112 | dictionary, | dictionary, |
114 | 113 | ( | ( |
115 | 114 | const dictionary& dict, | const dictionary& dict, |
116 | const univariateQuadratureApproximation& quadrature, | ||
115 | const scalarQuadratureApproximation& quadrature, | ||
117 | 116 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
118 | 117 | const word& support | const word& support |
119 | 118 | ), | ), |
... | ... | public: | |
127 | 126 | univariateMomentAdvection | univariateMomentAdvection |
128 | 127 | ( | ( |
129 | 128 | const dictionary& dict, | const dictionary& dict, |
130 | const univariateQuadratureApproximation& quadrature, | ||
129 | const scalarQuadratureApproximation& quadrature, | ||
131 | 130 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
132 | 131 | const word& support | const word& support |
133 | 132 | ); | ); |
134 | 133 | ||
134 | //- Disallow default bitwise copy construct | ||
135 | univariateMomentAdvection(const univariateMomentAdvection&) = delete; | ||
136 | |||
135 | 137 | ||
136 | 138 | //- Destructor | //- Destructor |
137 | 139 | virtual ~univariateMomentAdvection(); | virtual ~univariateMomentAdvection(); |
... | ... | public: | |
142 | 144 | static autoPtr<univariateMomentAdvection> New | static autoPtr<univariateMomentAdvection> New |
143 | 145 | ( | ( |
144 | 146 | const dictionary& dict, | const dictionary& dict, |
145 | const univariateQuadratureApproximation& quadrature, | ||
147 | const scalarQuadratureApproximation& quadrature, | ||
146 | 148 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
147 | 149 | const word& support | const word& support |
148 | 150 | ); | ); |
... | ... | public: | |
159 | 161 | //- Update moment advection | //- Update moment advection |
160 | 162 | virtual void update() = 0; | virtual void update() = 0; |
161 | 163 | ||
164 | |||
165 | // Member Operators | ||
166 | |||
167 | //- Disallow default bitwise assignment | ||
168 | void operator=(const univariateMomentAdvection&) = delete; | ||
169 | |||
162 | 170 | }; | }; |
163 | 171 | ||
164 | 172 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/univariateMomentAdvection/univariateMomentAdvectionI.H changed (mode: 100644) (index 55167bd..43ba9d6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/zetaUnivariateAdvection/zetaUnivariateAdvection.C changed (mode: 100644) (index f1c579d..d424265) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace univariateAdvection | |
49 | 49 | Foam::univariateAdvection::zeta::zeta | Foam::univariateAdvection::zeta::zeta |
50 | 50 | ( | ( |
51 | 51 | const dictionary& dict, | const dictionary& dict, |
52 | const univariateQuadratureApproximation& quadrature, | ||
52 | const scalarQuadratureApproximation& quadrature, | ||
53 | 53 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
54 | 54 | const word& support | const word& support |
55 | 55 | ) | ) |
56 | 56 | : | : |
57 | 57 | univariateMomentAdvection(dict, quadrature, phi, support), | univariateMomentAdvection(dict, quadrature, phi, support), |
58 | m0_(moments_[0]), | ||
58 | m0_(moments_(0)), | ||
59 | 59 | m0Own_ | m0Own_ |
60 | 60 | ( | ( |
61 | "m0Own", | ||
61 | IOobject::groupName("m0OwnZeta", name_), | ||
62 | 62 | fvc::interpolate(m0_, own_, "reconstruct(m0)") | fvc::interpolate(m0_, own_, "reconstruct(m0)") |
63 | 63 | ), | ), |
64 | 64 | m0Nei_ | m0Nei_ |
65 | 65 | ( | ( |
66 | "m0Nei", | ||
66 | IOobject::groupName("m0NeiZeta", name_), | ||
67 | 67 | fvc::interpolate(m0_, nei_, "reconstruct(m0)") | fvc::interpolate(m0_, nei_, "reconstruct(m0)") |
68 | 68 | ), | ), |
69 | 69 | nZetas_(nMoments_ - 1), | nZetas_(nMoments_ - 1), |
... | ... | Foam::univariateAdvection::zeta::zeta | |
76 | 76 | zetasCorrOwn_(nZetas_), | zetasCorrOwn_(nZetas_), |
77 | 77 | momentsNei_(nMoments_), | momentsNei_(nMoments_), |
78 | 78 | momentsOwn_(nMoments_), | momentsOwn_(nMoments_), |
79 | nFacesOutgoingFlux_(m0_.mesh().nCells(), 0), | ||
80 | nRealizableMoments_(m0_.mesh().nCells(), 0), | ||
81 | nRealizableMomentsStar_(m0_.mesh().nCells(), 0), | ||
79 | nFacesOutgoingFlux_(m0_.size(), 0), | ||
80 | nRealizableMoments_(m0_.size(), 0), | ||
81 | nRealizableMomentsStar_(m0_.size(), 0), | ||
82 | 82 | limiters_(nZetas_), | limiters_(nZetas_), |
83 | 83 | cellLimiters_(nZetas_), | cellLimiters_(nZetas_), |
84 | 84 | phi_(phi) | phi_(phi) |
85 | 85 | { | { |
86 | if (quadrature.momentOrders()[0].size() > 1) | ||
87 | { | ||
88 | FatalErrorInFunction | ||
89 | << "Zeta advection scheme can only be used for" << nl | ||
90 | << "univariate distributions." | ||
91 | << abort(FatalError); | ||
92 | } | ||
93 | |||
86 | 94 | // Populating zeta_k fields and interpolated zeta_k fields | // Populating zeta_k fields and interpolated zeta_k fields |
87 | 95 | forAll(zetas_, zetai) | forAll(zetas_, zetai) |
88 | 96 | { | { |
... | ... | Foam::univariateAdvection::zeta::zeta | |
93 | 101 | ( | ( |
94 | 102 | IOobject | IOobject |
95 | 103 | ( | ( |
96 | IOobject::groupName | ||
97 | ( | ||
98 | IOobject::groupName("zeta", Foam::name(zetai)), | ||
99 | name_ | ||
100 | ), | ||
104 | fieldName("zeta", {zetai}), | ||
101 | 105 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
102 | 106 | phi.mesh(), | phi.mesh(), |
103 | 107 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
115 | 119 | ( | ( |
116 | 120 | IOobject | IOobject |
117 | 121 | ( | ( |
118 | "zetaNei" + Foam::name(zetai), | ||
122 | fieldName("zetaNei", {zetai}), | ||
119 | 123 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
120 | 124 | phi.mesh(), | phi.mesh(), |
121 | 125 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
133 | 137 | ( | ( |
134 | 138 | IOobject | IOobject |
135 | 139 | ( | ( |
136 | "zetaOwn" + Foam::name(zetai), | ||
140 | fieldName("zetaOwn", {zetai}), | ||
137 | 141 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
138 | 142 | phi.mesh(), | phi.mesh(), |
139 | 143 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
151 | 155 | ( | ( |
152 | 156 | IOobject | IOobject |
153 | 157 | ( | ( |
154 | "zetaUpwindNei" + Foam::name(zetai), | ||
158 | fieldName("zetaUpwindNei", {zetai}), | ||
155 | 159 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
156 | 160 | phi.mesh(), | phi.mesh(), |
157 | 161 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
169 | 173 | ( | ( |
170 | 174 | IOobject | IOobject |
171 | 175 | ( | ( |
172 | "zetaUpwindOwn" + Foam::name(zetai), | ||
176 | fieldName("zetaUpwindOwn", {zetai}), | ||
173 | 177 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
174 | 178 | phi.mesh(), | phi.mesh(), |
175 | 179 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
187 | 191 | ( | ( |
188 | 192 | IOobject | IOobject |
189 | 193 | ( | ( |
190 | "zetaCorrNei" + Foam::name(zetai), | ||
194 | fieldName("zetaCorrNei", {zetai}), | ||
191 | 195 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
192 | 196 | phi.mesh(), | phi.mesh(), |
193 | 197 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
205 | 209 | ( | ( |
206 | 210 | IOobject | IOobject |
207 | 211 | ( | ( |
208 | "zetaCorrOwn" + Foam::name(zetai), | ||
212 | fieldName("zetaCorrOwn", {zetai}), | ||
209 | 213 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
210 | 214 | phi.mesh(), | phi.mesh(), |
211 | 215 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
223 | 227 | ( | ( |
224 | 228 | IOobject | IOobject |
225 | 229 | ( | ( |
226 | "zetaLimiters" + Foam::name(zetai), | ||
230 | fieldName("zetaLimiter", {zetai}), | ||
227 | 231 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
228 | 232 | phi.mesh(), | phi.mesh(), |
229 | 233 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
241 | 245 | ( | ( |
242 | 246 | IOobject | IOobject |
243 | 247 | ( | ( |
244 | "zetaCellLimiters" + Foam::name(zetai), | ||
248 | fieldName("zetaCellLimiter", {zetai}), | ||
245 | 249 | phi.mesh().time().timeName(), | phi.mesh().time().timeName(), |
246 | 250 | phi.mesh(), | phi.mesh(), |
247 | 251 | IOobject::NO_READ, | IOobject::NO_READ, |
... | ... | Foam::univariateAdvection::zeta::zeta | |
261 | 265 | momenti, | momenti, |
262 | 266 | new surfaceScalarField | new surfaceScalarField |
263 | 267 | ( | ( |
264 | "momentNei" + Foam::name(momenti), | ||
265 | fvc::interpolate(moments_[momenti]) | ||
268 | fieldName("momentNeiZeta", {momenti}), | ||
269 | fvc::interpolate(moments_(momenti)) | ||
266 | 270 | ) | ) |
267 | 271 | ); | ); |
268 | 272 | ||
... | ... | Foam::univariateAdvection::zeta::zeta | |
271 | 275 | momenti, | momenti, |
272 | 276 | new surfaceScalarField | new surfaceScalarField |
273 | 277 | ( | ( |
274 | "momentOwn" + Foam::name(momenti), | ||
275 | fvc::interpolate(moments_[momenti]) | ||
278 | fieldName("momentOwnZeta", {momenti}), | ||
279 | fvc::interpolate(moments_(momenti)) | ||
276 | 280 | ) | ) |
277 | 281 | ); | ); |
278 | 282 | } | } |
... | ... | Foam::univariateAdvection::zeta::~zeta() | |
289 | 293 | ||
290 | 294 | void Foam::univariateAdvection::zeta::interpolateFields() | void Foam::univariateAdvection::zeta::interpolateFields() |
291 | 295 | { | { |
292 | m0Own_ = fvc::interpolate(moments_[0], own_, "reconstruct(m0)"); | ||
293 | m0Nei_ = fvc::interpolate(moments_[0], nei_, "reconstruct(m0)"); | ||
296 | IStringStream m0OwnLimiter("Minmod"); | ||
297 | IStringStream zetaOwnLimiter("Minmod"); | ||
298 | |||
299 | tmp<surfaceInterpolationScheme<scalar>> m0OwnScheme | ||
300 | ( | ||
301 | fvc::scheme<scalar>(own_, m0OwnLimiter) | ||
302 | ); | ||
303 | |||
304 | tmp<surfaceInterpolationScheme<scalar>> zetaOwnScheme | ||
305 | ( | ||
306 | fvc::scheme<scalar>(own_, zetaOwnLimiter) | ||
307 | ); | ||
308 | |||
309 | IStringStream m0NeiLimiter("Minmod"); | ||
310 | IStringStream zetaNeiLimiter("Minmod"); | ||
311 | |||
312 | tmp<surfaceInterpolationScheme<scalar>> m0NeiScheme | ||
313 | ( | ||
314 | fvc::scheme<scalar>(nei_, m0NeiLimiter) | ||
315 | ); | ||
316 | |||
317 | tmp<surfaceInterpolationScheme<scalar>> zetaNeiScheme | ||
318 | ( | ||
319 | fvc::scheme<scalar>(nei_, zetaNeiLimiter) | ||
320 | ); | ||
321 | |||
322 | m0Own_ = m0OwnScheme().interpolate(moments_(0)); | ||
323 | m0Nei_ = m0NeiScheme().interpolate(moments_(0)); | ||
294 | 324 | ||
295 | 325 | forAll(zetas_, zetai) | forAll(zetas_, zetai) |
296 | 326 | { | { |
297 | zetasNei_[zetai] = | ||
298 | fvc::interpolate(zetas_[zetai], nei_, "reconstruct(zeta)"); | ||
299 | |||
300 | zetasOwn_[zetai] = | ||
301 | fvc::interpolate(zetas_[zetai], own_, "reconstruct(zeta)"); | ||
327 | zetasNei_[zetai] = zetaNeiScheme().interpolate(zetas_[zetai]); | ||
328 | zetasOwn_[zetai] = zetaOwnScheme().interpolate(zetas_[zetai]); | ||
302 | 329 | ||
303 | 330 | zetasUpwindNei_[zetai] = | zetasUpwindNei_[zetai] = |
304 | 331 | upwind<scalar>(zetas_[zetai].mesh(), nei_).flux(zetas_[zetai]); | upwind<scalar>(zetas_[zetai].mesh(), nei_).flux(zetas_[zetai]); |
... | ... | void Foam::univariateAdvection::zeta::computeZetaFields() | |
377 | 404 | ||
378 | 405 | for (label mi = 0; mi < nMoments_; mi++) | for (label mi = 0; mi < nMoments_; mi++) |
379 | 406 | { | { |
380 | m[mi] = moments_[mi][celli]; | ||
407 | m[mi] = moments_(mi)[celli]; | ||
381 | 408 | } | } |
382 | 409 | ||
383 | 410 | nRealizableMoments_[celli] = m.nRealizableMoments(); | nRealizableMoments_[celli] = m.nRealizableMoments(); |
... | ... | void Foam::univariateAdvection::zeta::computeZetaFields() | |
415 | 442 | ||
416 | 443 | for (label mi = 0; mi < nMoments_; mi++) | for (label mi = 0; mi < nMoments_; mi++) |
417 | 444 | { | { |
418 | m[mi] = moments_[mi].boundaryField()[patchi][facei]; | ||
445 | m[mi] = moments_(mi).boundaryField()[patchi][facei]; | ||
419 | 446 | } | } |
420 | 447 | ||
421 | 448 | scalarList zetas(m.zetas()); | scalarList zetas(m.zetas()); |
... | ... | void Foam::univariateAdvection::zeta::limitZetas() | |
476 | 503 | const labelUList& neighb = phi_.mesh().neighbour(); | const labelUList& neighb = phi_.mesh().neighbour(); |
477 | 504 | const scalarField& phiIf = phi_; | const scalarField& phiIf = phi_; |
478 | 505 | const surfaceScalarField::Boundary& phiBf = phi_.boundaryField(); | const surfaceScalarField::Boundary& phiBf = phi_.boundaryField(); |
479 | const label nCells = phi_.mesh().nCells(); | ||
480 | 506 | const label nInternalFaces = phi_.mesh().nInternalFaces(); | const label nInternalFaces = phi_.mesh().nInternalFaces(); |
481 | 507 | ||
482 | 508 | countFacesWithOutgoingFlux(); | countFacesWithOutgoingFlux(); |
... | ... | void Foam::univariateAdvection::zeta::limitZetas() | |
490 | 516 | } | } |
491 | 517 | ||
492 | 518 | // First check on m* to identify cells in need of additional limitation | // First check on m* to identify cells in need of additional limitation |
493 | scalarRectangularMatrix mPluses(nMoments_, nCells, 0.0); | ||
519 | scalarRectangularMatrix mPluses(nMoments_, m0_.size(), 0.0); | ||
494 | 520 | ||
495 | 521 | // Find m+ (moments reconstructed on cell faces with outgoing flux) | // Find m+ (moments reconstructed on cell faces with outgoing flux) |
496 | 522 | for (label facei = 0; facei < nInternalFaces; facei++) | for (label facei = 0; facei < nInternalFaces; facei++) |
... | ... | void Foam::univariateAdvection::zeta::limitZetas() | |
545 | 571 | { | { |
546 | 572 | mStar[mi] | mStar[mi] |
547 | 573 | = scalar(nFacesOutgoingFlux_[celli] + 1) | = scalar(nFacesOutgoingFlux_[celli] + 1) |
548 | *moments_[mi][celli] - mPluses[mi][celli]; | ||
574 | *moments_(mi)[celli] - mPluses[mi][celli]; | ||
549 | 575 | } | } |
550 | 576 | ||
551 | 577 | nRealizableMomentsStar_[celli] = mStar.nRealizableMoments(false); | nRealizableMomentsStar_[celli] = mStar.nRealizableMoments(false); |
... | ... | void Foam::univariateAdvection::zeta::limitZetas() | |
611 | 637 | { | { |
612 | 638 | mStar[mi] | mStar[mi] |
613 | 639 | = scalar(nFacesOutgoingFlux_[celli] + 1) | = scalar(nFacesOutgoingFlux_[celli] + 1) |
614 | *moments_[mi][celli] - mPlus[mi]; | ||
640 | *moments_(mi)[celli] - mPlus[mi]; | ||
615 | 641 | } | } |
616 | 642 | ||
617 | 643 | nRealizableMomentsStar_[celli] | nRealizableMomentsStar_[celli] |
... | ... | void Foam::univariateAdvection::zeta::limitZetas() | |
667 | 693 | { | { |
668 | 694 | mStar[mi] | mStar[mi] |
669 | 695 | = scalar(nFacesOutgoingFlux_[celli] + 1) | = scalar(nFacesOutgoingFlux_[celli] + 1) |
670 | *moments_[mi][celli] - mPlus[mi]; | ||
696 | *moments_(mi)[celli] - mPlus[mi]; | ||
671 | 697 | } | } |
672 | 698 | ||
673 | 699 | nRealizableMomentsStar_[celli] | nRealizableMomentsStar_[celli] |
... | ... | Foam::scalar Foam::univariateAdvection::zeta::realizableCo() const | |
742 | 768 | const labelList& own = mesh.faceOwner(); | const labelList& own = mesh.faceOwner(); |
743 | 769 | const labelList& nei = mesh.faceNeighbour(); | const labelList& nei = mesh.faceNeighbour(); |
744 | 770 | ||
745 | scalarField internalCo(mesh.nCells(), 0.0); | ||
771 | scalarField internalCo(m0_.size(), 0.0); | ||
746 | 772 | ||
747 | 773 | for (label facei = 0; facei < mesh.nInternalFaces(); facei++) | for (label facei = 0; facei < mesh.nInternalFaces(); facei++) |
748 | 774 | { | { |
... | ... | Foam::scalar Foam::univariateAdvection::zeta::realizableCo() const | |
763 | 789 | ||
764 | 790 | void Foam::univariateAdvection::zeta::update() | void Foam::univariateAdvection::zeta::update() |
765 | 791 | { | { |
792 | if (m0_.size() != nFacesOutgoingFlux_.size()) | ||
793 | { | ||
794 | nFacesOutgoingFlux_.resize(m0_.size()); | ||
795 | nRealizableMoments_.resize(m0_.size()); | ||
796 | nRealizableMomentsStar_.resize(m0_.size()); | ||
797 | } | ||
798 | |||
766 | 799 | // Compute zeta fields | // Compute zeta fields |
767 | 800 | computeZetaFields(); | computeZetaFields(); |
768 | 801 | ||
... | ... | void Foam::univariateAdvection::zeta::update() | |
785 | 818 | ||
786 | 819 | forAll(divMoments_, divi) | forAll(divMoments_, divi) |
787 | 820 | { | { |
788 | volScalarField divMoment | ||
789 | ( | ||
790 | IOobject | ||
821 | divMoments_(divi) = | ||
822 | fvc::surfaceIntegrate | ||
791 | 823 | ( | ( |
792 | "divMoment", | ||
793 | moments_[0].mesh().time().timeName(), | ||
794 | moments_[0].mesh(), | ||
795 | IOobject::NO_READ, | ||
796 | IOobject::NO_WRITE, | ||
797 | false | ||
798 | ), | ||
799 | moments_[0].mesh(), | ||
800 | dimensionedScalar("zero", dimless, 0.0) | ||
801 | ); | ||
802 | |||
803 | surfaceScalarField mFlux | ||
804 | ( | ||
805 | momentsNei_[divi]*min(phi_, zeroPhi) | ||
806 | + momentsOwn_[divi]*max(phi_, zeroPhi) | ||
807 | ); | ||
808 | |||
809 | fvc::surfaceIntegrate(divMoment.ref(), mFlux); | ||
810 | divMoment.ref().dimensions().reset(moments_[divi].dimensions()/dimTime); | ||
811 | |||
812 | divMoments_[divi].replace(0, divMoment); | ||
824 | momentsNei_[divi]*min(phi_, zeroPhi) | ||
825 | + momentsOwn_[divi]*max(phi_, zeroPhi) | ||
826 | ); | ||
813 | 827 | } | } |
814 | 828 | } | } |
815 | 829 | ||
816 | 830 | void Foam::univariateAdvection::zeta::updateMomentFieldsFromZetas | void Foam::univariateAdvection::zeta::updateMomentFieldsFromZetas |
817 | 831 | ( | ( |
818 | const surfaceScalarField m0f, | ||
832 | const surfaceScalarField& m0f, | ||
819 | 833 | const PtrList<surfaceScalarField>& zetaf, | const PtrList<surfaceScalarField>& zetaf, |
820 | 834 | PtrList<surfaceScalarField>& mf | PtrList<surfaceScalarField>& mf |
821 | 835 | ) | ) |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/zetaUnivariateAdvection/zetaUnivariateAdvection.H changed (mode: 100644) (index c85c7fe..a1fc906) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class zeta | |
104 | 104 | PtrList<surfaceScalarField> momentsOwn_; | PtrList<surfaceScalarField> momentsOwn_; |
105 | 105 | ||
106 | 106 | //- Field to store the number of faces with outgoing flux per each cell | //- Field to store the number of faces with outgoing flux per each cell |
107 | labelField nFacesOutgoingFlux_; | ||
107 | mutable labelField nFacesOutgoingFlux_; | ||
108 | 108 | ||
109 | 109 | //- Field to store the number of realizable moments in each cell | //- Field to store the number of realizable moments in each cell |
110 | labelField nRealizableMoments_; | ||
110 | mutable labelField nRealizableMoments_; | ||
111 | 111 | ||
112 | 112 | //- Field to store the number of realizable m* in each cell | //- Field to store the number of realizable m* in each cell |
113 | labelField nRealizableMomentsStar_; | ||
113 | mutable labelField nRealizableMomentsStar_; | ||
114 | 114 | ||
115 | 115 | //- List of limiters for zeta_k | //- List of limiters for zeta_k |
116 | 116 | PtrList<surfaceScalarField> limiters_; | PtrList<surfaceScalarField> limiters_; |
... | ... | class zeta | |
130 | 130 | //- Updates reconstructed moments from the corresponding values of zeta | //- Updates reconstructed moments from the corresponding values of zeta |
131 | 131 | void updateMomentFieldsFromZetas | void updateMomentFieldsFromZetas |
132 | 132 | ( | ( |
133 | const surfaceScalarField m0f, | ||
133 | const surfaceScalarField& m0f, | ||
134 | 134 | const PtrList<surfaceScalarField>& zetaf, | const PtrList<surfaceScalarField>& zetaf, |
135 | 135 | PtrList<surfaceScalarField>& mf | PtrList<surfaceScalarField>& mf |
136 | 136 | ); | ); |
... | ... | public: | |
173 | 173 | zeta | zeta |
174 | 174 | ( | ( |
175 | 175 | const dictionary& dict, | const dictionary& dict, |
176 | const univariateQuadratureApproximation& quadrature, | ||
176 | const scalarQuadratureApproximation& quadrature, | ||
177 | 177 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
178 | 178 | const word& support | const word& support |
179 | 179 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/VikasQuasiSecondOrderVelocityAdvection/VikasQuasiSecondOrderVelocityAdvection.C added (mode: 100644) (index 0000000..81fc829) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2018-2019 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 "VikasQuasiSecondOrderVelocityAdvection.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace velocityAdvection | ||
34 | { | ||
35 | defineTypeNameAndDebug(VikasQuasiSecondOrder, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | velocityMomentAdvection, | ||
40 | VikasQuasiSecondOrder, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
47 | |||
48 | Foam::velocityAdvection::VikasQuasiSecondOrder::VikasQuasiSecondOrder | ||
49 | ( | ||
50 | const dictionary& dict, | ||
51 | const velocityQuadratureApproximation& quadrature, | ||
52 | const word& support | ||
53 | ) | ||
54 | : | ||
55 | firstOrderKinetic(dict, quadrature, support) | ||
56 | { | ||
57 | weightScheme_ = "Minmod"; | ||
58 | } | ||
59 | |||
60 | |||
61 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
62 | |||
63 | Foam::velocityAdvection::VikasQuasiSecondOrder::~VikasQuasiSecondOrder() | ||
64 | {} | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::scalar | ||
70 | Foam::velocityAdvection::VikasQuasiSecondOrder::realizableCo() const | ||
71 | { | ||
72 | const fvMesh& mesh = this->own_.mesh(); | ||
73 | const labelList& own = mesh.owner(); | ||
74 | const labelList& nei = mesh.neighbour(); | ||
75 | surfaceVectorField Sf(mesh.Sf()); | ||
76 | |||
77 | scalarField maxCoNum(mesh.nCells(), 1.0); | ||
78 | |||
79 | forAll(this->nodes_, nodei) | ||
80 | { | ||
81 | |||
82 | surfaceScalarField phiOwn | ||
83 | ( | ||
84 | this->nodesOwn_()[nodei].velocityAbscissae() & mesh.Sf() | ||
85 | ); | ||
86 | |||
87 | surfaceScalarField phiNei | ||
88 | ( | ||
89 | this->nodesNei_()[nodei].velocityAbscissae() & mesh.Sf() | ||
90 | ); | ||
91 | |||
92 | forAll(moments_[0], celli) | ||
93 | { | ||
94 | const labelList& cell = mesh.cells()[celli]; | ||
95 | |||
96 | scalar num = this->nodes_[nodei].primaryWeight()[celli]; | ||
97 | scalar den = 0; | ||
98 | forAll(cell, facei) | ||
99 | { | ||
100 | if (cell[facei] < mesh.nInternalFaces()) | ||
101 | { | ||
102 | if (own[cell[facei]] == celli) | ||
103 | { | ||
104 | den += | ||
105 | this->nodesOwn_()[nodei].primaryWeight()[cell[facei]] | ||
106 | *max(phiOwn[cell[facei]], 0.0); | ||
107 | } | ||
108 | else if (nei[cell[facei]] == celli) | ||
109 | { | ||
110 | den -= | ||
111 | this->nodesNei_()[nodei].primaryWeight()[cell[facei]] | ||
112 | *min(phiNei[cell[facei]], 0.0); | ||
113 | } | ||
114 | } | ||
115 | if (num > 1e-6) | ||
116 | { | ||
117 | den = max(den, small); | ||
118 | maxCoNum[celli] = | ||
119 | min | ||
120 | ( | ||
121 | maxCoNum[celli], | ||
122 | num*mesh.V()[celli] | ||
123 | /(den*mesh.time().deltaTValue()) | ||
124 | ); | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | return gMin(maxCoNum); | ||
130 | } | ||
131 | |||
132 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/VikasQuasiSecondOrderVelocityAdvection/VikasQuasiSecondOrderVelocityAdvection.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.H (similarity 67%) (mode: 100644) (index 72a323d..d1eba71) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::noAdvection | ||
25 | Foam::VikasQuasiSecondOrder | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Empty scheme for cases without moment advection. | ||
28 | Quasi second order velocity moment advection with kinetic scheme. | ||
29 | Weights use a Minmod limiter and velocities use upwinding | ||
29 | 30 | ||
30 | 31 | SourceFiles | SourceFiles |
31 | noUnivariateAdvection.C | ||
32 | VikasQuasiSecondOrderVelocityAdvection.C | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef noUnivariateAdvection_H | ||
36 | #define noUnivariateAdvection_H | ||
36 | #ifndef VikasQuasiSecondOrderVelocityAdvection_H | ||
37 | #define VikasQuasiSecondOrderVelocityAdvection_H | ||
37 | 38 | ||
38 | #include "univariateMomentAdvection.H" | ||
39 | #include "firstOrderKineticVelocityAdvection.H" | ||
39 | 40 | ||
40 | 41 | ||
41 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
42 | 43 | ||
43 | 44 | namespace Foam | namespace Foam |
44 | 45 | { | { |
45 | namespace univariateAdvection | ||
46 | namespace velocityAdvection | ||
46 | 47 | { | { |
47 | 48 | ||
48 | 49 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
49 | Class noAdvection Declaration | ||
50 | Class VikasQuasiSecondOrder Declaration | ||
50 | 51 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
51 | 52 | ||
52 | class noAdvection | ||
53 | class VikasQuasiSecondOrder | ||
53 | 54 | : | : |
54 | public univariateMomentAdvection | ||
55 | public firstOrderKinetic | ||
55 | 56 | { | { |
57 | // Private data | ||
58 | |||
59 | //- Flux moment inversion method | ||
60 | // autoPtr<hyperbolicFieldMomentInversion> momentFieldInverter_; | ||
61 | |||
62 | |||
63 | protected: | ||
64 | |||
65 | // Protected member functions | ||
66 | |||
67 | // Interpolate weights and abscissae | ||
68 | void interpolateNodes(); | ||
69 | |||
70 | |||
56 | 71 | public: | public: |
57 | 72 | ||
58 | 73 | //- Runtime type information | //- Runtime type information |
59 | TypeName("noAdvection"); | ||
74 | TypeName("Vikas"); | ||
60 | 75 | ||
61 | 76 | ||
62 | 77 | // Constructors | // Constructors |
63 | 78 | ||
64 | //- Construct from univariateMomentSet | ||
65 | noAdvection | ||
79 | //- Construct from velocityMomentSet | ||
80 | VikasQuasiSecondOrder | ||
66 | 81 | ( | ( |
67 | 82 | const dictionary& dict, | const dictionary& dict, |
68 | const univariateQuadratureApproximation& quadrature, | ||
69 | const surfaceScalarField& phi, | ||
83 | const velocityQuadratureApproximation& quadrature, | ||
70 | 84 | const word& support | const word& support |
71 | 85 | ); | ); |
72 | 86 | ||
73 | 87 | ||
74 | 88 | //- Destructor | //- Destructor |
75 | virtual ~noAdvection(); | ||
89 | virtual ~VikasQuasiSecondOrder(); | ||
76 | 90 | ||
77 | 91 | ||
78 | 92 | // Public member functions | // Public member functions |
79 | 93 | ||
80 | 94 | //- Return the maximum Courant number ensuring moment realizability | //- Return the maximum Courant number ensuring moment realizability |
81 | 95 | virtual scalar realizableCo() const; | virtual scalar realizableCo() const; |
82 | |||
83 | //- Update moment advection | ||
84 | virtual void update(); | ||
85 | 96 | }; | }; |
86 | 97 | ||
87 | 98 | ||
88 | 99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
89 | 100 | ||
90 | } // End namespace univariateAdvection | ||
101 | } // End namespace velocityAdvection | ||
91 | 102 | } // End namespace Foam | } // End namespace Foam |
92 | 103 | ||
93 | 104 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/firstOrderKineticVelocityAdvection/firstOrderKineticVelocityAdvection.C changed (mode: 100644) (index e376a4f..fc3afd5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | 26 | #include "firstOrderKineticVelocityAdvection.H" | #include "firstOrderKineticVelocityAdvection.H" |
27 | #include "wallFvPatch.H" | ||
28 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
29 | 28 | ||
30 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
... | ... | Foam::velocityAdvection::firstOrderKinetic::firstOrderKinetic | |
54 | 53 | ) | ) |
55 | 54 | : | : |
56 | 55 | velocityMomentAdvection(dict, quadrature, support), | velocityMomentAdvection(dict, quadrature, support), |
57 | nodes_(quadrature.nodes()), | ||
58 | nodesNei_(), | ||
59 | nodesOwn_() | ||
56 | weightScheme_("upwind"), | ||
57 | scalarAbscissaeScheme_("upwind"), | ||
58 | velocityAbscissaeScheme_("upwind") | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::velocityAdvection::firstOrderKinetic::~firstOrderKinetic() | ||
65 | {} | ||
66 | |||
67 | |||
68 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
69 | |||
70 | void Foam::velocityAdvection::firstOrderKinetic::interpolateNodes() | ||
60 | 71 | { | { |
61 | nodesNei_ = autoPtr<PtrList<surfaceVectorNode> > | ||
62 | ( | ||
63 | new PtrList<surfaceVectorNode>(nodes_.size()) | ||
64 | ); | ||
72 | IStringStream weightOwnLimiter(weightScheme_); | ||
73 | IStringStream scalarAbscissaeOwnLimiter(scalarAbscissaeScheme_); | ||
74 | IStringStream velocityAbscissaeOwnLimiter(velocityAbscissaeScheme_); | ||
65 | 75 | ||
66 | nodesOwn_ = autoPtr<PtrList<surfaceVectorNode> > | ||
76 | tmp<surfaceInterpolationScheme<scalar>> weightOwnScheme | ||
67 | 77 | ( | ( |
68 | new PtrList<surfaceVectorNode>(nodes_.size()) | ||
78 | fvc::scheme<scalar>(own_, weightOwnLimiter) | ||
69 | 79 | ); | ); |
70 | 80 | ||
71 | PtrList<surfaceVectorNode>& nodesNei = nodesNei_(); | ||
72 | PtrList<surfaceVectorNode>& nodesOwn = nodesOwn_(); | ||
73 | |||
74 | // Populating nodes and interpolated nodes | ||
75 | forAll(nodes_, nodei) | ||
76 | { | ||
77 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
78 | nodesNei.set | ||
81 | tmp<surfaceInterpolationScheme<scalar>> scalarAbscissaeOwnScheme | ||
82 | ( | ||
83 | fvc::scheme<scalar> | ||
79 | 84 | ( | ( |
80 | nodei, | ||
81 | new surfaceVectorNode | ||
82 | ( | ||
83 | "nodeNei" + mappedList<scalar>::listToWord(nodeIndex), | ||
84 | name_, | ||
85 | moments_[0].mesh(), | ||
86 | moments_[0].dimensions(), | ||
87 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
88 | false | ||
89 | ) | ||
90 | ); | ||
85 | own_, | ||
86 | scalarAbscissaeOwnLimiter | ||
87 | ) | ||
88 | ); | ||
91 | 89 | ||
92 | nodesOwn.set | ||
90 | tmp<surfaceInterpolationScheme<vector>> velocityAbscissaeOwnScheme | ||
91 | ( | ||
92 | fvc::scheme<vector> | ||
93 | 93 | ( | ( |
94 | nodei, | ||
95 | new surfaceVectorNode | ||
96 | ( | ||
97 | "nodeOwn" + mappedList<scalar>::listToWord(nodeIndex), | ||
98 | name_, | ||
99 | moments_[0].mesh(), | ||
100 | moments_[0].dimensions(), | ||
101 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
102 | false | ||
103 | ) | ||
104 | ); | ||
105 | } | ||
106 | } | ||
107 | |||
94 | own_, | ||
95 | velocityAbscissaeOwnLimiter | ||
96 | ) | ||
97 | ); | ||
108 | 98 | ||
109 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
99 | IStringStream weightNeiLimiter(weightScheme_); | ||
100 | IStringStream scalarAbscissaeNeiLimiter(scalarAbscissaeScheme_); | ||
101 | IStringStream velocityAbscissaeNeiLimiter(velocityAbscissaeScheme_); | ||
110 | 102 | ||
111 | Foam::velocityAdvection::firstOrderKinetic::~firstOrderKinetic() | ||
112 | {} | ||
103 | tmp<surfaceInterpolationScheme<scalar>> weightNeiScheme | ||
104 | ( | ||
105 | fvc::scheme<scalar>(nei_, weightNeiLimiter) | ||
106 | ); | ||
113 | 107 | ||
108 | tmp<surfaceInterpolationScheme<scalar>> scalarAbscissaeNeiScheme | ||
109 | ( | ||
110 | fvc::scheme<scalar> | ||
111 | ( | ||
112 | nei_, | ||
113 | scalarAbscissaeNeiLimiter | ||
114 | ) | ||
115 | ); | ||
114 | 116 | ||
115 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
117 | tmp<surfaceInterpolationScheme<vector>> velocityAbscissaeNeiScheme | ||
118 | ( | ||
119 | fvc::scheme<vector> | ||
120 | ( | ||
121 | nei_, | ||
122 | velocityAbscissaeNeiLimiter | ||
123 | ) | ||
124 | ); | ||
116 | 125 | ||
117 | void Foam::velocityAdvection::firstOrderKinetic::interpolateNodes() | ||
118 | { | ||
119 | PtrList<surfaceVectorNode>& nodesNei = nodesNei_(); | ||
120 | PtrList<surfaceVectorNode>& nodesOwn = nodesOwn_(); | ||
126 | PtrList<surfaceVelocityNode>& nodesNei = nodesNei_(); | ||
127 | PtrList<surfaceVelocityNode>& nodesOwn = nodesOwn_(); | ||
121 | 128 | ||
122 | 129 | forAll(nodes_, nodei) | forAll(nodes_, nodei) |
123 | 130 | { | { |
124 | const volVectorNode& node(nodes_[nodei]); | ||
125 | surfaceVectorNode& nodeNei(nodesNei[nodei]); | ||
126 | surfaceVectorNode& nodeOwn(nodesOwn[nodei]); | ||
131 | const volVelocityNode& node(nodes_[nodei]); | ||
132 | surfaceVelocityNode& nodeNei(nodesNei[nodei]); | ||
133 | surfaceVelocityNode& nodeOwn(nodesOwn[nodei]); | ||
127 | 134 | ||
128 | 135 | nodeOwn.primaryWeight() = | nodeOwn.primaryWeight() = |
129 | fvc::interpolate(node.primaryWeight(), own_, "reconstruct(weight)"); | ||
136 | weightOwnScheme().interpolate(node.primaryWeight()); | ||
130 | 137 | ||
131 | nodeOwn.primaryAbscissa() = | ||
132 | fvc::interpolate | ||
133 | ( | ||
134 | node.primaryAbscissa(), | ||
135 | own_, | ||
136 | "reconstruct(U)" | ||
137 | ); | ||
138 | nodeOwn.velocityAbscissae() = | ||
139 | velocityAbscissaeOwnScheme().interpolate(node.velocityAbscissae()); | ||
138 | 140 | ||
139 | 141 | nodeNei.primaryWeight() = | nodeNei.primaryWeight() = |
140 | fvc::interpolate(node.primaryWeight(), nei_, "reconstruct(weight)"); | ||
142 | weightNeiScheme().interpolate(node.primaryWeight()); | ||
141 | 143 | ||
142 | nodeNei.primaryAbscissa() = | ||
143 | fvc::interpolate | ||
144 | ( | ||
145 | node.primaryAbscissa(), | ||
146 | nei_, | ||
147 | "reconstruct(U)" | ||
148 | ); | ||
144 | nodeNei.velocityAbscissae() = | ||
145 | velocityAbscissaeNeiScheme().interpolate(node.velocityAbscissae()); | ||
146 | |||
147 | forAll(node.primaryAbscissae(), cmpt) | ||
148 | { | ||
149 | nodeOwn.primaryAbscissae()[cmpt] = | ||
150 | scalarAbscissaeOwnScheme().interpolate | ||
151 | ( | ||
152 | node.primaryAbscissae()[cmpt] | ||
153 | ); | ||
154 | |||
155 | nodeNei.primaryAbscissae()[cmpt] = | ||
156 | scalarAbscissaeNeiScheme().interpolate | ||
157 | ( | ||
158 | node.primaryAbscissae()[cmpt] | ||
159 | ); | ||
160 | } | ||
149 | 161 | } | } |
150 | 162 | } | } |
151 | 163 | ||
152 | void Foam::velocityAdvection::firstOrderKinetic::updateWallCollisions() | ||
164 | |||
165 | Foam::scalar | ||
166 | Foam::velocityAdvection::firstOrderKinetic::realizableCo() const | ||
153 | 167 | { | { |
154 | const fvMesh& mesh = own_.mesh(); | ||
168 | const fvMesh& mesh = this->own_.mesh(); | ||
169 | surfaceVectorField Sf(mesh.Sf()); | ||
170 | |||
171 | scalarField maxCoNum(mesh.nCells(), 1.0); | ||
155 | 172 | ||
156 | forAll(mesh.boundary(), patchi) | ||
173 | forAll(this->nodes_, nodei) | ||
157 | 174 | { | { |
158 | const fvPatch& currPatch = mesh.boundary()[patchi]; | ||
159 | if (isA<wallFvPatch>(currPatch)) | ||
175 | |||
176 | surfaceScalarField phiOwn | ||
177 | ( | ||
178 | mag(this->nodesOwn_()[nodei].velocityAbscissae() & mesh.Sf()) | ||
179 | ); | ||
180 | |||
181 | surfaceScalarField phiNei | ||
182 | ( | ||
183 | mag(this->nodesNei_()[nodei].velocityAbscissae() & mesh.Sf()) | ||
184 | ); | ||
185 | |||
186 | forAll(moments_[0], celli) | ||
160 | 187 | { | { |
161 | const vectorField& bfSf(mesh.Sf().boundaryField()[patchi]); | ||
162 | vectorField bfNorm(bfSf/mag(bfSf)); | ||
188 | const labelList& cell = mesh.cells()[celli]; | ||
189 | |||
190 | scalar den = 0; | ||
163 | 191 | ||
164 | forAll(nodes_, nodei) | ||
192 | forAll(cell, facei) | ||
165 | 193 | { | { |
166 | const volVectorNode& node = nodes_[nodei]; | ||
167 | surfaceVectorNode& nodeNei(nodesNei_()[nodei]); | ||
168 | surfaceVectorNode& nodeOwn(nodesOwn_()[nodei]); | ||
169 | |||
170 | const volScalarField& weight = node.primaryWeight(); | ||
171 | surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | ||
172 | surfaceScalarField& weightNei = nodeNei.primaryWeight(); | ||
173 | const volVectorField& U = node.primaryAbscissa(); | ||
174 | surfaceVectorField& UOwn = nodeOwn.primaryAbscissa(); | ||
175 | surfaceVectorField& UNei = nodeNei.primaryAbscissa(); | ||
176 | |||
177 | scalarField& bfwOwn = weightOwn.boundaryFieldRef()[patchi]; | ||
178 | scalarField& bfwNei = weightNei.boundaryFieldRef()[patchi]; | ||
179 | vectorField& bfUOwn = UOwn.boundaryFieldRef()[patchi]; | ||
180 | vectorField& bfUNei = UNei.boundaryFieldRef()[patchi]; | ||
181 | |||
182 | forAll(currPatch, facei) | ||
194 | if (cell[facei] < mesh.nInternalFaces()) | ||
183 | 195 | { | { |
184 | label faceCelli = currPatch.faceCells()[facei]; | ||
196 | den += | ||
197 | max | ||
198 | ( | ||
199 | phiOwn[cell[facei]], | ||
200 | phiNei[cell[facei]] | ||
201 | ); | ||
202 | } | ||
185 | 203 | ||
186 | bfwOwn[facei] = weight[faceCelli]; | ||
187 | bfUOwn[facei] = U[faceCelli]; | ||
204 | den = max(den, small); | ||
188 | 205 | ||
189 | bfwNei[facei] = bfwOwn[facei]; | ||
190 | bfUNei[facei] = | ||
191 | bfUOwn[facei] | ||
192 | - (1.0 + this->ew_)*(bfUOwn[facei] & bfNorm[facei]) | ||
193 | *bfNorm[facei]; | ||
194 | } | ||
206 | maxCoNum[celli] = | ||
207 | min | ||
208 | ( | ||
209 | maxCoNum[celli], | ||
210 | mesh.V()[celli] | ||
211 | /(den*mesh.time().deltaTValue()) | ||
212 | ); | ||
195 | 213 | } | } |
196 | 214 | } | } |
197 | 215 | } | } |
198 | } | ||
199 | 216 | ||
200 | |||
201 | Foam::scalar | ||
202 | Foam::velocityAdvection::firstOrderKinetic::realizableCo() const | ||
203 | { | ||
204 | return 1.0; | ||
217 | return gMin(maxCoNum); | ||
205 | 218 | } | } |
206 | 219 | ||
207 | 220 | Foam::scalar Foam::velocityAdvection::firstOrderKinetic::CoNum() const | Foam::scalar Foam::velocityAdvection::firstOrderKinetic::CoNum() const |
... | ... | Foam::scalar Foam::velocityAdvection::firstOrderKinetic::CoNum() const | |
218 | 231 | ( | ( |
219 | 232 | fvc::surfaceSum | fvc::surfaceSum |
220 | 233 | ( | ( |
221 | mag(fvc::flux(nodes_[nodei].primaryAbscissa())) | ||
234 | mag(fvc::flux(nodes_[nodei].velocityAbscissae())) | ||
222 | 235 | )().primitiveField()/mesh.V().field() | )().primitiveField()/mesh.V().field() |
223 | 236 | )*mesh.time().deltaTValue() | )*mesh.time().deltaTValue() |
224 | 237 | ); | ); |
225 | 238 | } | } |
239 | |||
226 | 240 | return CoNum; | return CoNum; |
227 | 241 | } | } |
228 | 242 | ||
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update() | |
235 | 249 | interpolateNodes(); | interpolateNodes(); |
236 | 250 | ||
237 | 251 | // Set velocities at boundaries for rebounding | // Set velocities at boundaries for rebounding |
238 | updateWallCollisions(); | ||
252 | updateBoundaryConditions(); | ||
239 | 253 | ||
240 | 254 | // Zero moment flux | // Zero moment flux |
241 | 255 | forAll(divMoments_, divi) | forAll(divMoments_, divi) |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update() | |
249 | 263 | ); | ); |
250 | 264 | } | } |
251 | 265 | ||
266 | const labelList& scalarIndexes = nodes_[0].scalarIndexes(); | ||
267 | const labelList& velocityIndexes = nodes_[0].velocityIndexes(); | ||
268 | |||
252 | 269 | forAll(nodes_, nodei) | forAll(nodes_, nodei) |
253 | 270 | { | { |
254 | const surfaceVectorNode& nodeNei(nodesNei_()[nodei]); | ||
255 | const surfaceVectorNode& nodeOwn(nodesOwn_()[nodei]); | ||
271 | const surfaceVelocityNode& nodeNei(nodesNei_()[nodei]); | ||
272 | const surfaceVelocityNode& nodeOwn(nodesOwn_()[nodei]); | ||
256 | 273 | ||
257 | 274 | const surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | const surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); |
258 | 275 | const surfaceScalarField& weightNei = nodeNei.primaryWeight(); | const surfaceScalarField& weightNei = nodeNei.primaryWeight(); |
259 | const surfaceVectorField& UOwn = nodeOwn.primaryAbscissa(); | ||
260 | const surfaceVectorField& UNei = nodeNei.primaryAbscissa(); | ||
276 | |||
277 | const PtrList<surfaceScalarField>& scalarAbscissaeOwn = | ||
278 | nodeOwn.primaryAbscissae(); | ||
279 | |||
280 | const PtrList<surfaceScalarField>& scalarAbscissaeNei = | ||
281 | nodeNei.primaryAbscissae(); | ||
282 | |||
283 | const surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
284 | const surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
261 | 285 | ||
262 | 286 | surfaceScalarField phiOwn(UOwn & mesh.Sf()); | surfaceScalarField phiOwn(UOwn & mesh.Sf()); |
263 | 287 | surfaceScalarField phiNei(UNei & mesh.Sf()); | surfaceScalarField phiNei(UNei & mesh.Sf()); |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update() | |
269 | 293 | surfaceScalarField momentCmptOwn(weightOwn); | surfaceScalarField momentCmptOwn(weightOwn); |
270 | 294 | surfaceScalarField momentCmptNei(weightNei); | surfaceScalarField momentCmptNei(weightNei); |
271 | 295 | ||
272 | forAll(momentOrder, cmpti) | ||
296 | forAll(scalarIndexes, cmpti) | ||
273 | 297 | { | { |
274 | const label cmptMomentOrder = momentOrder[cmpti]; | ||
298 | const label cmpt = scalarIndexes[cmpti]; | ||
299 | const label cmptMomentOrder = momentOrder[cmpt]; | ||
275 | 300 | ||
276 | tmp<surfaceScalarField> abscissaOwnCmpt = | ||
277 | UOwn.component(cmpti); | ||
278 | tmp<surfaceScalarField> abscissaNeiCmpt = | ||
279 | UNei.component(cmpti); | ||
301 | if (cmptMomentOrder > 0) | ||
302 | { | ||
303 | const surfaceScalarField& abscissaOwnCmpt = | ||
304 | scalarAbscissaeOwn[cmpti]; | ||
305 | |||
306 | const surfaceScalarField& abscissaNeiCmpt = | ||
307 | scalarAbscissaeNei[cmpti]; | ||
308 | |||
309 | tmp<surfaceScalarField> mOwnPow = | ||
310 | momentCmptOwn | ||
311 | *pow | ||
312 | ( | ||
313 | abscissaOwnCmpt, | ||
314 | cmptMomentOrder | ||
315 | ); | ||
316 | |||
317 | tmp<surfaceScalarField> mNeiPow = | ||
318 | momentCmptNei | ||
319 | *pow | ||
320 | ( | ||
321 | abscissaNeiCmpt, | ||
322 | cmptMomentOrder | ||
323 | ); | ||
324 | |||
325 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
326 | momentCmptOwn == mOwnPow; | ||
327 | |||
328 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
329 | momentCmptNei == mNeiPow; | ||
330 | } | ||
331 | } | ||
280 | 332 | ||
281 | tmp<surfaceScalarField> mOwnPow = | ||
282 | momentCmptOwn | ||
283 | *pow | ||
284 | ( | ||
285 | abscissaOwnCmpt, | ||
286 | cmptMomentOrder | ||
287 | ); | ||
288 | tmp<surfaceScalarField> mNeiPow = | ||
289 | momentCmptNei | ||
290 | *pow | ||
291 | ( | ||
292 | abscissaNeiCmpt, | ||
293 | cmptMomentOrder | ||
294 | ); | ||
295 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
296 | momentCmptOwn == mOwnPow; | ||
333 | forAll(velocityIndexes, cmpti) | ||
334 | { | ||
335 | const label cmpt = velocityIndexes[cmpti]; | ||
336 | const label cmptMomentOrder = momentOrder[cmpt]; | ||
297 | 337 | ||
298 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
299 | momentCmptNei == mNeiPow; | ||
338 | if (cmptMomentOrder > 0) | ||
339 | { | ||
340 | tmp<surfaceScalarField> abscissaOwnCmpt = | ||
341 | UOwn.component(cmpti); | ||
342 | |||
343 | tmp<surfaceScalarField> abscissaNeiCmpt = | ||
344 | UNei.component(cmpti); | ||
345 | |||
346 | tmp<surfaceScalarField> mOwnPow = | ||
347 | momentCmptOwn | ||
348 | *pow | ||
349 | ( | ||
350 | abscissaOwnCmpt, | ||
351 | cmptMomentOrder | ||
352 | ); | ||
353 | |||
354 | tmp<surfaceScalarField> mNeiPow = | ||
355 | momentCmptNei | ||
356 | *pow | ||
357 | ( | ||
358 | abscissaNeiCmpt, | ||
359 | cmptMomentOrder | ||
360 | ); | ||
361 | |||
362 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
363 | momentCmptOwn == mOwnPow; | ||
364 | |||
365 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
366 | momentCmptNei == mNeiPow; | ||
367 | } | ||
300 | 368 | } | } |
301 | 369 | ||
302 | 370 | divMoments_[divi] += | divMoments_[divi] += |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update | |
323 | 391 | // Set velocities at boundaries for rebounding | // Set velocities at boundaries for rebounding |
324 | 392 | if (wallCollisions) | if (wallCollisions) |
325 | 393 | { | { |
326 | updateWallCollisions(); | ||
394 | updateBoundaryConditions(); | ||
327 | 395 | } | } |
328 | 396 | ||
329 | 397 | // Zero moment fluxes | // Zero moment fluxes |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update | |
338 | 406 | ); | ); |
339 | 407 | } | } |
340 | 408 | ||
409 | const labelList& scalarIndexes = nodes_[0].scalarIndexes(); | ||
410 | const labelList& velocityIndexes = nodes_[0].velocityIndexes(); | ||
411 | |||
341 | 412 | forAll(nodes_, nodei) | forAll(nodes_, nodei) |
342 | 413 | { | { |
343 | const surfaceVectorNode& nodeNei(nodesNei_()[nodei]); | ||
344 | const surfaceVectorNode& nodeOwn(nodesOwn_()[nodei]); | ||
414 | const surfaceVelocityNode& nodeNei(nodesNei_()[nodei]); | ||
415 | const surfaceVelocityNode& nodeOwn(nodesOwn_()[nodei]); | ||
345 | 416 | ||
346 | 417 | const surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | const surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); |
347 | 418 | const surfaceScalarField& weightNei = nodeNei.primaryWeight(); | const surfaceScalarField& weightNei = nodeNei.primaryWeight(); |
348 | const surfaceVectorField& abscissaOwn = nodeOwn.primaryAbscissa(); | ||
349 | const surfaceVectorField& abscissaNei = nodeNei.primaryAbscissa(); | ||
419 | |||
420 | const PtrList<surfaceScalarField>& scalarAbscissaeOwn = | ||
421 | nodeOwn.primaryAbscissae(); | ||
422 | |||
423 | const PtrList<surfaceScalarField>& scalarAbscissaeNei = | ||
424 | nodeNei.primaryAbscissae(); | ||
425 | |||
426 | const surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
427 | const surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
350 | 428 | ||
351 | 429 | forAll(divMoments_, divi) | forAll(divMoments_, divi) |
352 | 430 | { | { |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update | |
355 | 433 | surfaceScalarField momentCmptOwn(weightOwn); | surfaceScalarField momentCmptOwn(weightOwn); |
356 | 434 | surfaceScalarField momentCmptNei(weightNei); | surfaceScalarField momentCmptNei(weightNei); |
357 | 435 | ||
358 | forAll(momentOrder, cmpti) | ||
436 | forAll(scalarIndexes, cmpti) | ||
359 | 437 | { | { |
360 | const label cmptMomentOrder = momentOrder[cmpti]; | ||
438 | const label cmpt = scalarIndexes[cmpti]; | ||
439 | const label cmptMomentOrder = momentOrder[cmpt]; | ||
361 | 440 | ||
362 | tmp<surfaceScalarField> abscissaOwnCmpt = | ||
363 | abscissaOwn.component(cmpti); | ||
364 | tmp<surfaceScalarField> abscissaNeiCmpt = | ||
365 | abscissaNei.component(cmpti); | ||
441 | if (cmptMomentOrder > 0) | ||
442 | { | ||
443 | const surfaceScalarField& abscissaOwnCmpt = | ||
444 | scalarAbscissaeOwn[cmpti]; | ||
445 | |||
446 | const surfaceScalarField& abscissaNeiCmpt = | ||
447 | scalarAbscissaeNei[cmpti]; | ||
448 | |||
449 | tmp<surfaceScalarField> mOwnPow = | ||
450 | momentCmptOwn | ||
451 | *pow | ||
452 | ( | ||
453 | abscissaOwnCmpt, | ||
454 | cmptMomentOrder | ||
455 | ); | ||
456 | |||
457 | tmp<surfaceScalarField> mNeiPow = | ||
458 | momentCmptNei | ||
459 | *pow | ||
460 | ( | ||
461 | abscissaNeiCmpt, | ||
462 | cmptMomentOrder | ||
463 | ); | ||
464 | |||
465 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
466 | momentCmptOwn == mOwnPow; | ||
467 | |||
468 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
469 | momentCmptNei == mNeiPow; | ||
470 | } | ||
471 | } | ||
366 | 472 | ||
367 | tmp<surfaceScalarField> mOwnPow = | ||
368 | momentCmptOwn | ||
369 | *pow | ||
370 | ( | ||
371 | abscissaOwnCmpt, | ||
372 | cmptMomentOrder | ||
373 | ); | ||
374 | tmp<surfaceScalarField> mNeiPow = | ||
375 | momentCmptNei | ||
376 | *pow | ||
377 | ( | ||
378 | abscissaNeiCmpt, | ||
379 | cmptMomentOrder | ||
380 | ); | ||
381 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
382 | momentCmptOwn == mOwnPow; | ||
473 | forAll(velocityIndexes, cmpti) | ||
474 | { | ||
475 | const label cmpt = velocityIndexes[cmpti]; | ||
476 | const label cmptMomentOrder = momentOrder[cmpt]; | ||
383 | 477 | ||
384 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
385 | momentCmptNei == mNeiPow; | ||
478 | if (cmptMomentOrder > 0) | ||
479 | { | ||
480 | tmp<surfaceScalarField> abscissaOwnCmpt = | ||
481 | UOwn.component(cmpti); | ||
482 | |||
483 | tmp<surfaceScalarField> abscissaNeiCmpt = | ||
484 | UNei.component(cmpti); | ||
485 | |||
486 | tmp<surfaceScalarField> mOwnPow = | ||
487 | momentCmptOwn | ||
488 | *pow | ||
489 | ( | ||
490 | abscissaOwnCmpt, | ||
491 | cmptMomentOrder | ||
492 | ); | ||
493 | |||
494 | tmp<surfaceScalarField> mNeiPow = | ||
495 | momentCmptNei | ||
496 | *pow | ||
497 | ( | ||
498 | abscissaNeiCmpt, | ||
499 | cmptMomentOrder | ||
500 | ); | ||
501 | |||
502 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
503 | momentCmptOwn == mOwnPow; | ||
504 | |||
505 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
506 | momentCmptNei == mNeiPow; | ||
507 | } | ||
386 | 508 | } | } |
387 | 509 | ||
388 | 510 | divMoments_[divi] += | divMoments_[divi] += |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update | |
407 | 529 | // Interplate weights and abscissae | // Interplate weights and abscissae |
408 | 530 | interpolateNodes(); | interpolateNodes(); |
409 | 531 | ||
532 | IStringStream velocityAbscissaeOwnLimiter(velocityAbscissaeScheme_); | ||
533 | |||
534 | tmp<surfaceInterpolationScheme<vector>> velocityAbscissaeOwnScheme | ||
535 | ( | ||
536 | fvc::scheme<vector> | ||
537 | ( | ||
538 | own_, | ||
539 | velocityAbscissaeOwnLimiter | ||
540 | ) | ||
541 | ); | ||
542 | |||
543 | IStringStream velocityAbscissaeNeiLimiter(velocityAbscissaeScheme_); | ||
544 | |||
545 | tmp<surfaceInterpolationScheme<vector>> velocityAbscissaeNeiScheme | ||
546 | ( | ||
547 | fvc::scheme<vector> | ||
548 | ( | ||
549 | nei_, | ||
550 | velocityAbscissaeNeiLimiter | ||
551 | ) | ||
552 | ); | ||
553 | |||
410 | 554 | // Set velocities at boundaries for rebounding | // Set velocities at boundaries for rebounding |
411 | 555 | if (wallCollisions) | if (wallCollisions) |
412 | 556 | { | { |
413 | updateWallCollisions(); | ||
557 | updateBoundaryConditions(); | ||
414 | 558 | } | } |
415 | 559 | ||
416 | 560 | // Zero moment fluxes | // Zero moment fluxes |
... | ... | void Foam::velocityAdvection::firstOrderKinetic::update | |
425 | 569 | ); | ); |
426 | 570 | } | } |
427 | 571 | ||
572 | const labelList& scalarIndexes = nodes_[0].scalarIndexes(); | ||
573 | const labelList& velocityIndexes = nodes_[0].velocityIndexes(); | ||
574 | |||
428 | 575 | forAll(nodes_, nodei) | forAll(nodes_, nodei) |
429 | 576 | { | { |
430 | // const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
431 | |||
432 | const surfaceVectorNode& nodeNei(nodesNei_()[nodei]); | ||
433 | const surfaceVectorNode& nodeOwn(nodesOwn_()[nodei]); | ||
577 | const surfaceVelocityNode& nodeNei(nodesNei_()[nodei]); | ||
578 | const surfaceVelocityNode& nodeOwn(nodesOwn_()[nodei]); | ||
434 | 579 | ||
435 | 580 | const surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | const surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); |
436 | 581 | const surfaceScalarField& weightNei = nodeNei.primaryWeight(); | const surfaceScalarField& weightNei = nodeNei.primaryWeight(); |
437 | const surfaceVectorField& abscissaOwn = nodeOwn.primaryAbscissa(); | ||
438 | const surfaceVectorField& abscissaNei = nodeNei.primaryAbscissa(); | ||
439 | 582 | ||
440 | surfaceVectorField UOwn | ||
583 | const PtrList<surfaceScalarField>& scalarAbscissaeOwn = | ||
584 | nodeOwn.primaryAbscissae(); | ||
585 | |||
586 | const PtrList<surfaceScalarField>& scalarAbscissaeNei = | ||
587 | nodeNei.primaryAbscissae(); | ||
588 | |||
589 | const surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
590 | const surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
591 | |||
592 | surfaceVectorField VOwn | ||
441 | 593 | ( | ( |
442 | fvc::interpolate(Us[nodei], own_, "reconstruct(U)") | ||
594 | velocityAbscissaeOwnScheme().interpolate(Us[nodei]) | ||
443 | 595 | ); | ); |
444 | surfaceVectorField UNei | ||
596 | |||
597 | surfaceVectorField VNei | ||
445 | 598 | ( | ( |
446 | fvc::interpolate(Us[nodei], nei_, "reconstruct(U)") | ||
599 | velocityAbscissaeNeiScheme().interpolate(Us[nodei]) | ||
447 | 600 | ); | ); |
448 | 601 | ||
449 | surfaceScalarField phiOwn(UOwn & mesh.Sf()); | ||
450 | surfaceScalarField phiNei(UNei & mesh.Sf()); | ||
602 | surfaceScalarField phiOwn(VOwn & mesh.Sf()); | ||
603 | surfaceScalarField phiNei(VNei & mesh.Sf()); | ||
451 | 604 | ||
452 | 605 | forAll(divMoments_, divi) | forAll(divMoments_, divi) |
453 | 606 | { | { |
454 | 607 | const labelList& momentOrder = momentOrders_[divi]; | const labelList& momentOrder = momentOrders_[divi]; |
455 | // Calculate size moment flux | ||
608 | |||
456 | 609 | surfaceScalarField momentCmptOwn(weightOwn); | surfaceScalarField momentCmptOwn(weightOwn); |
457 | 610 | surfaceScalarField momentCmptNei(weightNei); | surfaceScalarField momentCmptNei(weightNei); |
458 | 611 | ||
459 | forAll(momentOrder, cmpti) | ||
612 | forAll(scalarIndexes, cmpti) | ||
460 | 613 | { | { |
461 | const label cmptMomentOrder = momentOrder[cmpti]; | ||
614 | const label cmpt = scalarIndexes[cmpti]; | ||
615 | const label cmptMomentOrder = momentOrder[cmpt]; | ||
462 | 616 | ||
463 | tmp<surfaceScalarField> abscissaOwnCmpt = | ||
464 | abscissaOwn.component(cmpti); | ||
465 | tmp<surfaceScalarField> abscissaNeiCmpt = | ||
466 | abscissaNei.component(cmpti); | ||
617 | if (cmptMomentOrder > 0) | ||
618 | { | ||
619 | const surfaceScalarField& abscissaOwnCmpt = | ||
620 | scalarAbscissaeOwn[cmpti]; | ||
621 | |||
622 | const surfaceScalarField& abscissaNeiCmpt = | ||
623 | scalarAbscissaeNei[cmpti]; | ||
624 | |||
625 | tmp<surfaceScalarField> mOwnPow = | ||
626 | momentCmptOwn | ||
627 | *pow | ||
628 | ( | ||
629 | abscissaOwnCmpt, | ||
630 | cmptMomentOrder | ||
631 | ); | ||
632 | |||
633 | tmp<surfaceScalarField> mNeiPow = | ||
634 | momentCmptNei | ||
635 | *pow | ||
636 | ( | ||
637 | abscissaNeiCmpt, | ||
638 | cmptMomentOrder | ||
639 | ); | ||
640 | |||
641 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
642 | momentCmptOwn == mOwnPow; | ||
643 | |||
644 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
645 | momentCmptNei == mNeiPow; | ||
646 | } | ||
647 | } | ||
467 | 648 | ||
468 | tmp<surfaceScalarField> mOwnPow = | ||
469 | momentCmptOwn | ||
470 | *pow | ||
471 | ( | ||
472 | abscissaOwnCmpt, | ||
473 | cmptMomentOrder | ||
474 | ); | ||
475 | tmp<surfaceScalarField> mNeiPow = | ||
476 | momentCmptNei | ||
477 | *pow | ||
478 | ( | ||
479 | abscissaNeiCmpt, | ||
480 | cmptMomentOrder | ||
481 | ); | ||
482 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
483 | momentCmptOwn == mOwnPow; | ||
649 | forAll(velocityIndexes, cmpti) | ||
650 | { | ||
651 | const label cmpt = velocityIndexes[cmpti]; | ||
652 | const label cmptMomentOrder = momentOrder[cmpt]; | ||
484 | 653 | ||
485 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
486 | momentCmptNei == mNeiPow; | ||
654 | if (cmptMomentOrder > 0) | ||
655 | { | ||
656 | tmp<surfaceScalarField> abscissaOwnCmpt = | ||
657 | UOwn.component(cmpti); | ||
658 | |||
659 | tmp<surfaceScalarField> abscissaNeiCmpt = | ||
660 | UNei.component(cmpti); | ||
661 | |||
662 | tmp<surfaceScalarField> mOwnPow = | ||
663 | momentCmptOwn | ||
664 | *pow | ||
665 | ( | ||
666 | abscissaOwnCmpt, | ||
667 | cmptMomentOrder | ||
668 | ); | ||
669 | |||
670 | tmp<surfaceScalarField> mNeiPow = | ||
671 | momentCmptNei | ||
672 | *pow | ||
673 | ( | ||
674 | abscissaNeiCmpt, | ||
675 | cmptMomentOrder | ||
676 | ); | ||
677 | |||
678 | momentCmptOwn.dimensions().reset(mOwnPow().dimensions()); | ||
679 | momentCmptOwn == mOwnPow; | ||
680 | |||
681 | momentCmptNei.dimensions().reset(mNeiPow().dimensions()); | ||
682 | momentCmptNei == mNeiPow; | ||
683 | } | ||
487 | 684 | } | } |
488 | 685 | ||
489 | 686 | divMoments_[divi] += | divMoments_[divi] += |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/firstOrderKineticVelocityAdvection/firstOrderKineticVelocityAdvection.H changed (mode: 100644) (index ed093f3..5e8e89f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class firstOrderKinetic | |
53 | 53 | : | : |
54 | 54 | public velocityMomentAdvection | public velocityMomentAdvection |
55 | 55 | { | { |
56 | // Private data | ||
57 | |||
58 | //- List of quadrature nodes used for moment advection | ||
59 | const PtrList<volVectorNode>& nodes_; | ||
60 | |||
61 | //- List of interpolated nodes (neighbour) | ||
62 | autoPtr<PtrList<surfaceVectorNode>> nodesNei_; | ||
63 | |||
64 | //- List of interpolated nodes (owner) | ||
65 | autoPtr<PtrList<surfaceVectorNode>> nodesOwn_; | ||
66 | |||
67 | //- Flux moment inversion method | ||
68 | // autoPtr<hyperbolicFieldMomentInversion> momentFieldInverter_; | ||
56 | protected: | ||
57 | // Protected data | ||
69 | 58 | ||
59 | //- Interpolation schemes | ||
60 | word weightScheme_; | ||
61 | word scalarAbscissaeScheme_; | ||
62 | word velocityAbscissaeScheme_; | ||
70 | 63 | ||
71 | protected: | ||
72 | 64 | ||
73 | 65 | // Protected member functions | // Protected member functions |
74 | 66 | ||
75 | 67 | // Interpolate weights and abscissae | // Interpolate weights and abscissae |
76 | 68 | void interpolateNodes(); | void interpolateNodes(); |
77 | 69 | ||
78 | //- Compute collisions with walls | ||
79 | void updateWallCollisions(); | ||
80 | 70 | ||
81 | 71 | ||
82 | 72 | public: | public: |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/calculated/calculatedFvQuadraturePatch.C copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.C (similarity 70%) (mode: 100644) (index 2e1c456..a605b61) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noUnivariateAdvection.H" | ||
26 | #include "calculatedFvQuadraturePatch.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 30 | ||
31 | 31 | namespace Foam | namespace Foam |
32 | 32 | { | { |
33 | namespace univariateAdvection | ||
34 | { | ||
35 | defineTypeNameAndDebug(noAdvection, 0); | ||
33 | defineTypeNameAndDebug(calculatedFvQuadraturePatch, 0); | ||
36 | 34 | ||
37 | 35 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
38 | 36 | ( | ( |
39 | univariateMomentAdvection, | ||
40 | noAdvection, | ||
37 | fvQuadraturePatch, | ||
38 | calculatedFvQuadraturePatch, | ||
41 | 39 | dictionary | dictionary |
42 | 40 | ); | ); |
43 | 41 | } | } |
44 | } | ||
45 | 42 | ||
46 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
47 | 44 | ||
48 | Foam::univariateAdvection::noAdvection::noAdvection | ||
45 | Foam::calculatedFvQuadraturePatch::calculatedFvQuadraturePatch | ||
49 | 46 | ( | ( |
47 | const fvPatch& patch, | ||
50 | 48 | const dictionary& dict, | const dictionary& dict, |
51 | const univariateQuadratureApproximation& quadrature, | ||
52 | const surfaceScalarField& phi, | ||
53 | const word& support | ||
49 | const velocityQuadratureApproximation& quadrature, | ||
50 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
51 | PtrList<surfaceVelocityNode>& nodesNei | ||
54 | 52 | ) | ) |
55 | 53 | : | : |
56 | univariateMomentAdvection(dict, quadrature, phi, support) | ||
54 | fvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei) | ||
57 | 55 | {} | {} |
58 | 56 | ||
59 | 57 | ||
60 | 58 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
61 | 59 | ||
62 | Foam::univariateAdvection::noAdvection::~noAdvection() | ||
60 | Foam::calculatedFvQuadraturePatch::~calculatedFvQuadraturePatch() | ||
63 | 61 | {} | {} |
64 | 62 | ||
65 | 63 | ||
66 | 64 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
67 | 65 | ||
68 | Foam::scalar Foam::univariateAdvection::noAdvection::realizableCo() const | ||
69 | { | ||
70 | return scalar(1); | ||
71 | } | ||
66 | void Foam::calculatedFvQuadraturePatch::update() | ||
67 | {} | ||
72 | 68 | ||
73 | void Foam::univariateAdvection::noAdvection::update() | ||
74 | { | ||
75 | return; | ||
76 | } | ||
77 | 69 | ||
78 | 70 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/calculated/calculatedFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 67%) (mode: 100644) (index 63c8f61..b3f5a7e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::mixingModels::noMixing | ||
25 | Foam::calculatedFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | calculatedFvQuadraturePatch.C | ||
32 | calculatedFvQuadraturePatchI.H | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
36 | #ifndef calculatedFvQuadraturePatch_H | ||
37 | #define calculatedFvQuadraturePatch_H | ||
37 | 38 | ||
38 | #include "mixingModel.H" | ||
39 | #include "fvQuadraturePatch.H" | ||
39 | 40 | ||
40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 42 | ||
42 | 43 | namespace Foam | namespace Foam |
43 | 44 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | |||
47 | 45 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
46 | Class calculatedFvQuadraturePatch Declaration | ||
49 | 47 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 48 | ||
51 | class noMixing | ||
49 | class calculatedFvQuadraturePatch | ||
52 | 50 | : | : |
53 | public mixingModel | ||
51 | public fvQuadraturePatch | ||
54 | 52 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 53 | public: | public: |
62 | 54 | ||
63 | 55 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
56 | TypeName("calculated"); | ||
65 | 57 | ||
66 | 58 | ||
67 | 59 | // Constructors | // Constructors |
68 | 60 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
61 | //- Construct from velocityMomentSet | ||
62 | calculatedFvQuadraturePatch | ||
71 | 63 | ( | ( |
72 | const word& name, | ||
64 | const fvPatch& patch, | ||
73 | 65 | const dictionary& dict, | const dictionary& dict, |
74 | const surfaceScalarField& phi | ||
66 | const velocityQuadratureApproximation& quadrature, | ||
67 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
68 | PtrList<surfaceVelocityNode>& nodesNei | ||
75 | 69 | ); | ); |
76 | 70 | ||
77 | 71 | ||
78 | 72 | //- Destructor | //- Destructor |
79 | virtual ~noMixing(); | ||
73 | virtual ~calculatedFvQuadraturePatch(); | ||
80 | 74 | ||
81 | 75 | // Member Functions | // Member Functions |
82 | 76 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
77 | //- Update boundary flux | ||
78 | virtual void update(); | ||
85 | 79 | ||
86 | //- Solve mixing model | ||
87 | void solve(); | ||
88 | 80 | }; | }; |
89 | 81 | ||
90 | 82 | ||
91 | 83 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
92 | 84 | ||
93 | } // End namespace mixingModels | ||
94 | 85 | } // End namespace Foam | } // End namespace Foam |
95 | 86 | ||
96 | 87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/fixedTemperature/fixedTemperatureFvQuadraturePatch.C added (mode: 100644) (index 0000000..315ecb6) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2018-2019 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 "fixedTemperatureFvQuadraturePatch.H" | ||
27 | #include "wallFvPatch.H" | ||
28 | #include "addToRunTimeSelectionTable.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | defineTypeNameAndDebug(fixedTemperatureFvQuadraturePatch, 0); | ||
35 | |||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | fvQuadraturePatch, | ||
39 | fixedTemperatureFvQuadraturePatch, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | |||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
46 | |||
47 | Foam::fixedTemperatureFvQuadraturePatch::fixedTemperatureFvQuadraturePatch | ||
48 | ( | ||
49 | const fvPatch& patch, | ||
50 | const dictionary& dict, | ||
51 | const velocityQuadratureApproximation& quadrature, | ||
52 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
53 | PtrList<surfaceVelocityNode>& nodesNei | ||
54 | ) | ||
55 | : | ||
56 | fvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei), | ||
57 | wallTemperature_("T", dict, patch.size()), | ||
58 | nVelocityCmpts_(quadrature_.nodes()[0].velocityIndexes().size()), | ||
59 | order000_(quadrature.momentOrders()[0].size(), 0), | ||
60 | order100_(order000_), | ||
61 | order010_(order000_), | ||
62 | order001_(order000_), | ||
63 | order200_(order000_), | ||
64 | order020_(order000_), | ||
65 | order002_(order000_) | ||
66 | { | ||
67 | if (!isA<wallFvPatch>(patch_)) | ||
68 | { | ||
69 | FatalErrorInFunction | ||
70 | << "Fixed temperature requires a wall type boundary, " | ||
71 | << "but " << patch_.type() << " was specified." | ||
72 | << abort(FatalError); | ||
73 | } | ||
74 | |||
75 | labelList velocityIndexes = quadrature.nodes()[0].velocityIndexes(); | ||
76 | |||
77 | order100_[velocityIndexes[0]] = 1; | ||
78 | order200_[velocityIndexes[0]] = 2; | ||
79 | |||
80 | if (nVelocityCmpts_ > 1) | ||
81 | { | ||
82 | order010_[velocityIndexes[1]] = 1; | ||
83 | order020_[velocityIndexes[1]] = 2; | ||
84 | } | ||
85 | |||
86 | if (nVelocityCmpts_ > 2) | ||
87 | { | ||
88 | order001_[velocityIndexes[2]] = 1; | ||
89 | order002_[velocityIndexes[2]] = 2; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | |||
94 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
95 | |||
96 | Foam::fixedTemperatureFvQuadraturePatch::~fixedTemperatureFvQuadraturePatch() | ||
97 | {} | ||
98 | |||
99 | |||
100 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
101 | |||
102 | void Foam::fixedTemperatureFvQuadraturePatch::update() | ||
103 | { | ||
104 | if (!patch_.size()) | ||
105 | { | ||
106 | return; | ||
107 | } | ||
108 | |||
109 | const fvMesh& mesh = nodesOwn_[0].primaryWeight().mesh(); | ||
110 | |||
111 | const volVelocityMomentFieldSet& moments = quadrature_.moments(); | ||
112 | |||
113 | const vectorField& bfSf(mesh.Sf().boundaryField()[patchi_]); | ||
114 | vectorField bfNorm(bfSf/mag(bfSf)); | ||
115 | |||
116 | scalarField m0(max(moments(0).boundaryField()[patchi_], 1e-8)); | ||
117 | vectorField T(bfSf.size(), Zero); | ||
118 | |||
119 | T.replace | ||
120 | ( | ||
121 | 0, | ||
122 | max | ||
123 | ( | ||
124 | moments(order200_).boundaryField()[patchi_]/m0 | ||
125 | - sqr(moments(order100_).boundaryField()[patchi_]/m0), | ||
126 | 1e-8 | ||
127 | ) | ||
128 | ); | ||
129 | |||
130 | if (nVelocityCmpts_ > 1) | ||
131 | { | ||
132 | T.replace | ||
133 | ( | ||
134 | 1, | ||
135 | max | ||
136 | ( | ||
137 | moments(order020_).boundaryField()[patchi_]/m0 | ||
138 | - sqr(moments(order010_).boundaryField()[patchi_]/m0), | ||
139 | 1e-8 | ||
140 | ) | ||
141 | ); | ||
142 | } | ||
143 | |||
144 | if (nVelocityCmpts_ > 2) | ||
145 | { | ||
146 | T.replace | ||
147 | ( | ||
148 | 2, | ||
149 | max | ||
150 | ( | ||
151 | moments(order002_).boundaryField()[patchi_]/m0 | ||
152 | - sqr(moments(order001_).boundaryField()[patchi_]/m0), | ||
153 | 1e-8 | ||
154 | ) | ||
155 | ); | ||
156 | } | ||
157 | |||
158 | scalarField scale | ||
159 | ( | ||
160 | sqrt(wallTemperature_*scalar(nVelocityCmpts_) | ||
161 | /(T & vector(1.0, 1.0, 1.0))) | ||
162 | ); | ||
163 | |||
164 | scalarField Gin(bfSf.size(), 0.0); | ||
165 | scalarField Gout(bfSf.size(), 0.0); | ||
166 | |||
167 | const PtrList<volVelocityNode>& nodes = quadrature_.nodes(); | ||
168 | |||
169 | forAll(nodes, nodei) | ||
170 | { | ||
171 | const volVelocityNode& node = nodes[nodei]; | ||
172 | surfaceVelocityNode& nodeNei(nodesNei_[nodei]); | ||
173 | surfaceVelocityNode& nodeOwn(nodesOwn_[nodei]); | ||
174 | |||
175 | const volScalarField& weight = node.primaryWeight(); | ||
176 | surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | ||
177 | surfaceScalarField& weightNei = nodeNei.primaryWeight(); | ||
178 | const volVectorField& U = node.velocityAbscissae(); | ||
179 | surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
180 | surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
181 | |||
182 | scalarField& bfwOwn = weightOwn.boundaryFieldRef()[patchi_]; | ||
183 | scalarField& bfwNei = weightNei.boundaryFieldRef()[patchi_]; | ||
184 | vectorField& bfUOwn = UOwn.boundaryFieldRef()[patchi_]; | ||
185 | vectorField& bfUNei = UNei.boundaryFieldRef()[patchi_]; | ||
186 | |||
187 | bfwOwn = weight.boundaryField()[patchi_].patchInternalField(); | ||
188 | bfwNei = bfwOwn; | ||
189 | |||
190 | bfUOwn = U.boundaryField()[patchi_].patchInternalField(); | ||
191 | bfUNei = (bfUOwn - 2.0*(bfUOwn & bfNorm)*bfNorm)*scale; | ||
192 | |||
193 | Gin += max(0.0, bfUOwn & bfSf)*bfwOwn; | ||
194 | Gout -= min(0.0, bfUNei & bfSf)*bfwNei; | ||
195 | } | ||
196 | |||
197 | scalarField weightScale(Gin/(Gout + small)); | ||
198 | |||
199 | forAll(nodes, nodei) | ||
200 | { | ||
201 | nodesNei_[nodei].primaryWeight().boundaryFieldRef()[patchi_] *= | ||
202 | weightScale; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | |||
207 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/fixedTemperature/fixedTemperatureFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.H (similarity 60%) (mode: 100644) (index 86b83d5..6b165b3) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceModels::noPopulationBalance | ||
25 | Foam::fixedTemperatureFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the population balance model. | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noPopulationBalance.C | ||
31 | fixedTemperatureFvQuadraturePatch.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noPopulationBalance_H | ||
36 | #define noPopulationBalance_H | ||
35 | #ifndef fixedTemperatureFvQuadraturePatch_H | ||
36 | #define fixedTemperatureFvQuadraturePatch_H | ||
37 | 37 | ||
38 | #include "populationBalanceModel.H" | ||
38 | #include "fvQuadraturePatch.H" | ||
39 | 39 | ||
40 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 41 | ||
42 | 42 | namespace Foam | namespace Foam |
43 | 43 | { | { |
44 | namespace populationBalanceModels | ||
45 | { | ||
46 | |||
47 | 44 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noPopulationBalance Declaration | ||
45 | Class fixedTemperatureFvQuadraturePatch Declaration | ||
49 | 46 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 47 | ||
51 | class noPopulationBalance | ||
48 | class fixedTemperatureFvQuadraturePatch | ||
52 | 49 | : | : |
53 | public populationBalanceModel | ||
50 | public fvQuadraturePatch | ||
54 | 51 | { | { |
55 | 52 | // Private data | // Private data |
56 | 53 | ||
57 | //- Name of the noPopulationBalance | ||
58 | const word name_; | ||
54 | //- Fixed wall temperature | ||
55 | scalarField wallTemperature_; | ||
59 | 56 | ||
57 | //- Number of veloicity components | ||
58 | const label nVelocityCmpts_; | ||
59 | |||
60 | //- Moment orders | ||
61 | labelList order000_; | ||
62 | labelList order100_; | ||
63 | labelList order010_; | ||
64 | labelList order001_; | ||
65 | labelList order200_; | ||
66 | labelList order020_; | ||
67 | labelList order002_; | ||
60 | 68 | ||
61 | 69 | public: | public: |
62 | 70 | ||
63 | 71 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
72 | TypeName("fixedTemperature"); | ||
65 | 73 | ||
66 | 74 | ||
67 | 75 | // Constructors | // Constructors |
68 | 76 | ||
69 | //- Construct from components | ||
70 | noPopulationBalance | ||
77 | //- Construct from velocityMomentSet | ||
78 | fixedTemperatureFvQuadraturePatch | ||
71 | 79 | ( | ( |
72 | const word& name, | ||
80 | const fvPatch& patch, | ||
73 | 81 | const dictionary& dict, | const dictionary& dict, |
74 | const surfaceScalarField& phi | ||
82 | const velocityQuadratureApproximation& quadrature, | ||
83 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
84 | PtrList<surfaceVelocityNode>& nodesNei | ||
75 | 85 | ); | ); |
76 | 86 | ||
77 | 87 | ||
78 | 88 | //- Destructor | //- Destructor |
79 | virtual ~noPopulationBalance(); | ||
89 | virtual ~fixedTemperatureFvQuadraturePatch(); | ||
80 | 90 | ||
81 | 91 | // Member Functions | // Member Functions |
82 | 92 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | virtual scalar realizableCo() const; | ||
85 | |||
86 | //- Return the courant number based on abscissae | ||
87 | virtual scalar CoNum() const; | ||
93 | //- Update boundary flux | ||
94 | virtual void update(); | ||
88 | 95 | ||
89 | //- Solve population balance equation | ||
90 | void solve(); | ||
91 | 96 | }; | }; |
92 | 97 | ||
93 | 98 | ||
94 | 99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
95 | 100 | ||
96 | } // End namespace populationBalanceModels | ||
97 | 101 | } // End namespace Foam | } // End namespace Foam |
98 | 102 | ||
99 | 103 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/fvQuadraturePatch/fvQuadraturePatch.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C (similarity 70%) (mode: 100644) (index 1f61bcb..fd41501) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "aggregationKernel.H" | ||
26 | #include "fvQuadraturePatch.H" | ||
27 | #include "IOmanip.H" | ||
27 | 28 | ||
28 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
29 | 30 | ||
30 | 31 | namespace Foam | namespace Foam |
31 | 32 | { | { |
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(aggregationKernel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(aggregationKernel, dictionary); | ||
37 | } | ||
33 | defineTypeNameAndDebug(fvQuadraturePatch, 0); | ||
34 | defineRunTimeSelectionTable(fvQuadraturePatch, dictionary); | ||
38 | 35 | } | } |
39 | 36 | ||
40 | |||
41 | 37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
42 | 38 | ||
43 | Foam::populationBalanceSubModels::aggregationKernel::aggregationKernel | ||
39 | Foam::fvQuadraturePatch::fvQuadraturePatch | ||
44 | 40 | ( | ( |
41 | const fvPatch& patch, | ||
45 | 42 | const dictionary& dict, | const dictionary& dict, |
46 | const fvMesh& mesh | ||
43 | const velocityQuadratureApproximation& quadrature, | ||
44 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
45 | PtrList<surfaceVelocityNode>& nodesNei | ||
47 | 46 | ) | ) |
48 | 47 | : | : |
49 | dict_(dict), | ||
50 | mesh_(mesh), | ||
51 | Ca_ | ||
52 | ( | ||
53 | dict.lookupOrDefault | ||
54 | ( | ||
55 | "Ca", | ||
56 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
57 | ) | ||
58 | ) | ||
48 | patch_(patch), | ||
49 | patchi_(patch_.index()), | ||
50 | quadrature_(quadrature), | ||
51 | nodesOwn_(nodesOwn), | ||
52 | nodesNei_(nodesNei) | ||
59 | 53 | {} | {} |
60 | 54 | ||
61 | 55 | ||
62 | 56 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
63 | 57 | ||
64 | Foam::populationBalanceSubModels::aggregationKernel::~aggregationKernel() | ||
58 | Foam::fvQuadraturePatch::~fvQuadraturePatch() | ||
65 | 59 | {} | {} |
66 | 60 | ||
67 | |||
68 | 61 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/fvQuadraturePatch/fvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/velocityMomentAdvection/velocityMomentAdvection.H (similarity 54%) (mode: 100644) (index ace315d..26c1352) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::velocityMomentAdvection | ||
25 | Foam::fvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Abstract class for the advection of a velocity moment set. | Abstract class for the advection of a velocity moment set. |
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | velocityMomentAdvection.C | ||
32 | velocityMomentAdvectionI.H | ||
31 | fvQuadraturePatch.C | ||
32 | newFvQuadraturePatch.C | ||
33 | 33 | ||
34 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
35 | 35 | ||
36 | #ifndef velocityMomentAdvection_H | ||
37 | #define velocityMomentAdvection_H | ||
36 | #ifndef fvQuadraturePatch_H | ||
37 | #define fvQuadraturePatch_H | ||
38 | 38 | ||
39 | 39 | #include "fvCFD.H" | #include "fvCFD.H" |
40 | 40 | #include "IOdictionary.H" | #include "IOdictionary.H" |
... | ... | SourceFiles | |
43 | 43 | #include "surfaceFields.H" | #include "surfaceFields.H" |
44 | 44 | #include "quadratureNodes.H" | #include "quadratureNodes.H" |
45 | 45 | #include "momentFieldSets.H" | #include "momentFieldSets.H" |
46 | #include "hyperbolicFieldMomentInversion.H" | ||
47 | 46 | #include "quadratureApproximations.H" | #include "quadratureApproximations.H" |
47 | #include "surfaceInterpolationScheme.H" | ||
48 | 48 | ||
49 | 49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
50 | 50 | ||
51 | 51 | namespace Foam | namespace Foam |
52 | 52 | { | { |
53 | 53 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
54 | Class velocityMomentAdvection Declaration | ||
54 | Class fvQuadraturePatch Declaration | ||
55 | 55 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
56 | 56 | ||
57 | class velocityMomentAdvection | ||
57 | class fvQuadraturePatch | ||
58 | 58 | { | { |
59 | 59 | // Private member functions | // Private member functions |
60 | 60 | ||
61 | 61 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
62 | velocityMomentAdvection(const velocityMomentAdvection&); | ||
62 | fvQuadraturePatch(const fvQuadraturePatch&); | ||
63 | 63 | ||
64 | 64 | //- Disallow default bitwise assignment | //- Disallow default bitwise assignment |
65 | void operator=(const velocityMomentAdvection&); | ||
65 | void operator=(const fvQuadraturePatch&); | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | protected: | protected: |
... | ... | protected: | |
70 | 70 | // Protected data | // Protected data |
71 | 71 | ||
72 | 72 | //- Name of the distribution associated to the quadrature approximation. | //- Name of the distribution associated to the quadrature approximation. |
73 | const word name_; | ||
73 | const fvPatch& patch_; | ||
74 | 74 | ||
75 | //- Reference to the moments to advect | ||
76 | const volVectorMomentFieldSet& moments_; | ||
77 | |||
78 | //- Number of moments | ||
79 | const label nMoments_; | ||
80 | |||
81 | //- Field used to find upwind values of the owner | ||
82 | surfaceScalarField own_; | ||
83 | |||
84 | //- Field used to find upwind values of the neighbour | ||
85 | surfaceScalarField nei_; | ||
86 | |||
87 | //- Support of the distribution function | ||
88 | word support_; | ||
75 | //- Patch index | ||
76 | const label patchi_; | ||
89 | 77 | ||
90 | //- Moment indicies ues to map moments | ||
91 | labelListList momentOrders_; | ||
92 | |||
93 | //- Node indicies used to map nodes | ||
94 | labelListList nodeIndexes_; | ||
78 | //- Reference to the moments to advect | ||
79 | const velocityQuadratureApproximation& quadrature_; | ||
95 | 80 | ||
96 | //- Advection terms for moment transport equations | ||
97 | PtrList<volScalarField> divMoments_; | ||
81 | //- Owner nodes | ||
82 | PtrList<surfaceVelocityNode>& nodesOwn_; | ||
98 | 83 | ||
99 | //- Coefficient of restitution | ||
100 | scalar ew_; | ||
84 | //- Neighbour nodes | ||
85 | PtrList<surfaceVelocityNode>& nodesNei_; | ||
101 | 86 | ||
102 | 87 | ||
103 | 88 | public: | public: |
104 | 89 | ||
105 | 90 | //- Runtime type information | //- Runtime type information |
106 | TypeName("velocityMomentAdvection"); | ||
91 | TypeName("fvQuadraturePatch"); | ||
107 | 92 | ||
108 | 93 | ||
109 | 94 | // Declare runtime construction | // Declare runtime construction |
... | ... | public: | |
111 | 96 | declareRunTimeSelectionTable | declareRunTimeSelectionTable |
112 | 97 | ( | ( |
113 | 98 | autoPtr, | autoPtr, |
114 | velocityMomentAdvection, | ||
99 | fvQuadraturePatch, | ||
115 | 100 | dictionary, | dictionary, |
116 | 101 | ( | ( |
102 | const fvPatch& patch, | ||
117 | 103 | const dictionary& dict, | const dictionary& dict, |
118 | 104 | const velocityQuadratureApproximation& quadrature, | const velocityQuadratureApproximation& quadrature, |
119 | const word& support | ||
105 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
106 | PtrList<surfaceVelocityNode>& nodesNei | ||
120 | 107 | ), | ), |
121 | (dict, quadrature, support) | ||
108 | (patch, dict, quadrature, nodesOwn, nodesNei) | ||
122 | 109 | ); | ); |
123 | 110 | ||
124 | 111 | ||
125 | 112 | // Constructors | // Constructors |
126 | 113 | ||
127 | 114 | //- Construct from velocityMomentSet | //- Construct from velocityMomentSet |
128 | velocityMomentAdvection | ||
115 | fvQuadraturePatch | ||
129 | 116 | ( | ( |
117 | const fvPatch& patch, | ||
130 | 118 | const dictionary& dict, | const dictionary& dict, |
131 | 119 | const velocityQuadratureApproximation& quadrature, | const velocityQuadratureApproximation& quadrature, |
132 | const word& support | ||
120 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
121 | PtrList<surfaceVelocityNode>& nodesNei | ||
133 | 122 | ); | ); |
134 | 123 | ||
135 | 124 | ||
136 | 125 | //- Destructor | //- Destructor |
137 | virtual ~velocityMomentAdvection(); | ||
126 | virtual ~fvQuadraturePatch(); | ||
138 | 127 | ||
139 | 128 | ||
140 | 129 | // Selectors | // Selectors |
141 | 130 | ||
142 | static autoPtr<velocityMomentAdvection> New | ||
131 | static autoPtr<fvQuadraturePatch> New | ||
143 | 132 | ( | ( |
133 | const fvPatch& patch, | ||
144 | 134 | const dictionary& dict, | const dictionary& dict, |
145 | 135 | const velocityQuadratureApproximation& quadrature, | const velocityQuadratureApproximation& quadrature, |
146 | const word& support | ||
136 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
137 | PtrList<surfaceVelocityNode>& nodesNei | ||
147 | 138 | ); | ); |
148 | 139 | ||
149 | 140 | ||
150 | 141 | // Member Functions | // Member Functions |
151 | 142 | ||
152 | //- Return the advection term for the moment transport equation | ||
153 | inline const PtrList<volScalarField>& divMoments() const; | ||
154 | |||
155 | //- Return the maximum Courant number ensuring moment realizability | ||
156 | virtual scalar realizableCo() const = 0; | ||
157 | |||
158 | //- Return the maximum Courant number based on velocities | ||
159 | virtual scalar CoNum() const = 0; | ||
160 | |||
161 | //- Update moment advection | ||
143 | //- Update boundary flux | ||
162 | 144 | virtual void update() = 0; | virtual void update() = 0; |
163 | |||
164 | //- Update moment advection using a specified velocity field | ||
165 | virtual void update | ||
166 | ( | ||
167 | const surfaceScalarField& U, | ||
168 | const bool wallCollisions | ||
169 | ) = 0; | ||
170 | |||
171 | //- Update moment advection using a specified list of velocity fields | ||
172 | virtual void update | ||
173 | ( | ||
174 | const mappedPtrList<volVectorField>& Us, | ||
175 | const bool wallCollisions | ||
176 | ) = 0; | ||
177 | |||
178 | 145 | }; | }; |
179 | 146 | ||
180 | 147 | ||
... | ... | public: | |
184 | 151 | ||
185 | 152 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
186 | 153 | ||
187 | #include "velocityMomentAdvectionI.H" | ||
188 | |||
189 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
190 | |||
191 | 154 | #endif | #endif |
192 | 155 | ||
193 | 156 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/fvQuadraturePatch/newFvQuadraturePatch.C copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/velocityMomentAdvection/newVelocityMomentAdvection.C (similarity 64%) (mode: 100644) (index 38579e7..c21a9ff) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "velocityMomentAdvection.H" | ||
26 | #include "fvQuadraturePatch.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // |
29 | 29 | ||
30 | Foam::autoPtr<Foam::velocityMomentAdvection> | ||
31 | Foam::velocityMomentAdvection::New | ||
30 | Foam::autoPtr<Foam::fvQuadraturePatch> Foam::fvQuadraturePatch::New | ||
32 | 31 | ( | ( |
32 | const fvPatch& patch, | ||
33 | 33 | const dictionary& dict, | const dictionary& dict, |
34 | 34 | const velocityQuadratureApproximation& quadrature, | const velocityQuadratureApproximation& quadrature, |
35 | const word& support | ||
35 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
36 | PtrList<surfaceVelocityNode>& nodesNei | ||
36 | 37 | ) | ) |
37 | 38 | { | { |
38 | word velocityMomentAdvectionType | ||
39 | ( | ||
40 | dict.lookup("velocityMomentAdvection") | ||
41 | ); | ||
39 | word fvQuadraturePatchType = "calculated"; | ||
40 | if (dict.dictName() == patch.name()) | ||
41 | { | ||
42 | fvQuadraturePatchType = | ||
43 | dict.lookupOrDefault<word>("type", "calculated"); | ||
44 | } | ||
42 | 45 | ||
43 | Info<< "Selecting velocityMomentAdvection: " | ||
44 | << velocityMomentAdvectionType << endl; | ||
46 | Info<< "Selecting fvQuadraturePatch type for " << patch.name() << ": " | ||
47 | << fvQuadraturePatchType << endl; | ||
45 | 48 | ||
46 | 49 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
47 | dictionaryConstructorTablePtr_->find(velocityMomentAdvectionType); | ||
50 | dictionaryConstructorTablePtr_->find(fvQuadraturePatchType); | ||
48 | 51 | ||
49 | 52 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
50 | 53 | { | { |
51 | 54 | FatalErrorInFunction | FatalErrorInFunction |
52 | << "Unknown velocityMomentAdvection type " | ||
53 | << velocityMomentAdvectionType << endl << endl | ||
54 | << "Valid velocityMomentAdvection types are : " << endl | ||
55 | << "Unknown fvQuadraturePatch type " | ||
56 | << fvQuadraturePatchType << endl << endl | ||
57 | << "Valid fvQuadraturePatch types are : " << endl | ||
55 | 58 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
56 | 59 | << exit(FatalError); | << exit(FatalError); |
57 | 60 | } | } |
58 | 61 | ||
59 | return cstrIter()(dict, quadrature, support); | ||
62 | return cstrIter()(patch, dict, quadrature, nodesOwn, nodesNei); | ||
60 | 63 | } | } |
61 | 64 | ||
62 | 65 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/noFlux/noFluxFvQuadraturePatch.C copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.C (similarity 63%) (mode: 100644) (index 2e1c456..22471a2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noUnivariateAdvection.H" | ||
26 | #include "noFluxFvQuadraturePatch.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 30 | ||
31 | 31 | namespace Foam | namespace Foam |
32 | 32 | { | { |
33 | namespace univariateAdvection | ||
34 | { | ||
35 | defineTypeNameAndDebug(noAdvection, 0); | ||
33 | defineTypeNameAndDebug(noFluxFvQuadraturePatch, 0); | ||
36 | 34 | ||
37 | 35 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
38 | 36 | ( | ( |
39 | univariateMomentAdvection, | ||
40 | noAdvection, | ||
37 | fvQuadraturePatch, | ||
38 | noFluxFvQuadraturePatch, | ||
41 | 39 | dictionary | dictionary |
42 | 40 | ); | ); |
43 | 41 | } | } |
44 | } | ||
45 | 42 | ||
46 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
47 | 44 | ||
48 | Foam::univariateAdvection::noAdvection::noAdvection | ||
45 | Foam::noFluxFvQuadraturePatch::noFluxFvQuadraturePatch | ||
49 | 46 | ( | ( |
47 | const fvPatch& patch, | ||
50 | 48 | const dictionary& dict, | const dictionary& dict, |
51 | const univariateQuadratureApproximation& quadrature, | ||
52 | const surfaceScalarField& phi, | ||
53 | const word& support | ||
49 | const velocityQuadratureApproximation& quadrature, | ||
50 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
51 | PtrList<surfaceVelocityNode>& nodesNei | ||
54 | 52 | ) | ) |
55 | 53 | : | : |
56 | univariateMomentAdvection(dict, quadrature, phi, support) | ||
54 | fvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei) | ||
57 | 55 | {} | {} |
58 | 56 | ||
59 | 57 | ||
60 | 58 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
61 | 59 | ||
62 | Foam::univariateAdvection::noAdvection::~noAdvection() | ||
60 | Foam::noFluxFvQuadraturePatch::~noFluxFvQuadraturePatch() | ||
63 | 61 | {} | {} |
64 | 62 | ||
65 | 63 | ||
66 | 64 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
67 | 65 | ||
68 | Foam::scalar Foam::univariateAdvection::noAdvection::realizableCo() const | ||
66 | void Foam::noFluxFvQuadraturePatch::update() | ||
69 | 67 | { | { |
70 | return scalar(1); | ||
68 | if (!patch_.size()) | ||
69 | { | ||
70 | return; | ||
71 | } | ||
72 | |||
73 | forAll(nodesOwn_, nodei) | ||
74 | { | ||
75 | surfaceVelocityNode& nodeNei(nodesNei_[nodei]); | ||
76 | surfaceVelocityNode& nodeOwn(nodesOwn_[nodei]); | ||
77 | |||
78 | nodeOwn.velocityAbscissae().boundaryFieldRef()[patchi_] = Zero; | ||
79 | nodeNei.velocityAbscissae().boundaryFieldRef()[patchi_] = Zero; | ||
80 | } | ||
71 | 81 | } | } |
72 | 82 | ||
73 | void Foam::univariateAdvection::noAdvection::update() | ||
74 | { | ||
75 | return; | ||
76 | } | ||
77 | 83 | ||
78 | 84 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/noFlux/noFluxFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 68%) (mode: 100644) (index 63c8f61..f660b56) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::mixingModels::noMixing | ||
25 | Foam::noFluxFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | noFluxFvQuadraturePatch.C | ||
32 | noFluxFvQuadraturePatchI.H | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
36 | #ifndef noFluxFvQuadraturePatch_H | ||
37 | #define noFluxFvQuadraturePatch_H | ||
37 | 38 | ||
38 | #include "mixingModel.H" | ||
39 | #include "fvQuadraturePatch.H" | ||
39 | 40 | ||
40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 42 | ||
42 | 43 | namespace Foam | namespace Foam |
43 | 44 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | |||
47 | 45 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
46 | Class noFluxFvQuadraturePatch Declaration | ||
49 | 47 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 48 | ||
51 | class noMixing | ||
49 | class noFluxFvQuadraturePatch | ||
52 | 50 | : | : |
53 | public mixingModel | ||
51 | public fvQuadraturePatch | ||
54 | 52 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 53 | public: | public: |
62 | 54 | ||
63 | 55 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
56 | TypeName("noFlux"); | ||
65 | 57 | ||
66 | 58 | ||
67 | 59 | // Constructors | // Constructors |
68 | 60 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
61 | //- Construct from velocityMomentSet | ||
62 | noFluxFvQuadraturePatch | ||
71 | 63 | ( | ( |
72 | const word& name, | ||
64 | const fvPatch& patch, | ||
73 | 65 | const dictionary& dict, | const dictionary& dict, |
74 | const surfaceScalarField& phi | ||
66 | const velocityQuadratureApproximation& quadrature, | ||
67 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
68 | PtrList<surfaceVelocityNode>& nodesNei | ||
75 | 69 | ); | ); |
76 | 70 | ||
77 | 71 | ||
78 | 72 | //- Destructor | //- Destructor |
79 | virtual ~noMixing(); | ||
73 | virtual ~noFluxFvQuadraturePatch(); | ||
80 | 74 | ||
81 | 75 | // Member Functions | // Member Functions |
82 | 76 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
77 | //- Update boundary flux | ||
78 | virtual void update(); | ||
85 | 79 | ||
86 | //- Solve mixing model | ||
87 | void solve(); | ||
88 | 80 | }; | }; |
89 | 81 | ||
90 | 82 | ||
91 | 83 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
92 | 84 | ||
93 | } // End namespace mixingModels | ||
94 | 85 | } // End namespace Foam | } // End namespace Foam |
95 | 86 | ||
96 | 87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/outflow/outflowFvQuadraturePatch.C added (mode: 100644) (index 0000000..339de12) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2018-2019 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 "outflowFvQuadraturePatch.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | defineTypeNameAndDebug(outflowFvQuadraturePatch, 0); | ||
34 | |||
35 | addToRunTimeSelectionTable | ||
36 | ( | ||
37 | fvQuadraturePatch, | ||
38 | outflowFvQuadraturePatch, | ||
39 | dictionary | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | |||
44 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
45 | |||
46 | Foam::outflowFvQuadraturePatch::outflowFvQuadraturePatch | ||
47 | ( | ||
48 | const fvPatch& patch, | ||
49 | const dictionary& dict, | ||
50 | const velocityQuadratureApproximation& quadrature, | ||
51 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
52 | PtrList<surfaceVelocityNode>& nodesNei | ||
53 | ) | ||
54 | : | ||
55 | fvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei) | ||
56 | {} | ||
57 | |||
58 | |||
59 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
60 | |||
61 | Foam::outflowFvQuadraturePatch::~outflowFvQuadraturePatch() | ||
62 | {} | ||
63 | |||
64 | |||
65 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
66 | |||
67 | void Foam::outflowFvQuadraturePatch::update() | ||
68 | { | ||
69 | if (!patch_.size()) | ||
70 | { | ||
71 | return; | ||
72 | } | ||
73 | |||
74 | const PtrList<volVelocityNode>& nodes = quadrature_.nodes(); | ||
75 | const fvMesh& mesh = nodes[0].primaryWeight().mesh(); | ||
76 | |||
77 | const vectorField& bfSf(mesh.Sf().boundaryField()[patchi_]); | ||
78 | vectorField bfNorm(bfSf/mag(bfSf)); | ||
79 | |||
80 | forAll(nodes, nodei) | ||
81 | { | ||
82 | const volVelocityNode& node = nodes[nodei]; | ||
83 | surfaceVelocityNode& nodeNei(nodesNei_[nodei]); | ||
84 | surfaceVelocityNode& nodeOwn(nodesOwn_[nodei]); | ||
85 | |||
86 | const volScalarField& weight = node.primaryWeight(); | ||
87 | surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | ||
88 | surfaceScalarField& weightNei = nodeNei.primaryWeight(); | ||
89 | const volVectorField& U = node.velocityAbscissae(); | ||
90 | surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
91 | surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
92 | |||
93 | scalarField& bfwOwn = weightOwn.boundaryFieldRef()[patchi_]; | ||
94 | scalarField& bfwNei = weightNei.boundaryFieldRef()[patchi_]; | ||
95 | vectorField& bfUOwn = UOwn.boundaryFieldRef()[patchi_]; | ||
96 | vectorField& bfUNei = UNei.boundaryFieldRef()[patchi_]; | ||
97 | |||
98 | bfwOwn = weight.boundaryField()[patchi_].patchInternalField(); | ||
99 | bfwNei = bfwOwn; | ||
100 | |||
101 | vectorField bfU(U.boundaryField()[patchi_].patchInternalField()); | ||
102 | vectorField Un(bfU/max(mag(bfU), small)); | ||
103 | bfUOwn = Foam::max((bfU & bfSf), 0.0)*Un; | ||
104 | bfUNei = bfUOwn; | ||
105 | } | ||
106 | } | ||
107 | |||
108 | |||
109 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/outflow/outflowFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 69%) (mode: 100644) (index 63c8f61..ab6139d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::mixingModels::noMixing | ||
25 | Foam::outflowFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | outflowFvQuadraturePatch.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
35 | #ifndef outflowFvQuadraturePatch_H | ||
36 | #define outflowFvQuadraturePatch_H | ||
37 | 37 | ||
38 | #include "mixingModel.H" | ||
38 | #include "fvQuadraturePatch.H" | ||
39 | 39 | ||
40 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 41 | ||
42 | 42 | namespace Foam | namespace Foam |
43 | 43 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | |||
47 | 44 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
45 | Class outflowFvQuadraturePatch Declaration | ||
49 | 46 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 47 | ||
51 | class noMixing | ||
48 | class outflowFvQuadraturePatch | ||
52 | 49 | : | : |
53 | public mixingModel | ||
50 | public fvQuadraturePatch | ||
54 | 51 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 52 | public: | public: |
62 | 53 | ||
63 | 54 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
55 | TypeName("outflow"); | ||
65 | 56 | ||
66 | 57 | ||
67 | 58 | // Constructors | // Constructors |
68 | 59 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
60 | //- Construct from velocityMomentSet | ||
61 | outflowFvQuadraturePatch | ||
71 | 62 | ( | ( |
72 | const word& name, | ||
63 | const fvPatch& patch, | ||
73 | 64 | const dictionary& dict, | const dictionary& dict, |
74 | const surfaceScalarField& phi | ||
65 | const velocityQuadratureApproximation& quadrature, | ||
66 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
67 | PtrList<surfaceVelocityNode>& nodesNei | ||
75 | 68 | ); | ); |
76 | 69 | ||
77 | 70 | ||
78 | 71 | //- Destructor | //- Destructor |
79 | virtual ~noMixing(); | ||
72 | virtual ~outflowFvQuadraturePatch(); | ||
80 | 73 | ||
81 | 74 | // Member Functions | // Member Functions |
82 | 75 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
76 | //- Update boundary flux | ||
77 | virtual void update(); | ||
85 | 78 | ||
86 | //- Solve mixing model | ||
87 | void solve(); | ||
88 | 79 | }; | }; |
89 | 80 | ||
90 | 81 | ||
91 | 82 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
92 | 83 | ||
93 | } // End namespace mixingModels | ||
94 | 84 | } // End namespace Foam | } // End namespace Foam |
95 | 85 | ||
96 | 86 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/reflective/reflectiveFvQuadraturePatch.C added (mode: 100644) (index 0000000..6589c4d) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2018-2019 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 "reflectiveFvQuadraturePatch.H" | ||
27 | #include "wallFvPatch.H" | ||
28 | #include "addToRunTimeSelectionTable.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | defineTypeNameAndDebug(reflectiveFvQuadraturePatch, 0); | ||
35 | |||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | fvQuadraturePatch, | ||
39 | reflectiveFvQuadraturePatch, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | |||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
46 | |||
47 | Foam::reflectiveFvQuadraturePatch::reflectiveFvQuadraturePatch | ||
48 | ( | ||
49 | const fvPatch& patch, | ||
50 | const dictionary& dict, | ||
51 | const velocityQuadratureApproximation& quadrature, | ||
52 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
53 | PtrList<surfaceVelocityNode>& nodesNei | ||
54 | ) | ||
55 | : | ||
56 | fvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei), | ||
57 | ew_(readScalar(dict.lookup("e"))) | ||
58 | { | ||
59 | if (!isA<wallFvPatch>(patch_)) | ||
60 | { | ||
61 | FatalErrorInFunction | ||
62 | << "Wall physical boundary required, but type " | ||
63 | << patch_.type() << " specified." | ||
64 | << abort(FatalError); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::reflectiveFvQuadraturePatch::~reflectiveFvQuadraturePatch() | ||
72 | {} | ||
73 | |||
74 | |||
75 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
76 | |||
77 | Foam::tmp<Foam::vectorField> | ||
78 | Foam::reflectiveFvQuadraturePatch::wallTangentVelocity | ||
79 | ( | ||
80 | const vectorField& U, | ||
81 | const vectorField& n | ||
82 | ) const | ||
83 | { | ||
84 | return (U - n*(U & n)); | ||
85 | } | ||
86 | |||
87 | |||
88 | void Foam::reflectiveFvQuadraturePatch::update() | ||
89 | { | ||
90 | if (!patch_.size()) | ||
91 | { | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | const vectorField& bfSf(patch_.Sf()); | ||
96 | vectorField bfNorm(patch_.nf()); | ||
97 | |||
98 | scalarField Gin(bfSf.size(), 0.0); | ||
99 | scalarField Gout(bfSf.size(), 0.0); | ||
100 | |||
101 | forAll(quadrature_.nodes(), nodei) | ||
102 | { | ||
103 | const volVelocityNode& node = quadrature_.nodes()[nodei]; | ||
104 | surfaceVelocityNode& nodeNei(nodesNei_[nodei]); | ||
105 | surfaceVelocityNode& nodeOwn(nodesOwn_[nodei]); | ||
106 | |||
107 | const volScalarField& weight = node.primaryWeight(); | ||
108 | surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | ||
109 | surfaceScalarField& weightNei = nodeNei.primaryWeight(); | ||
110 | const volVectorField& U = node.velocityAbscissae(); | ||
111 | surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
112 | surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
113 | |||
114 | scalarField& bfwOwn = weightOwn.boundaryFieldRef()[patchi_]; | ||
115 | scalarField& bfwNei = weightNei.boundaryFieldRef()[patchi_]; | ||
116 | vectorField& bfUOwn = UOwn.boundaryFieldRef()[patchi_]; | ||
117 | vectorField& bfUNei = UNei.boundaryFieldRef()[patchi_]; | ||
118 | |||
119 | bfwOwn = weight.boundaryField()[patchi_].patchInternalField(); | ||
120 | bfwNei = bfwOwn; | ||
121 | |||
122 | bfUOwn = U.boundaryField()[patchi_].patchInternalField(); | ||
123 | |||
124 | tmp<vectorField> vn | ||
125 | ( | ||
126 | -this->ew_*(bfUOwn & bfNorm)*bfNorm | ||
127 | ); | ||
128 | |||
129 | bfUNei = vn + wallTangentVelocity(bfUOwn, bfNorm); | ||
130 | |||
131 | Gin += max(0.0, bfUOwn & bfSf)*bfwOwn; | ||
132 | Gout -= min(0.0, bfUNei & bfSf)*bfwNei; | ||
133 | } | ||
134 | |||
135 | //- Scale to ensure zero flux | ||
136 | if (this->ew_ < 1) | ||
137 | { | ||
138 | scalarField weightScale(Gin/(Gout + small)); | ||
139 | |||
140 | forAll(quadrature_.nodes(), nodei) | ||
141 | { | ||
142 | scalarField& bfWNei = | ||
143 | nodesNei_[nodei].primaryWeight().boundaryFieldRef()[patchi_]; | ||
144 | |||
145 | bfWNei *= weightScale; | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | |||
150 | |||
151 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/reflective/reflectiveFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.H (similarity 62%) (mode: 100644) (index 72a323d..12762f4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::noAdvection | ||
25 | Foam::reflectiveFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Empty scheme for cases without moment advection. | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noUnivariateAdvection.C | ||
31 | reflectiveFvQuadraturePatch.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noUnivariateAdvection_H | ||
36 | #define noUnivariateAdvection_H | ||
37 | |||
38 | #include "univariateMomentAdvection.H" | ||
35 | #ifndef reflectiveFvQuadraturePatch_H | ||
36 | #define reflectiveFvQuadraturePatch_H | ||
39 | 37 | ||
38 | #include "fvQuadraturePatch.H" | ||
40 | 39 | ||
41 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
42 | 41 | ||
43 | 42 | namespace Foam | namespace Foam |
44 | 43 | { | { |
45 | namespace univariateAdvection | ||
46 | { | ||
47 | |||
48 | 44 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
49 | Class noAdvection Declaration | ||
45 | Class reflectiveFvQuadraturePatch Declaration | ||
50 | 46 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
51 | 47 | ||
52 | class noAdvection | ||
48 | class reflectiveFvQuadraturePatch | ||
53 | 49 | : | : |
54 | public univariateMomentAdvection | ||
50 | public fvQuadraturePatch | ||
55 | 51 | { | { |
52 | protected: | ||
53 | // Protected data | ||
54 | |||
55 | //- Coefficient of restitution | ||
56 | scalar ew_; | ||
57 | |||
58 | //- Return the wall tangential velocity | ||
59 | virtual tmp<vectorField> wallTangentVelocity | ||
60 | ( | ||
61 | const vectorField& U, | ||
62 | const vectorField& n | ||
63 | ) const; | ||
64 | |||
56 | 65 | public: | public: |
57 | 66 | ||
58 | 67 | //- Runtime type information | //- Runtime type information |
59 | TypeName("noAdvection"); | ||
68 | TypeName("reflective"); | ||
60 | 69 | ||
61 | 70 | ||
62 | 71 | // Constructors | // Constructors |
63 | 72 | ||
64 | //- Construct from univariateMomentSet | ||
65 | noAdvection | ||
73 | //- Construct from velocityMomentSet | ||
74 | reflectiveFvQuadraturePatch | ||
66 | 75 | ( | ( |
76 | const fvPatch& patch, | ||
67 | 77 | const dictionary& dict, | const dictionary& dict, |
68 | const univariateQuadratureApproximation& quadrature, | ||
69 | const surfaceScalarField& phi, | ||
70 | const word& support | ||
78 | const velocityQuadratureApproximation& quadrature, | ||
79 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
80 | PtrList<surfaceVelocityNode>& nodesNei | ||
71 | 81 | ); | ); |
72 | 82 | ||
73 | 83 | ||
74 | 84 | //- Destructor | //- Destructor |
75 | virtual ~noAdvection(); | ||
85 | virtual ~reflectiveFvQuadraturePatch(); | ||
76 | 86 | ||
87 | // Member Functions | ||
77 | 88 | ||
78 | // Public member functions | ||
79 | |||
80 | //- Return the maximum Courant number ensuring moment realizability | ||
81 | virtual scalar realizableCo() const; | ||
82 | |||
83 | //- Update moment advection | ||
89 | //- Update boundary flux | ||
84 | 90 | virtual void update(); | virtual void update(); |
91 | |||
85 | 92 | }; | }; |
86 | 93 | ||
87 | 94 | ||
88 | 95 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
89 | 96 | ||
90 | } // End namespace univariateAdvection | ||
91 | 97 | } // End namespace Foam | } // End namespace Foam |
92 | 98 | ||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | |||
96 | 99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
97 | 100 | ||
98 | 101 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/reflectiveMovingWall/reflectiveMovingWallFvQuadraturePatch.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C (similarity 65%) (mode: 100644) (index 049f300..f8e2332) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "sumAggregation.H" | ||
26 | #include "reflectiveMovingWallFvQuadraturePatch.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 30 | ||
31 | 31 | namespace Foam | namespace Foam |
32 | 32 | { | { |
33 | namespace populationBalanceSubModels | ||
34 | { | ||
35 | namespace aggregationKernels | ||
36 | { | ||
37 | defineTypeNameAndDebug(sumAggregation, 0); | ||
33 | defineTypeNameAndDebug(reflectiveMovingWallFvQuadraturePatch, 0); | ||
38 | 34 | ||
39 | 35 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
40 | 36 | ( | ( |
41 | aggregationKernel, | ||
42 | sumAggregation, | ||
37 | fvQuadraturePatch, | ||
38 | reflectiveMovingWallFvQuadraturePatch, | ||
43 | 39 | dictionary | dictionary |
44 | 40 | ); | ); |
45 | 41 | } | } |
46 | } | ||
47 | } | ||
48 | 42 | ||
49 | 43 | ||
50 | 44 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
51 | 45 | ||
52 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | ||
53 | ::sumAggregation | ||
46 | Foam::reflectiveMovingWallFvQuadraturePatch | ||
47 | ::reflectiveMovingWallFvQuadraturePatch | ||
54 | 48 | ( | ( |
49 | const fvPatch& patch, | ||
55 | 50 | const dictionary& dict, | const dictionary& dict, |
56 | const fvMesh& mesh | ||
51 | const velocityQuadratureApproximation& quadrature, | ||
52 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
53 | PtrList<surfaceVelocityNode>& nodesNei | ||
57 | 54 | ) | ) |
58 | 55 | : | : |
59 | aggregationKernel(dict, mesh) | ||
56 | reflectiveFvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei), | ||
57 | wallVelocity_("wallVelocity", dict, patch_.size()) | ||
60 | 58 | {} | {} |
61 | 59 | ||
62 | 60 | ||
63 | 61 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
64 | 62 | ||
65 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | ||
66 | ::~sumAggregation() | ||
63 | Foam::reflectiveMovingWallFvQuadraturePatch | ||
64 | ::~reflectiveMovingWallFvQuadraturePatch() | ||
67 | 65 | {} | {} |
68 | 66 | ||
69 | 67 | ||
70 | 68 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
71 | |||
72 | Foam::scalar | ||
73 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation::Ka | ||
69 | Foam::tmp<Foam::vectorField> | ||
70 | Foam::reflectiveMovingWallFvQuadraturePatch::wallTangentVelocity | ||
74 | 71 | ( | ( |
75 | const scalar& abscissa1, | ||
76 | const scalar& abscissa2, | ||
77 | const label celli, | ||
78 | const label environment | ||
72 | const vectorField& U, | ||
73 | const vectorField& n | ||
79 | 74 | ) const | ) const |
80 | 75 | { | { |
81 | return Ca_.value()*(pow3(abscissa1) + pow3(abscissa2)); | ||
76 | return wallVelocity_; | ||
82 | 77 | } | } |
83 | 78 | ||
84 | 79 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/reflectiveMovingWall/reflectiveMovingWallFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 60%) (mode: 100644) (index 63c8f61..47fb4f4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::mixingModels::noMixing | ||
25 | Foam::reflectiveMovingWallFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Boundary condition for a reflective moing wall. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | reflectiveMovingWallFvQuadraturePatch.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
35 | #ifndef reflectiveMovingWallFvQuadraturePatch_H | ||
36 | #define reflectiveMovingWallFvQuadraturePatch_H | ||
37 | 37 | ||
38 | #include "mixingModel.H" | ||
38 | #include "reflectiveFvQuadraturePatch.H" | ||
39 | 39 | ||
40 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 41 | ||
42 | 42 | namespace Foam | namespace Foam |
43 | 43 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | |||
47 | 44 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
45 | Class reflectiveMovingWallFvQuadraturePatch Declaration | ||
49 | 46 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 47 | ||
51 | class noMixing | ||
48 | class reflectiveMovingWallFvQuadraturePatch | ||
52 | 49 | : | : |
53 | public mixingModel | ||
50 | public reflectiveFvQuadraturePatch | ||
54 | 51 | { | { |
52 | private: | ||
55 | 53 | // Private data | // Private data |
56 | 54 | ||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
55 | //- Wall velocity | ||
56 | vectorField wallVelocity_; | ||
57 | |||
58 | |||
59 | protected: | ||
60 | // Protected data | ||
61 | |||
62 | //- Return the wall tangential velocity | ||
63 | virtual tmp<vectorField> wallTangentVelocity | ||
64 | ( | ||
65 | const vectorField& U, | ||
66 | const vectorField& n | ||
67 | ) const; | ||
59 | 68 | ||
60 | 69 | ||
61 | 70 | public: | public: |
62 | 71 | ||
63 | 72 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
73 | TypeName("reflectiveMovingWall"); | ||
65 | 74 | ||
66 | 75 | ||
67 | 76 | // Constructors | // Constructors |
68 | 77 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
78 | //- Construct from velocityMomentSet | ||
79 | reflectiveMovingWallFvQuadraturePatch | ||
71 | 80 | ( | ( |
72 | const word& name, | ||
81 | const fvPatch& patch, | ||
73 | 82 | const dictionary& dict, | const dictionary& dict, |
74 | const surfaceScalarField& phi | ||
83 | const velocityQuadratureApproximation& quadrature, | ||
84 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
85 | PtrList<surfaceVelocityNode>& nodesNei | ||
75 | 86 | ); | ); |
76 | 87 | ||
77 | 88 | ||
78 | 89 | //- Destructor | //- Destructor |
79 | virtual ~noMixing(); | ||
80 | |||
81 | // Member Functions | ||
82 | |||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
85 | |||
86 | //- Solve mixing model | ||
87 | void solve(); | ||
90 | virtual ~reflectiveMovingWallFvQuadraturePatch(); | ||
88 | 91 | }; | }; |
89 | 92 | ||
90 | 93 | ||
91 | 94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
92 | 95 | ||
93 | } // End namespace mixingModels | ||
94 | 96 | } // End namespace Foam | } // End namespace Foam |
95 | 97 | ||
96 | 98 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/reflectiveRotatingWall/reflectiveRotatingWallFvQuadraturePatch.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/noCollision/noCollision.C (similarity 55%) (mode: 100644) (index 3295fc1..ad6c86c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noCollision.H" | ||
26 | #include "reflectiveRotatingWallFvQuadraturePatch.H" | ||
27 | #include "wallFvPatch.H" | ||
27 | 28 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "fundamentalConstants.H" | ||
29 | 29 | ||
30 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
31 | 31 | ||
32 | 32 | namespace Foam | namespace Foam |
33 | 33 | { | { |
34 | namespace populationBalanceSubModels | ||
35 | { | ||
36 | namespace collisionKernels | ||
37 | { | ||
38 | defineTypeNameAndDebug(noCollision, 0); | ||
34 | defineTypeNameAndDebug(reflectiveRotatingWallFvQuadraturePatch, 0); | ||
39 | 35 | ||
40 | 36 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
41 | 37 | ( | ( |
42 | collisionKernel, | ||
43 | noCollision, | ||
38 | fvQuadraturePatch, | ||
39 | reflectiveRotatingWallFvQuadraturePatch, | ||
44 | 40 | dictionary | dictionary |
45 | 41 | ); | ); |
46 | 42 | } | } |
47 | } | ||
48 | } | ||
49 | 43 | ||
50 | 44 | ||
51 | 45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
52 | 46 | ||
53 | Foam::populationBalanceSubModels::collisionKernels::noCollision::noCollision | ||
47 | Foam::reflectiveRotatingWallFvQuadraturePatch | ||
48 | ::reflectiveRotatingWallFvQuadraturePatch | ||
54 | 49 | ( | ( |
50 | const fvPatch& patch, | ||
55 | 51 | const dictionary& dict, | const dictionary& dict, |
56 | const fvMesh& mesh, | ||
57 | 52 | const velocityQuadratureApproximation& quadrature, | const velocityQuadratureApproximation& quadrature, |
58 | const bool ode | ||
53 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
54 | PtrList<surfaceVelocityNode>& nodesNei | ||
59 | 55 | ) | ) |
60 | 56 | : | : |
61 | collisionKernel(dict, mesh, quadrature, ode) | ||
57 | reflectiveFvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei), | ||
58 | origin_(dict.lookup("origin")), | ||
59 | axis_(dict.lookup("axis")), | ||
60 | omega_(Function1<scalar>::New("omega", dict)) | ||
62 | 61 | {} | {} |
63 | 62 | ||
64 | 63 | ||
65 | 64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
66 | 65 | ||
67 | Foam::populationBalanceSubModels::collisionKernels::noCollision::~noCollision() | ||
66 | Foam::reflectiveRotatingWallFvQuadraturePatch | ||
67 | ::~reflectiveRotatingWallFvQuadraturePatch() | ||
68 | 68 | {} | {} |
69 | 69 | ||
70 | 70 | ||
71 | 71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 72 | ||
73 | void Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
74 | ::updateCells(const label celli) | ||
75 | {} | ||
76 | |||
77 | void | ||
78 | Foam::populationBalanceSubModels::collisionKernels::noCollision::updateFields() | ||
79 | {} | ||
80 | |||
81 | Foam::scalar | ||
82 | Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
83 | ::explicitCollisionSource(const label mi, const label celli) const | ||
73 | Foam::tmp<Foam::vectorField> Foam::reflectiveRotatingWallFvQuadraturePatch | ||
74 | ::wallTangentVelocity | ||
75 | ( | ||
76 | const vectorField& U, | ||
77 | const vectorField& n | ||
78 | ) const | ||
84 | 79 | { | { |
85 | return 0.0; | ||
86 | } | ||
80 | const fvMesh& mesh = quadrature_.nodes()[0].primaryWeight().mesh(); | ||
81 | const scalar t = mesh.time().timeOutputValue(); | ||
82 | scalar om = omega_->value(t); | ||
87 | 83 | ||
88 | Foam::tmp<Foam::fvScalarMatrix> | ||
89 | Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
90 | ::implicitCollisionSource(const volVectorMoment& m) const | ||
91 | { | ||
92 | return tmp<fvScalarMatrix> | ||
84 | // Calculate the rotating wall velocity from the specification of the motion | ||
85 | const vectorField Uw | ||
93 | 86 | ( | ( |
94 | new fvScalarMatrix(m, m.dimensions()*dimVol/dimTime) | ||
87 | (-om)*((patch_.Cf() - origin_) ^ (axis_/mag(axis_))) | ||
95 | 88 | ); | ); |
89 | |||
90 | // Remove the component of Up normal to the wall | ||
91 | // just in case it is not exactly circular | ||
92 | return (Uw - n*(n & Uw)); | ||
96 | 93 | } | } |
97 | 94 | ||
98 | 95 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/reflectiveRotatingWall/reflectiveRotatingWallFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/noCollision/noCollision.H (similarity 58%) (mode: 100644) (index efa1164..e4468f1) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
25 | Foam::reflectiveRotatingWallFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | No collisions | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noCollision.C | ||
31 | reflectiveRotatingWallFvQuadraturePatch.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noCollision_H | ||
36 | #define noCollision_H | ||
35 | #ifndef reflectiveRotatingWallFvQuadraturePatch_H | ||
36 | #define reflectiveRotatingWallFvQuadraturePatch_H | ||
37 | 37 | ||
38 | #include "collisionKernel.H" | ||
39 | #include "turbulentFluidThermoModel.H" | ||
38 | #include "reflectiveFvQuadraturePatch.H" | ||
39 | #include "Function1.H" | ||
40 | 40 | ||
41 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
42 | 42 | ||
43 | 43 | namespace Foam | namespace Foam |
44 | 44 | { | { |
45 | namespace populationBalanceSubModels | ||
46 | { | ||
47 | namespace collisionKernels | ||
48 | { | ||
49 | |||
50 | 45 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
51 | Class noCollision Declaration | ||
46 | Class reflectiveRotatingWallFvQuadraturePatch Declaration | ||
52 | 47 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 48 | ||
54 | class noCollision | ||
49 | class reflectiveRotatingWallFvQuadraturePatch | ||
55 | 50 | : | : |
56 | public collisionKernel | ||
51 | public reflectiveFvQuadraturePatch | ||
57 | 52 | { | { |
53 | // Private data | ||
58 | 54 | ||
59 | public: | ||
55 | //- Origin of the rotation | ||
56 | vector origin_; | ||
60 | 57 | ||
61 | //- Runtime type information | ||
62 | TypeName("noCollision"); | ||
58 | //- Axis of the rotation | ||
59 | vector axis_; | ||
63 | 60 | ||
61 | //- Rotational speed | ||
62 | autoPtr<Function1<scalar>> omega_; | ||
64 | 63 | ||
65 | // Constructors | ||
66 | 64 | ||
67 | //- Construct from components | ||
68 | noCollision | ||
69 | ( | ||
70 | const dictionary& dict, | ||
71 | const fvMesh& mesh, | ||
72 | const velocityQuadratureApproximation& quadrature, | ||
73 | const bool ode | ||
74 | ); | ||
65 | protected: | ||
66 | // Protected data | ||
75 | 67 | ||
68 | //- Return the wall tangential velocity | ||
69 | virtual tmp<vectorField> wallTangentVelocity | ||
70 | ( | ||
71 | const vectorField& U, | ||
72 | const vectorField& n | ||
73 | ) const; | ||
76 | 74 | ||
77 | //- Destructor | ||
78 | virtual ~noCollision(); | ||
79 | |||
75 | public: | ||
80 | 76 | ||
81 | // Member Functions | ||
77 | //- Runtime type information | ||
78 | TypeName("reflectiveRotatingWall"); | ||
82 | 79 | ||
83 | //- Update equilibrium moments | ||
84 | virtual void updateCells(const label celli); | ||
85 | 80 | ||
86 | //- Update equilibrium moments | ||
87 | virtual void updateFields(); | ||
81 | // Constructors | ||
88 | 82 | ||
89 | //- Return explicit collision source term | ||
90 | virtual scalar explicitCollisionSource | ||
83 | //- Construct from velocityMomentSet | ||
84 | reflectiveRotatingWallFvQuadraturePatch | ||
91 | 85 | ( | ( |
92 | const label mi, | ||
93 | const label celli | ||
94 | ) const; | ||
86 | const fvPatch& patch, | ||
87 | const dictionary& dict, | ||
88 | const velocityQuadratureApproximation& quadrature, | ||
89 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
90 | PtrList<surfaceVelocityNode>& nodesNei | ||
91 | ); | ||
95 | 92 | ||
96 | //- Return implicit collision source matrix | ||
97 | virtual tmp<fvScalarMatrix> implicitCollisionSource | ||
98 | ( | ||
99 | const volVectorMoment& m | ||
100 | ) const; | ||
101 | 93 | ||
94 | //- Destructor | ||
95 | virtual ~reflectiveRotatingWallFvQuadraturePatch(); | ||
102 | 96 | }; | }; |
103 | 97 | ||
104 | 98 | ||
105 | 99 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
106 | 100 | ||
107 | } // End namespace collisionKernels | ||
108 | } // End namespace populationBalanceSubModels | ||
109 | 101 | } // End namespace Foam | } // End namespace Foam |
110 | 102 | ||
111 | 103 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/symmetry/symmetryFvQuadraturePatch.C added (mode: 100644) (index 0000000..b29834f) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2018-2019 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 "symmetryFvQuadraturePatch.H" | ||
27 | #include "symmetryFvPatch.H" | ||
28 | #include "addToRunTimeSelectionTable.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | defineTypeNameAndDebug(symmetryFvQuadraturePatch, 0); | ||
35 | |||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | fvQuadraturePatch, | ||
39 | symmetryFvQuadraturePatch, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | |||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
46 | |||
47 | Foam::symmetryFvQuadraturePatch::symmetryFvQuadraturePatch | ||
48 | ( | ||
49 | const fvPatch& patch, | ||
50 | const dictionary& dict, | ||
51 | const velocityQuadratureApproximation& quadrature, | ||
52 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
53 | PtrList<surfaceVelocityNode>& nodesNei | ||
54 | ) | ||
55 | : | ||
56 | fvQuadraturePatch(patch, dict, quadrature, nodesOwn, nodesNei) | ||
57 | { | ||
58 | if (!isA<symmetryFvPatch>(patch_)) | ||
59 | { | ||
60 | FatalErrorInFunction | ||
61 | << "Symmetry physical boundary required, but " | ||
62 | << patch_.type() << " specified." | ||
63 | << abort(FatalError); | ||
64 | } | ||
65 | } | ||
66 | |||
67 | |||
68 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
69 | |||
70 | Foam::symmetryFvQuadraturePatch::~symmetryFvQuadraturePatch() | ||
71 | {} | ||
72 | |||
73 | |||
74 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
75 | |||
76 | void Foam::symmetryFvQuadraturePatch::update() | ||
77 | { | ||
78 | if (!patch_.size()) | ||
79 | { | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | const PtrList<volVelocityNode>& nodes = quadrature_.nodes(); | ||
84 | const fvMesh& mesh = nodes[0].primaryWeight().mesh(); | ||
85 | |||
86 | const vectorField& bfSf(mesh.Sf().boundaryField()[patchi_]); | ||
87 | vectorField bfNorm(bfSf/mag(bfSf)); | ||
88 | |||
89 | forAll(nodes, nodei) | ||
90 | { | ||
91 | const volVelocityNode& node = nodes[nodei]; | ||
92 | surfaceVelocityNode& nodeNei(nodesNei_[nodei]); | ||
93 | surfaceVelocityNode& nodeOwn(nodesOwn_[nodei]); | ||
94 | |||
95 | const volScalarField& weight = node.primaryWeight(); | ||
96 | surfaceScalarField& weightOwn = nodeOwn.primaryWeight(); | ||
97 | surfaceScalarField& weightNei = nodeNei.primaryWeight(); | ||
98 | const volVectorField& U = node.velocityAbscissae(); | ||
99 | surfaceVectorField& UOwn = nodeOwn.velocityAbscissae(); | ||
100 | surfaceVectorField& UNei = nodeNei.velocityAbscissae(); | ||
101 | |||
102 | scalarField& bfwOwn = weightOwn.boundaryFieldRef()[patchi_]; | ||
103 | scalarField& bfwNei = weightNei.boundaryFieldRef()[patchi_]; | ||
104 | vectorField& bfUOwn = UOwn.boundaryFieldRef()[patchi_]; | ||
105 | vectorField& bfUNei = UNei.boundaryFieldRef()[patchi_]; | ||
106 | |||
107 | bfwOwn = weight.boundaryField()[patchi_].patchInternalField(); | ||
108 | bfwNei = bfwOwn; | ||
109 | |||
110 | bfUOwn = U.boundaryField()[patchi_].patchInternalField(); | ||
111 | bfUNei = (bfUOwn - 2.0*(bfUOwn & bfNorm)*bfNorm); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | |||
116 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/fvQuadraturePatch/symmetry/symmetryFvQuadraturePatch.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 68%) (mode: 100644) (index 63c8f61..d2fd7dc) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::mixingModels::noMixing | ||
25 | Foam::symmetryFvQuadraturePatch | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Abstract class for the advection of a velocity moment set. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | symmetryFvQuadraturePatch.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
35 | #ifndef symmetryFvQuadraturePatch_H | ||
36 | #define symmetryFvQuadraturePatch_H | ||
37 | 37 | ||
38 | #include "mixingModel.H" | ||
38 | #include "fvQuadraturePatch.H" | ||
39 | 39 | ||
40 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 41 | ||
42 | 42 | namespace Foam | namespace Foam |
43 | 43 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | |||
47 | 44 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
45 | Class symmetryFvQuadraturePatch Declaration | ||
49 | 46 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 47 | ||
51 | class noMixing | ||
48 | class symmetryFvQuadraturePatch | ||
52 | 49 | : | : |
53 | public mixingModel | ||
50 | public fvQuadraturePatch | ||
54 | 51 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 52 | public: | public: |
62 | 53 | ||
63 | 54 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
55 | TypeName("symmetry"); | ||
65 | 56 | ||
66 | 57 | ||
67 | 58 | // Constructors | // Constructors |
68 | 59 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
60 | //- Construct from velocityMomentSet | ||
61 | symmetryFvQuadraturePatch | ||
71 | 62 | ( | ( |
72 | const word& name, | ||
63 | const fvPatch& patch, | ||
73 | 64 | const dictionary& dict, | const dictionary& dict, |
74 | const surfaceScalarField& phi | ||
65 | const velocityQuadratureApproximation& quadrature, | ||
66 | PtrList<surfaceVelocityNode>& nodesOwn, | ||
67 | PtrList<surfaceVelocityNode>& nodesNei | ||
75 | 68 | ); | ); |
76 | 69 | ||
77 | 70 | ||
78 | 71 | //- Destructor | //- Destructor |
79 | virtual ~noMixing(); | ||
72 | virtual ~symmetryFvQuadraturePatch(); | ||
80 | 73 | ||
81 | 74 | // Member Functions | // Member Functions |
82 | 75 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
76 | //- Update boundary flux | ||
77 | virtual void update(); | ||
85 | 78 | ||
86 | //- Solve mixing model | ||
87 | void solve(); | ||
88 | 79 | }; | }; |
89 | 80 | ||
90 | 81 | ||
91 | 82 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
92 | 83 | ||
93 | } // End namespace mixingModels | ||
94 | 84 | } // End namespace Foam | } // End namespace Foam |
95 | 85 | ||
96 | 86 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/noVelocityAdvection/noVelocityAdvection.C copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariate/noUnivariateAdvection/noUnivariateAdvection.C (similarity 68%) (mode: 100644) (index 2e1c456..5f0cc58) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noUnivariateAdvection.H" | ||
26 | #include "noVelocityAdvection.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 30 | ||
31 | 31 | namespace Foam | namespace Foam |
32 | 32 | { | { |
33 | namespace univariateAdvection | ||
33 | namespace velocityAdvection | ||
34 | 34 | { | { |
35 | 35 | defineTypeNameAndDebug(noAdvection, 0); | defineTypeNameAndDebug(noAdvection, 0); |
36 | 36 | ||
37 | 37 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
38 | 38 | ( | ( |
39 | univariateMomentAdvection, | ||
39 | velocityMomentAdvection, | ||
40 | 40 | noAdvection, | noAdvection, |
41 | 41 | dictionary | dictionary |
42 | 42 | ); | ); |
... | ... | namespace univariateAdvection | |
45 | 45 | ||
46 | 46 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
47 | 47 | ||
48 | Foam::univariateAdvection::noAdvection::noAdvection | ||
48 | Foam::velocityAdvection::noAdvection::noAdvection | ||
49 | 49 | ( | ( |
50 | 50 | const dictionary& dict, | const dictionary& dict, |
51 | const univariateQuadratureApproximation& quadrature, | ||
52 | const surfaceScalarField& phi, | ||
51 | const velocityQuadratureApproximation& quadrature, | ||
53 | 52 | const word& support | const word& support |
54 | 53 | ) | ) |
55 | 54 | : | : |
56 | univariateMomentAdvection(dict, quadrature, phi, support) | ||
55 | velocityMomentAdvection(dict, quadrature, support) | ||
57 | 56 | {} | {} |
58 | 57 | ||
59 | 58 | ||
60 | 59 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
61 | 60 | ||
62 | Foam::univariateAdvection::noAdvection::~noAdvection() | ||
61 | Foam::velocityAdvection::noAdvection::~noAdvection() | ||
63 | 62 | {} | {} |
64 | 63 | ||
65 | 64 | ||
66 | 65 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
67 | 66 | ||
68 | Foam::scalar Foam::univariateAdvection::noAdvection::realizableCo() const | ||
67 | Foam::scalar | ||
68 | Foam::velocityAdvection::noAdvection::realizableCo() const | ||
69 | 69 | { | { |
70 | return scalar(1); | ||
70 | return 1.0; | ||
71 | 71 | } | } |
72 | 72 | ||
73 | void Foam::univariateAdvection::noAdvection::update() | ||
73 | Foam::scalar Foam::velocityAdvection::noAdvection::CoNum() const | ||
74 | { | ||
75 | return 1.0; | ||
76 | } | ||
77 | |||
78 | void Foam::velocityAdvection::noAdvection::update() | ||
79 | { | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | void Foam::velocityAdvection::noAdvection::update | ||
84 | ( | ||
85 | const surfaceScalarField& phi, | ||
86 | const bool wallCollisions | ||
87 | ) | ||
88 | { | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | void Foam::velocityAdvection::noAdvection::update | ||
93 | ( | ||
94 | const mappedPtrList<volVectorField>& Us, | ||
95 | const bool wallCollisions | ||
96 | ) | ||
74 | 97 | { | { |
75 | 98 | return; | return; |
76 | 99 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/noVelocityAdvection/noVelocityAdvection.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/firstOrderKineticVelocityAdvection/firstOrderKineticVelocityAdvection.H (similarity 72%) (mode: 100644) (index ed093f3..b0c671e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::firstOrderKinetic | ||
25 | Foam::noAdvection | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | First-order velocity moment advection with kinetic scheme. | ||
28 | Empty scheme for cases without moment advection. Only to be used for | ||
29 | zero-dimensional cases. | ||
29 | 30 | ||
30 | 31 | SourceFiles | SourceFiles |
31 | firstOrderKineticVelocityAdvection.C | ||
32 | noAdvectionVelocityAdvection.C | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef firstOrderKineticVelocityAdvection_H | ||
36 | #define firstOrderKineticVelocityAdvection_H | ||
36 | #ifndef noAdvectionVelocityAdvection_H | ||
37 | #define noAdvectionVelocityAdvection_H | ||
37 | 38 | ||
38 | 39 | #include "velocityMomentAdvection.H" | #include "velocityMomentAdvection.H" |
39 | 40 | ||
... | ... | namespace velocityAdvection | |
46 | 47 | { | { |
47 | 48 | ||
48 | 49 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
49 | Class firstOrderKinetic Declaration | ||
50 | Class noAdvection Declaration | ||
50 | 51 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
51 | 52 | ||
52 | class firstOrderKinetic | ||
53 | class noAdvection | ||
53 | 54 | : | : |
54 | 55 | public velocityMomentAdvection | public velocityMomentAdvection |
55 | 56 | { | { |
56 | // Private data | ||
57 | |||
58 | //- List of quadrature nodes used for moment advection | ||
59 | const PtrList<volVectorNode>& nodes_; | ||
60 | |||
61 | //- List of interpolated nodes (neighbour) | ||
62 | autoPtr<PtrList<surfaceVectorNode>> nodesNei_; | ||
63 | |||
64 | //- List of interpolated nodes (owner) | ||
65 | autoPtr<PtrList<surfaceVectorNode>> nodesOwn_; | ||
66 | |||
67 | //- Flux moment inversion method | ||
68 | // autoPtr<hyperbolicFieldMomentInversion> momentFieldInverter_; | ||
69 | |||
70 | |||
71 | protected: | ||
72 | |||
73 | // Protected member functions | ||
74 | |||
75 | // Interpolate weights and abscissae | ||
76 | void interpolateNodes(); | ||
77 | |||
78 | //- Compute collisions with walls | ||
79 | void updateWallCollisions(); | ||
80 | |||
81 | |||
82 | 57 | public: | public: |
83 | 58 | ||
84 | 59 | //- Runtime type information | //- Runtime type information |
85 | TypeName("firstOrderKinetic"); | ||
60 | TypeName("noAdvection"); | ||
86 | 61 | ||
87 | 62 | ||
88 | 63 | // Constructors | // Constructors |
89 | 64 | ||
90 | 65 | //- Construct from velocityMomentSet | //- Construct from velocityMomentSet |
91 | firstOrderKinetic | ||
66 | noAdvection | ||
92 | 67 | ( | ( |
93 | 68 | const dictionary& dict, | const dictionary& dict, |
94 | 69 | const velocityQuadratureApproximation& quadrature, | const velocityQuadratureApproximation& quadrature, |
... | ... | public: | |
97 | 72 | ||
98 | 73 | ||
99 | 74 | //- Destructor | //- Destructor |
100 | virtual ~firstOrderKinetic(); | ||
75 | virtual ~noAdvection(); | ||
101 | 76 | ||
102 | 77 | ||
103 | 78 | // Public member functions | // Public member functions |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/velocityMomentAdvection/newVelocityMomentAdvection.C changed (mode: 100644) (index 38579e7..d3c1d8c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/velocityMomentAdvection/velocityMomentAdvection.C changed (mode: 100644) (index 5ea62e4..6d63046) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "velocityMomentAdvection.H" | #include "velocityMomentAdvection.H" |
27 | 27 | #include "IOmanip.H" | #include "IOmanip.H" |
28 | #include "wallFvPatch.H" | ||
29 | #include "symmetryFvPatch.H" | ||
28 | 30 | ||
29 | 31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 32 | ||
... | ... | Foam::velocityMomentAdvection::velocityMomentAdvection | |
45 | 47 | : | : |
46 | 48 | name_(quadrature.name()), | name_(quadrature.name()), |
47 | 49 | moments_(quadrature.moments()), | moments_(quadrature.moments()), |
50 | nodes_(quadrature.nodes()), | ||
51 | nodesNei_(), | ||
52 | nodesOwn_(), | ||
48 | 53 | nMoments_(moments_.size()), | nMoments_(moments_.size()), |
49 | 54 | own_ | own_ |
50 | 55 | ( | ( |
51 | 56 | IOobject | IOobject |
52 | 57 | ( | ( |
53 | "own", | ||
54 | moments_[0].mesh().time().timeName(), | ||
55 | moments_[0].mesh() | ||
58 | "velocityMomentAdvection:own", | ||
59 | moments_(0).mesh().time().timeName(), | ||
60 | moments_(0).mesh() | ||
56 | 61 | ), | ), |
57 | moments_[0].mesh(), | ||
62 | moments_(0).mesh(), | ||
58 | 63 | dimensionedScalar("own", dimless, 1.0) | dimensionedScalar("own", dimless, 1.0) |
59 | 64 | ), | ), |
60 | 65 | nei_ | nei_ |
61 | 66 | ( | ( |
62 | 67 | IOobject | IOobject |
63 | 68 | ( | ( |
64 | "nei", | ||
65 | moments_[0].mesh().time().timeName(), | ||
66 | moments_[0].mesh() | ||
69 | "velocityMomentAdvection:nei", | ||
70 | moments_(0).mesh().time().timeName(), | ||
71 | moments_(0).mesh() | ||
67 | 72 | ), | ), |
68 | moments_[0].mesh(), | ||
73 | moments_(0).mesh(), | ||
69 | 74 | dimensionedScalar("nei", dimless, -1.0) | dimensionedScalar("nei", dimless, -1.0) |
70 | 75 | ), | ), |
71 | 76 | support_(support), | support_(support), |
72 | 77 | momentOrders_(quadrature.momentOrders()), | momentOrders_(quadrature.momentOrders()), |
73 | 78 | nodeIndexes_(quadrature.nodeIndexes()), | nodeIndexes_(quadrature.nodeIndexes()), |
74 | 79 | divMoments_(nMoments_), | divMoments_(nMoments_), |
75 | ew_(dict.lookupOrDefault("ew", 1.0)) | ||
80 | boundaries_(moments_[0].boundaryField().size()) | ||
76 | 81 | { | { |
77 | 82 | forAll(divMoments_, momenti) | forAll(divMoments_, momenti) |
78 | 83 | { | { |
79 | 84 | const labelList& momentOrder = momentOrders_[momenti]; | const labelList& momentOrder = momentOrders_[momenti]; |
85 | |||
80 | 86 | divMoments_.set | divMoments_.set |
81 | 87 | ( | ( |
82 | 88 | momenti, | momenti, |
... | ... | Foam::velocityMomentAdvection::velocityMomentAdvection | |
87 | 93 | IOobject::groupName | IOobject::groupName |
88 | 94 | ( | ( |
89 | 95 | "divMoment" | "divMoment" |
90 | + volVectorMoment::listToWord(momentOrder), | ||
96 | + mappedList<vector>::listToWord(momentOrder), | ||
91 | 97 | name_ | name_ |
92 | 98 | ), | ), |
93 | moments_[0].mesh().time().timeName(), | ||
94 | moments_[0].mesh(), | ||
99 | moments_(0).mesh().time().timeName(), | ||
100 | moments_(0).mesh(), | ||
95 | 101 | IOobject::NO_READ, | IOobject::NO_READ, |
96 | 102 | IOobject::NO_WRITE, | IOobject::NO_WRITE, |
97 | 103 | false | false |
98 | 104 | ), | ), |
99 | moments_[0].mesh(), | ||
105 | moments_(0).mesh(), | ||
100 | 106 | dimensionedScalar | dimensionedScalar |
101 | 107 | ( | ( |
102 | 108 | "zero", moments_[momenti].dimensions()/dimTime, 0 | "zero", moments_[momenti].dimensions()/dimTime, 0 |
... | ... | Foam::velocityMomentAdvection::velocityMomentAdvection | |
104 | 110 | ) | ) |
105 | 111 | ); | ); |
106 | 112 | } | } |
113 | |||
114 | PtrList<dimensionSet> abscissaeDimensions(momentOrders_[0].size()); | ||
115 | labelList zeroOrder(momentOrders_[0].size(), 0); | ||
116 | |||
117 | forAll(abscissaeDimensions, dimi) | ||
118 | { | ||
119 | labelList firstOrder(zeroOrder); | ||
120 | firstOrder[dimi] = 1; | ||
121 | |||
122 | abscissaeDimensions.set | ||
123 | ( | ||
124 | dimi, | ||
125 | new dimensionSet | ||
126 | ( | ||
127 | moments_(firstOrder).dimensions()/moments_(0).dimensions() | ||
128 | ) | ||
129 | ); | ||
130 | } | ||
131 | |||
132 | nodesNei_ = autoPtr<PtrList<surfaceVelocityNode> > | ||
133 | ( | ||
134 | new PtrList<surfaceVelocityNode>(nodes_.size()) | ||
135 | ); | ||
136 | |||
137 | nodesOwn_ = autoPtr<PtrList<surfaceVelocityNode> > | ||
138 | ( | ||
139 | new PtrList<surfaceVelocityNode>(nodes_.size()) | ||
140 | ); | ||
141 | |||
142 | PtrList<surfaceVelocityNode>& nodesNei = nodesNei_(); | ||
143 | PtrList<surfaceVelocityNode>& nodesOwn = nodesOwn_(); | ||
144 | |||
145 | // Populating nodes and interpolated nodes | ||
146 | forAll(nodes_, nodei) | ||
147 | { | ||
148 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
149 | |||
150 | nodesNei.set | ||
151 | ( | ||
152 | nodei, | ||
153 | new surfaceVelocityNode | ||
154 | ( | ||
155 | "nodeNei" + mappedList<scalar>::listToWord(nodeIndex), | ||
156 | name_, | ||
157 | moments_(0).mesh(), | ||
158 | moments_(0).dimensions(), | ||
159 | abscissaeDimensions, | ||
160 | false | ||
161 | ) | ||
162 | ); | ||
163 | |||
164 | nodesOwn.set | ||
165 | ( | ||
166 | nodei, | ||
167 | new surfaceVelocityNode | ||
168 | ( | ||
169 | "nodeOwn" + mappedList<scalar>::listToWord(nodeIndex), | ||
170 | name_, | ||
171 | moments_(0).mesh(), | ||
172 | moments_(0).dimensions(), | ||
173 | abscissaeDimensions, | ||
174 | false | ||
175 | ) | ||
176 | ); | ||
177 | } | ||
178 | |||
179 | forAll(boundaries_, patchi) | ||
180 | { | ||
181 | boundaries_.set | ||
182 | ( | ||
183 | patchi, | ||
184 | fvQuadraturePatch::New | ||
185 | ( | ||
186 | moments_[0].mesh().boundary()[patchi], | ||
187 | dict.optionalSubDict | ||
188 | ( | ||
189 | moments_[0].mesh().boundary()[patchi].name() | ||
190 | ), | ||
191 | quadrature, | ||
192 | nodesOwn_(), | ||
193 | nodesNei_() | ||
194 | ).ptr() | ||
195 | ); | ||
196 | } | ||
107 | 197 | } | } |
108 | 198 | ||
109 | 199 | ||
... | ... | Foam::velocityMomentAdvection::~velocityMomentAdvection() | |
115 | 205 | ||
116 | 206 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
117 | 207 | ||
208 | void Foam::velocityMomentAdvection::updateBoundaryConditions() | ||
209 | { | ||
210 | forAll(boundaries_, patchi) | ||
211 | { | ||
212 | boundaries_[patchi].update(); | ||
213 | } | ||
214 | } | ||
215 | |||
118 | 216 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/velocityMomentAdvection/velocityMomentAdvection.H changed (mode: 100644) (index ace315d..0152a92) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
43 | 43 | #include "surfaceFields.H" | #include "surfaceFields.H" |
44 | 44 | #include "quadratureNodes.H" | #include "quadratureNodes.H" |
45 | 45 | #include "momentFieldSets.H" | #include "momentFieldSets.H" |
46 | #include "hyperbolicFieldMomentInversion.H" | ||
47 | 46 | #include "quadratureApproximations.H" | #include "quadratureApproximations.H" |
47 | #include "surfaceInterpolationScheme.H" | ||
48 | #include "fvQuadraturePatch.H" | ||
48 | 49 | ||
49 | 50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
50 | 51 | ||
... | ... | namespace Foam | |
56 | 57 | ||
57 | 58 | class velocityMomentAdvection | class velocityMomentAdvection |
58 | 59 | { | { |
59 | // Private member functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | velocityMomentAdvection(const velocityMomentAdvection&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const velocityMomentAdvection&); | ||
66 | |||
67 | |||
68 | 60 | protected: | protected: |
69 | 61 | ||
70 | 62 | // Protected data | // Protected data |
71 | 63 | ||
72 | //- Name of the distribution associated to the quadrature approximation. | ||
64 | //- Name of the distribution associated to the quadrature approximation | ||
73 | 65 | const word name_; | const word name_; |
74 | 66 | ||
75 | 67 | //- Reference to the moments to advect | //- Reference to the moments to advect |
76 | const volVectorMomentFieldSet& moments_; | ||
68 | const volVelocityMomentFieldSet& moments_; | ||
69 | |||
70 | //- List of quadrature nodes used for moment advection | ||
71 | const PtrList<volVelocityNode>& nodes_; | ||
72 | |||
73 | //- List of interpolated nodes (neighbour) | ||
74 | autoPtr<PtrList<surfaceVelocityNode>> nodesNei_; | ||
75 | |||
76 | //- List of interpolated nodes (owner) | ||
77 | autoPtr<PtrList<surfaceVelocityNode>> nodesOwn_; | ||
77 | 78 | ||
78 | 79 | //- Number of moments | //- Number of moments |
79 | 80 | const label nMoments_; | const label nMoments_; |
... | ... | protected: | |
96 | 97 | //- Advection terms for moment transport equations | //- Advection terms for moment transport equations |
97 | 98 | PtrList<volScalarField> divMoments_; | PtrList<volScalarField> divMoments_; |
98 | 99 | ||
99 | //- Coefficient of restitution | ||
100 | scalar ew_; | ||
100 | //- List of boundaries conditions | ||
101 | PtrList<fvQuadraturePatch> boundaries_; | ||
102 | |||
103 | |||
104 | //- Protected member function | ||
105 | |||
106 | //- Update fluxes due to wall callisions | ||
107 | void updateBoundaryConditions(); | ||
101 | 108 | ||
102 | 109 | ||
103 | 110 | public: | public: |
... | ... | public: | |
132 | 139 | const word& support | const word& support |
133 | 140 | ); | ); |
134 | 141 | ||
142 | //- Disallow default bitwise copy construct | ||
143 | velocityMomentAdvection(const velocityMomentAdvection&) = delete; | ||
144 | |||
135 | 145 | ||
136 | 146 | //- Destructor | //- Destructor |
137 | 147 | virtual ~velocityMomentAdvection(); | virtual ~velocityMomentAdvection(); |
... | ... | public: | |
175 | 185 | const bool wallCollisions | const bool wallCollisions |
176 | 186 | ) = 0; | ) = 0; |
177 | 187 | ||
188 | |||
189 | // Member Operators | ||
190 | |||
191 | //- Disallow default bitwise assignment | ||
192 | void operator=(const velocityMomentAdvection&) = delete; | ||
193 | |||
178 | 194 | }; | }; |
179 | 195 | ||
180 | 196 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/velocity/velocityMomentAdvection/velocityMomentAdvectionI.H changed (mode: 100644) (index 474d7c5..5ccc6f8) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/Make/files changed (mode: 100644) (index cb0a6c5..c2b91dd) | |||
... | ... | univariate/extended/gamma/gammaEQMOM.C | |
11 | 11 | univariate/extended/lognormal/lognormalEQMOM.C | univariate/extended/lognormal/lognormalEQMOM.C |
12 | 12 | univariate/extended/beta/betaEQMOM.C | univariate/extended/beta/betaEQMOM.C |
13 | 13 | ||
14 | multivariate/multivariateMomentInversion/multivariateMomentInversion.C | ||
15 | multivariate/multivariateMomentInversion/newMultivariateMomentInversion.C | ||
16 | multivariate/monoKinetic/monoKineticMomentInversion.C | ||
14 | 17 | multivariate/conditional/conditionalMomentInversion.C | multivariate/conditional/conditionalMomentInversion.C |
15 | multivariate/hyperbolic/hyperbolicConditionalMomentInversion.C | ||
18 | multivariate/CHyQMOM/CHyQMOMMomentInversion.C | ||
19 | multivariate/CHyQMOMPlus/CHyQMOMPlusMomentInversion.C | ||
20 | multivariate/sizeCHyQMOM/sizeCHyQMOMMomentInversions.C | ||
21 | multivariate/TensorProduct/TensorProductMomentInversion.C | ||
16 | 22 | ||
17 | 23 | LIB = $(FOAM_USER_LIBBIN)/libmomentInversion | LIB = $(FOAM_USER_LIBBIN)/libmomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/Make/options changed (mode: 100644) (index 01849b9..a8161ed) | |||
... | ... | LIB_LIBS = \ | |
9 | 9 | -lfiniteVolume \ | -lfiniteVolume \ |
10 | 10 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
11 | 11 | -leigenSolver \ | -leigenSolver \ |
12 | -lvandermonde \ | ||
12 | 13 | -lmomentSets | -lmomentSets |
13 | 14 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/CHyQMOM/CHyQMOMMomentInversion.C renamed from multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/hyperbolic/hyperbolicConditionalMomentInversion.C (similarity 55%) (mode: 100644) (index f022d72..f383fef) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "hyperbolicConditionalMomentInversion.H" | ||
26 | #include "CHyQMOMMomentInversion.H" | ||
27 | 27 | #include "mappedLists.H" | #include "mappedLists.H" |
28 | #include "addToRunTimeSelectionTable.H" | ||
28 | 29 | ||
29 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 31 | ||
32 | namespace Foam | ||
33 | { | ||
34 | namespace multivariateMomentInversions | ||
35 | { | ||
36 | defineTypeNameAndDebug(CHyQMOM, 0); | ||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | multivariateMomentInversion, | ||
40 | CHyQMOM, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | |||
31 | 47 | const Foam::labelListList | const Foam::labelListList |
32 | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | ||
33 | ::twoDimMomentOrders = | ||
48 | Foam::multivariateMomentInversions::CHyQMOM::CHyQMOM::twoDimMomentOrders = | ||
34 | 49 | { | { |
35 | 50 | {0, 0}, | {0, 0}, |
36 | 51 | {1, 0}, | {1, 0}, |
... | ... | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | |
45 | 60 | }; | }; |
46 | 61 | ||
47 | 62 | const Foam::labelListList | const Foam::labelListList |
48 | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | ||
49 | ::threeDimMomentOrders = | ||
63 | Foam::multivariateMomentInversions::CHyQMOM::CHyQMOM::threeDimMomentOrders = | ||
50 | 64 | { | { |
51 | 65 | {0, 0, 0}, | {0, 0, 0}, |
52 | 66 | {1, 0, 0}, | {1, 0, 0}, |
... | ... | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | |
68 | 82 | ||
69 | 83 | ||
70 | 84 | const Foam::labelListList | const Foam::labelListList |
71 | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | ||
72 | ::twoDimNodeIndexes = | ||
85 | Foam::multivariateMomentInversions::CHyQMOM::CHyQMOM::twoDimNodeIndexes = | ||
73 | 86 | { | { |
87 | {0, 0}, | ||
88 | {0, 1}, | ||
89 | {0, 2}, | ||
90 | {1, 0}, | ||
74 | 91 | {1, 1}, | {1, 1}, |
75 | 92 | {1, 2}, | {1, 2}, |
76 | {1, 3}, | ||
93 | {2, 0}, | ||
77 | 94 | {2, 1}, | {2, 1}, |
78 | {2, 2}, | ||
79 | {2, 3}, | ||
80 | {3, 1}, | ||
81 | {3, 2}, | ||
82 | {3, 3} | ||
95 | {2, 2} | ||
83 | 96 | }; | }; |
84 | 97 | ||
85 | 98 | const Foam::labelListList | const Foam::labelListList |
86 | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | ||
87 | ::threeDimNodeIndexes = | ||
99 | Foam::multivariateMomentInversions::CHyQMOM::CHyQMOM::threeDimNodeIndexes = | ||
88 | 100 | { | { |
101 | {0, 0, 0}, | ||
102 | {0, 0, 1}, | ||
103 | {0, 0, 2}, | ||
104 | {0, 1, 0}, | ||
105 | {0, 1, 1}, | ||
106 | {0, 1, 2}, | ||
107 | {0, 2, 0}, | ||
108 | {0, 2, 1}, | ||
109 | {0, 2, 2}, | ||
110 | {1, 0, 0}, | ||
111 | {1, 0, 1}, | ||
112 | {1, 0, 2}, | ||
113 | {1, 1, 0}, | ||
89 | 114 | {1, 1, 1}, | {1, 1, 1}, |
90 | 115 | {1, 1, 2}, | {1, 1, 2}, |
91 | {1, 1, 3}, | ||
116 | {1, 2, 0}, | ||
92 | 117 | {1, 2, 1}, | {1, 2, 1}, |
93 | 118 | {1, 2, 2}, | {1, 2, 2}, |
94 | {1, 2, 3}, | ||
95 | {1, 3, 1}, | ||
96 | {1, 3, 2}, | ||
97 | {1, 3, 3}, | ||
119 | {2, 0, 0}, | ||
120 | {2, 0, 1}, | ||
121 | {2, 0, 2}, | ||
122 | {2, 1, 0}, | ||
98 | 123 | {2, 1, 1}, | {2, 1, 1}, |
99 | 124 | {2, 1, 2}, | {2, 1, 2}, |
100 | {2, 1, 3}, | ||
125 | {2, 2, 0}, | ||
101 | 126 | {2, 2, 1}, | {2, 2, 1}, |
102 | {2, 2, 2}, | ||
103 | {2, 2, 3}, | ||
104 | {2, 3, 1}, | ||
105 | {2, 3, 2}, | ||
106 | {2, 3, 3}, | ||
107 | {3, 1, 1}, | ||
108 | {3, 1, 2}, | ||
109 | {3, 1, 3}, | ||
110 | {3, 2, 1}, | ||
111 | {3, 2, 2}, | ||
112 | {3, 2, 3}, | ||
113 | {3, 3, 1}, | ||
114 | {3, 3, 2}, | ||
115 | {3, 3, 3} | ||
127 | {2, 2, 2} | ||
116 | 128 | }; | }; |
117 | 129 | ||
118 | 130 | ||
119 | Foam::label Foam::hyperbolicConditionalMomentInversion::getNMoments | ||
131 | Foam::label Foam::multivariateMomentInversions::CHyQMOM::getNMoments | ||
120 | 132 | ( | ( |
121 | 133 | const label nDims | const label nDims |
122 | ) const | ||
134 | ) | ||
123 | 135 | { | { |
124 | 136 | if (nDims == 1) | if (nDims == 1) |
125 | 137 | { | { |
... | ... | Foam::label Foam::hyperbolicConditionalMomentInversion::getNMoments | |
137 | 149 | } | } |
138 | 150 | ||
139 | 151 | ||
140 | Foam::labelListList Foam::hyperbolicConditionalMomentInversion::getMomentOrders | ||
152 | Foam::labelListList | ||
153 | Foam::multivariateMomentInversions::CHyQMOM::getMomentOrders | ||
141 | 154 | ( | ( |
142 | 155 | const label nDims | const label nDims |
143 | ) const | ||
156 | ) | ||
144 | 157 | { | { |
145 | 158 | if (nDims == 1) | if (nDims == 1) |
146 | 159 | { | { |
... | ... | Foam::labelListList Foam::hyperbolicConditionalMomentInversion::getMomentOrders | |
154 | 167 | { | { |
155 | 168 | return threeDimMomentOrders; | return threeDimMomentOrders; |
156 | 169 | } | } |
170 | |||
157 | 171 | return {{}}; | return {{}}; |
158 | 172 | } | } |
159 | 173 | ||
160 | 174 | ||
161 | Foam::label Foam::hyperbolicConditionalMomentInversion::getNNodes | ||
175 | Foam::label Foam::multivariateMomentInversions::CHyQMOM::getNNodes | ||
162 | 176 | ( | ( |
163 | 177 | const label nDims | const label nDims |
164 | ) const | ||
178 | ) | ||
165 | 179 | { | { |
166 | 180 | if (nDims == 1) | if (nDims == 1) |
167 | 181 | { | { |
... | ... | Foam::label Foam::hyperbolicConditionalMomentInversion::getNNodes | |
175 | 189 | { | { |
176 | 190 | return 27; | return 27; |
177 | 191 | } | } |
192 | |||
178 | 193 | return 0; | return 0; |
179 | 194 | } | } |
180 | 195 | ||
181 | 196 | ||
182 | Foam::labelListList Foam::hyperbolicConditionalMomentInversion::getNodeIndexes | ||
197 | Foam::labelListList | ||
198 | Foam::multivariateMomentInversions::CHyQMOM::getNodeIndexes | ||
183 | 199 | ( | ( |
184 | 200 | const label nDims | const label nDims |
185 | ) const | ||
201 | ) | ||
186 | 202 | { | { |
187 | 203 | if (nDims == 1) | if (nDims == 1) |
188 | 204 | { | { |
189 | return {{1}, {2}, {3}}; | ||
205 | return {{0}, {1}, {2}}; | ||
190 | 206 | } | } |
191 | 207 | else if (nDims == 2) | else if (nDims == 2) |
192 | 208 | { | { |
... | ... | Foam::labelListList Foam::hyperbolicConditionalMomentInversion::getNodeIndexes | |
196 | 212 | { | { |
197 | 213 | return threeDimNodeIndexes; | return threeDimNodeIndexes; |
198 | 214 | } | } |
215 | |||
199 | 216 | return {{}}; | return {{}}; |
200 | 217 | } | } |
201 | 218 | ||
202 | 219 | ||
203 | 220 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
204 | 221 | ||
205 | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | ||
222 | Foam::multivariateMomentInversions::CHyQMOM::CHyQMOM | ||
206 | 223 | ( | ( |
207 | 224 | const dictionary& dict, | const dictionary& dict, |
208 | const label nDimensions | ||
225 | const labelListList& momentOrders, | ||
226 | const labelListList& nodeIndexes, | ||
227 | const labelList& velocityIndexes | ||
209 | 228 | ) | ) |
210 | 229 | : | : |
211 | nDimensions_(nDimensions), | ||
212 | nMoments_(getNMoments(nDimensions)), | ||
213 | nNodes_(getNNodes(nDimensions)), | ||
214 | support_("R"), | ||
215 | moments_(nMoments_, getMomentOrders(nDimensions)), | ||
216 | abscissae_(nNodes_, getNodeIndexes(nDimensions)), | ||
217 | weights_(nNodes_, getNodeIndexes(nDimensions)), | ||
230 | multivariateMomentInversion | ||
231 | ( | ||
232 | dict, | ||
233 | momentOrders, | ||
234 | nodeIndexes, | ||
235 | velocityIndexes | ||
236 | ), | ||
218 | 237 | univariateInverter_ | univariateInverter_ |
219 | 238 | ( | ( |
220 | new hyperbolicMomentInversion(dict.subDict("basicQuadrature")) | ||
239 | new hyperbolicMomentInversion(dict) | ||
221 | 240 | ), | ), |
222 | 241 | etaMin_(dict.lookupOrDefault("etaMin", 1.0e-10)), | etaMin_(dict.lookupOrDefault("etaMin", 1.0e-10)), |
223 | 242 | qMax_(dict.lookupOrDefault("qMax", 30.0)), | qMax_(dict.lookupOrDefault("qMax", 30.0)), |
... | ... | Foam::hyperbolicConditionalMomentInversion::hyperbolicConditionalMomentInversion | |
236 | 255 | ||
237 | 256 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
238 | 257 | ||
239 | Foam::hyperbolicConditionalMomentInversion | ||
240 | ::~hyperbolicConditionalMomentInversion() | ||
258 | Foam::multivariateMomentInversions::CHyQMOM::~CHyQMOM() | ||
241 | 259 | {} | {} |
242 | 260 | ||
243 | 261 | ||
244 | 262 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
245 | Foam::scalar Foam::hyperbolicConditionalMomentInversion::calcQ | ||
263 | Foam::scalar Foam::multivariateMomentInversions::CHyQMOM::calcQ | ||
246 | 264 | ( | ( |
247 | 265 | scalar q, | scalar q, |
248 | 266 | scalar eta | scalar eta |
... | ... | Foam::scalar Foam::hyperbolicConditionalMomentInversion::calcQ | |
268 | 286 | } | } |
269 | 287 | } | } |
270 | 288 | ||
271 | void Foam::hyperbolicConditionalMomentInversion::realizabilityUnivariateMoments | ||
289 | void | ||
290 | Foam::multivariateMomentInversions::CHyQMOM::realizabilityUnivariateMoments | ||
272 | 291 | ( | ( |
273 | 292 | scalar& c2, | scalar& c2, |
274 | 293 | scalar& c3, | scalar& c3, |
275 | 294 | scalar& c4 | scalar& c4 |
276 | 295 | ) | ) |
277 | 296 | { | { |
278 | if (c2 < 0.0) | ||
297 | if (c2 <= 0.0) | ||
279 | 298 | { | { |
280 | 299 | c2 = 0.0; | c2 = 0.0; |
281 | 300 | c3 = 0.0; | c3 = 0.0; |
282 | 301 | c4 = 0.0; | c4 = 0.0; |
302 | |||
303 | return; | ||
283 | 304 | } | } |
284 | 305 | ||
285 | 306 | if (c2*c4 < pow3(c2) + sqr(c3)) | if (c2*c4 < pow3(c2) + sqr(c3)) |
... | ... | void Foam::hyperbolicConditionalMomentInversion::realizabilityUnivariateMoments | |
293 | 314 | } | } |
294 | 315 | } | } |
295 | 316 | ||
296 | void Foam::hyperbolicConditionalMomentInversion::invert1D | ||
317 | void Foam::multivariateMomentInversions::CHyQMOM::invert1D | ||
297 | 318 | ( | ( |
298 | 319 | const multivariateMomentSet& moments, | const multivariateMomentSet& moments, |
299 | 320 | scalarList& weights1D, | scalarList& weights1D, |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert1D | |
310 | 331 | weights1D[wi] = m0/scalar(nWeights1D); | weights1D[wi] = m0/scalar(nWeights1D); |
311 | 332 | abscissae1D[wi] = 0.0; | abscissae1D[wi] = 0.0; |
312 | 333 | } | } |
334 | |||
313 | 335 | return; | return; |
314 | 336 | }; | }; |
315 | 337 | ||
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert1D | |
355 | 377 | // Store univariate quadrature in first direction | // Store univariate quadrature in first direction |
356 | 378 | forAll(weights1D, wi) | forAll(weights1D, wi) |
357 | 379 | { | { |
358 | weights1D[wi] = univariateInverter_().weights()[wi]; | ||
359 | abscissae1D[wi] = univariateInverter_().abscissae()[wi]; | ||
380 | weights1D[wi] = m0*univariateInverter_().weights()[wi]; | ||
381 | abscissae1D[wi] = univariateInverter_().abscissae()[wi] + meanU; | ||
360 | 382 | } | } |
361 | 383 | } | } |
362 | 384 | ||
363 | void Foam::hyperbolicConditionalMomentInversion::invert2D | ||
385 | void Foam::multivariateMomentInversions::CHyQMOM::invert2D | ||
364 | 386 | ( | ( |
365 | 387 | const multivariateMomentSet& moments, | const multivariateMomentSet& moments, |
366 | 388 | mappedList<scalar>& weights2D, | mappedList<scalar>& weights2D, |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert2D | |
377 | 399 | weights2D[wi] = m00/scalar(nWeights2D); | weights2D[wi] = m00/scalar(nWeights2D); |
378 | 400 | abscissae2D[wi] = vector2D::zero; | abscissae2D[wi] = vector2D::zero; |
379 | 401 | } | } |
402 | |||
380 | 403 | return; | return; |
381 | 404 | }; | }; |
382 | 405 | ||
383 | 406 | // Calculate normalized moments | // Calculate normalized moments |
384 | mappedScalarList scaledMoments(moments); | ||
385 | |||
386 | forAll(scaledMoments, mi) | ||
387 | { | ||
388 | scaledMoments[mi] /= m00; | ||
389 | } | ||
407 | // Calculate normalized moments | ||
408 | scalar s10 = moments(1, 0)/m00; | ||
409 | scalar s01 = moments(0, 1)/m00; | ||
410 | scalar s11 = moments(1, 1)/m00; | ||
411 | scalar s20 = moments(2, 0)/m00; | ||
412 | scalar s02 = moments(0, 2)/m00; | ||
413 | scalar s30 = moments(3, 0)/m00; | ||
414 | scalar s03 = moments(0, 3)/m00; | ||
415 | scalar s40 = moments(4, 0)/m00; | ||
416 | scalar s04 = moments(0, 4)/m00; | ||
390 | 417 | ||
391 | 418 | // Mean velocities and powers | // Mean velocities and powers |
392 | scalar meanU = scaledMoments(1, 0); | ||
393 | scalar meanV = scaledMoments(0, 1); | ||
419 | scalar meanU = s10; | ||
420 | scalar meanV = s01; | ||
394 | 421 | scalar sqrMeanU = sqr(meanU); | scalar sqrMeanU = sqr(meanU); |
395 | 422 | scalar sqrMeanV = sqr(meanV); | scalar sqrMeanV = sqr(meanV); |
396 | 423 | ||
397 | 424 | // Calculate central moments | // Calculate central moments |
398 | mappedScalarList centralMoments(scaledMoments); | ||
399 | |||
400 | centralMoments(1, 0) = 0.0; | ||
401 | centralMoments(0, 1) = 0.0; | ||
425 | scalar c20 = s20 - sqrMeanU; | ||
426 | scalar c11 = s11 - meanU*meanV; | ||
427 | scalar c02 = s02 - sqrMeanV; | ||
428 | scalar c30 = s30; | ||
429 | scalar c03 = s03; | ||
430 | scalar c40 = s40; | ||
431 | scalar c04 = s04; | ||
402 | 432 | ||
403 | 433 | // NOTE: Sign changed due to -= operator | // NOTE: Sign changed due to -= operator |
404 | centralMoments(2, 0) -= sqrMeanU; | ||
405 | centralMoments(1, 1) -= meanU*meanV; | ||
406 | centralMoments(0, 2) -= sqrMeanV; | ||
407 | centralMoments(3, 0) -= (3.0*meanU*scaledMoments(2, 0) - 2.0*pow3(meanU)); | ||
408 | centralMoments(0, 3) -= (3.0*meanV*scaledMoments(0, 2) - 2.0*pow3(meanV)); | ||
409 | centralMoments(4, 0) -= (4.0*meanU*scaledMoments(3, 0) | ||
410 | - 6.0*sqrMeanU*scaledMoments(2, 0) + 3.0*sqr(sqrMeanU)); | ||
411 | |||
412 | centralMoments(0, 4) -= (4.0*meanV*scaledMoments(0, 3) | ||
413 | - 6.0*sqrMeanV*scaledMoments(0, 2) + 3.0*sqr(sqrMeanV)); | ||
434 | c30 -= (3.0*meanU*s20 - 2.0*pow3(meanU)); | ||
435 | c03 -= (3.0*meanV*s02 - 2.0*pow3(meanV)); | ||
436 | c40 -= (4.0*meanU*s30 - 6.0*sqrMeanU*s20 + 3.0*sqr(sqrMeanU)); | ||
437 | c04 -= (4.0*meanV*s03 - 6.0*sqrMeanV*s02 + 3.0*sqr(sqrMeanV)); | ||
414 | 438 | ||
439 | realizabilityUnivariateMoments(c20, c30, c40); | ||
440 | realizabilityUnivariateMoments(c02, c03, c04); | ||
415 | 441 | // One-dimensional inversion with realizability test | // One-dimensional inversion with realizability test |
416 | univariateMomentSet mDir1 | ||
417 | ( | ||
418 | { | ||
419 | 1.0, | ||
420 | 0.0, | ||
421 | centralMoments(2, 0), | ||
422 | centralMoments(3, 0), | ||
423 | centralMoments(4, 0) | ||
424 | }, | ||
425 | "R" | ||
426 | ); | ||
442 | univariateMomentSet mDir1({1.0, 0.0, c20, c30, c40}, "R"); | ||
427 | 443 | ||
428 | 444 | // Find univariate quadrature in first direction | // Find univariate quadrature in first direction |
429 | univariateInverter_().invert(mDir1); | ||
445 | univariateInverter_->invert(mDir1); | ||
430 | 446 | ||
431 | 447 | // Store univariate quadrature in first direction | // Store univariate quadrature in first direction |
432 | scalarList wDir1(univariateInverter_().weights()); | ||
433 | scalarList absDir1(univariateInverter_().abscissae()); | ||
448 | scalarList wDir1(univariateInverter_->weights()); | ||
449 | scalarList absDir1(univariateInverter_->abscissae()); | ||
434 | 450 | ||
435 | 451 | scalarList wDir2(3, 0.0); | scalarList wDir2(3, 0.0); |
436 | 452 | scalarList absDir2(3, 0.0); | scalarList absDir2(3, 0.0); |
437 | 453 | ||
438 | 454 | wDir2[1] = 1.0; | wDir2[1] = 1.0; |
439 | 455 | ||
440 | // Reconstruction settings | ||
441 | 456 | scalarList Vf(3, 0.0); | scalarList Vf(3, 0.0); |
442 | 457 | ||
443 | if (centralMoments(2, 0) < varMin_) | ||
458 | if (c20 < varMin_) | ||
444 | 459 | { | { |
445 | // Resetting quadrature in the first direction | ||
446 | 460 | wDir1 = 0.0; | wDir1 = 0.0; |
447 | 461 | wDir1[1] = 1.0; | wDir1[1] = 1.0; |
448 | 462 | ||
449 | univariateMomentSet mDir2 | ||
450 | ( | ||
451 | { | ||
452 | 1.0, | ||
453 | 0.0, | ||
454 | centralMoments(0, 2), | ||
455 | centralMoments(0, 3), | ||
456 | centralMoments(0, 4) | ||
457 | }, | ||
458 | "R" | ||
459 | ); | ||
463 | univariateMomentSet mDir2({1.0, 0.0, c02, c03, c04}, "R"); | ||
460 | 464 | ||
461 | 465 | //NOTE: Leave Vf elements null. AP | //NOTE: Leave Vf elements null. AP |
462 | |||
463 | univariateInverter_().invert(mDir2); | ||
466 | univariateInverter_->invert(mDir2); | ||
464 | 467 | ||
465 | 468 | forAll(wDir2, nodei) | forAll(wDir2, nodei) |
466 | 469 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert2D | |
470 | 473 | } | } |
471 | 474 | else | else |
472 | 475 | { | { |
476 | scalar sqrtC20 = sqrt(c20); | ||
477 | scalar c11s = c11/sqrtC20; | ||
478 | |||
479 | if (sqr(c11s) > c02*(1.0 - 1e-10)) | ||
480 | { | ||
481 | c11s = sign(c11s)*sqrt(c02); | ||
482 | } | ||
483 | |||
473 | 484 | forAll(Vf, vi) | forAll(Vf, vi) |
474 | 485 | { | { |
475 | Vf[vi] = centralMoments(1, 1)*absDir1[vi]/centralMoments(2, 0); | ||
486 | Vf[vi] = c11s*absDir1[vi]/sqrtC20; | ||
476 | 487 | } | } |
477 | 488 | ||
478 | 489 | // Compute conditional variance | // Compute conditional variance |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert2D | |
483 | 494 | sumVars += wDir1[vi]*sqr(Vf[vi]); | sumVars += wDir1[vi]*sqr(Vf[vi]); |
484 | 495 | } | } |
485 | 496 | ||
486 | scalar mu2Avg = max(centralMoments(0, 2) - sumVars, 0.0); | ||
497 | scalar mu2Avg = max(c02 - sumVars, 0.0); | ||
487 | 498 | ||
488 | 499 | scalarList mu(5, 0.0); | scalarList mu(5, 0.0); |
489 | 500 | mu[0] = 1.0; | mu[0] = 1.0; |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert2D | |
501 | 512 | sumWVf4 += wDir1[vi]*pow4(Vf[vi]); | sumWVf4 += wDir1[vi]*pow4(Vf[vi]); |
502 | 513 | } | } |
503 | 514 | ||
504 | scalar q = (centralMoments(0, 3) - sumWVf3)/sqrt(pow3(mu[2])); | ||
505 | |||
506 | scalar eta = | ||
507 | (centralMoments(0, 4) - sumWVf4 - 6.0*sumVars*mu[2])/sqr(mu[2]); | ||
515 | scalar q = (c03 - sumWVf3)/sqrt(pow3(mu[2])); | ||
516 | scalar eta = (c04 - sumWVf4 - 6.0*sumVars*mu[2])/sqr(mu[2]); | ||
508 | 517 | ||
509 | 518 | if (eta < sqr(q) + 1.0) | if (eta < sqr(q) + 1.0) |
510 | 519 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert2D | |
528 | 537 | "R" | "R" |
529 | 538 | ); | ); |
530 | 539 | ||
531 | univariateInverter_().invert(mMu); | ||
540 | univariateInverter_->invert(mMu); | ||
532 | 541 | ||
533 | 542 | forAll(wDir2, nodei) | forAll(wDir2, nodei) |
534 | 543 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert2D | |
539 | 548 | } | } |
540 | 549 | ||
541 | 550 | // Compute multivariate quadrature | // Compute multivariate quadrature |
542 | for (label i = 1; i <= 3; i++) | ||
551 | for (label i = 0; i < 3; i++) | ||
543 | 552 | { | { |
544 | for (label j = 1; j <= 3; j++) | ||
553 | for (label j = 0; j < 3; j++) | ||
545 | 554 | { | { |
546 | weights2D(i, j) = m00*wDir1[i - 1]*wDir2[j - 1]; | ||
555 | weights2D(i, j) = m00*wDir1[i]*wDir2[j]; | ||
547 | 556 | ||
548 | 557 | abscissae2D(i, j) = | abscissae2D(i, j) = |
549 | 558 | vector2D | vector2D |
550 | 559 | ( | ( |
551 | absDir1[i - 1] + meanU, | ||
552 | Vf[i - 1] + absDir2[j-1] + meanV | ||
560 | absDir1[i] + meanU, | ||
561 | Vf[i] + absDir2[j] + meanV | ||
553 | 562 | ); | ); |
554 | 563 | } | } |
555 | 564 | } | } |
556 | 565 | } | } |
557 | 566 | ||
558 | void Foam::hyperbolicConditionalMomentInversion::invert3D | ||
567 | void Foam::multivariateMomentInversions::CHyQMOM::invert3D | ||
559 | 568 | ( | ( |
560 | 569 | const multivariateMomentSet& moments | const multivariateMomentSet& moments |
561 | 570 | ) | ) |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
569 | 578 | }; | }; |
570 | 579 | ||
571 | 580 | // Calculate normalized moments | // Calculate normalized moments |
572 | mappedScalarList scaledMoments(moments); | ||
581 | scalar s100 = moments(1)/m000; | ||
582 | scalar s010 = moments(0, 1)/m000; | ||
583 | scalar s001 = moments(0, 0, 1)/m000; | ||
584 | scalar s200 = moments(2)/m000; | ||
585 | scalar s110 = moments(1, 1, 0)/m000; | ||
586 | scalar s101 = moments(1, 0, 1)/m000; | ||
587 | scalar s020 = moments(0, 2)/m000; | ||
588 | scalar s011 = moments(0, 1, 1)/m000; | ||
589 | scalar s002 = moments(0, 0, 2)/m000; | ||
590 | scalar s300 = moments(3)/m000; | ||
591 | scalar s030 = moments(0, 3)/m000; | ||
592 | scalar s003 = moments(0, 0, 3)/m000; | ||
593 | scalar s400 = moments(4)/m000; | ||
594 | scalar s040 = moments(0, 4)/m000; | ||
595 | scalar s004 = moments(0, 0, 4)/m000; | ||
573 | 596 | ||
574 | forAll(scaledMoments, mi) | ||
575 | { | ||
576 | scaledMoments[mi] /= m000; | ||
577 | } | ||
578 | |||
579 | // Mean velocities and powers | ||
580 | scalar meanU = scaledMoments(1, 0, 0); | ||
581 | scalar meanV = scaledMoments(0, 1, 0); | ||
582 | scalar meanW = scaledMoments(0, 0, 1); | ||
597 | // Calculate central moments | ||
598 | scalar meanU = s100; | ||
599 | scalar meanV = s010; | ||
600 | scalar meanW = s001; | ||
583 | 601 | scalar sqrMeanU = sqr(meanU); | scalar sqrMeanU = sqr(meanU); |
584 | 602 | scalar sqrMeanV = sqr(meanV); | scalar sqrMeanV = sqr(meanV); |
585 | 603 | scalar sqrMeanW = sqr(meanW); | scalar sqrMeanW = sqr(meanW); |
586 | 604 | ||
587 | // Calculate central moments | ||
588 | mappedScalarList centralMoments(scaledMoments); | ||
589 | |||
590 | centralMoments(1, 0, 0) = 0.0; | ||
591 | centralMoments(0, 1, 0) = 0.0; | ||
592 | centralMoments(0, 0, 1) = 0.0; | ||
605 | scalar c200 = s200; | ||
606 | scalar c110 = s110; | ||
607 | scalar c101 = s101; | ||
608 | scalar c011 = s011; | ||
609 | scalar c020 = s020; | ||
610 | scalar c002 = s002; | ||
611 | scalar c300 = s300; | ||
612 | scalar c030 = s030; | ||
613 | scalar c003 = s003; | ||
614 | scalar c400 = s400; | ||
615 | scalar c040 = s040; | ||
616 | scalar c004 = s004; | ||
593 | 617 | ||
594 | 618 | // NOTE: Sign changed due to -= operator | // NOTE: Sign changed due to -= operator |
595 | centralMoments(2, 0, 0) -= sqrMeanU; | ||
596 | centralMoments(0, 2, 0) -= sqrMeanV; | ||
597 | centralMoments(0, 0, 2) -= sqrMeanW; | ||
598 | centralMoments(3, 0, 0) -= | ||
599 | ( | ||
600 | 3.0*meanU*scaledMoments(2, 0, 0) | ||
601 | - 2.0*pow3(meanU) | ||
602 | ); | ||
603 | |||
604 | centralMoments(0, 3, 0) -= | ||
605 | ( | ||
606 | 3.0*meanV*scaledMoments(0, 2, 0) | ||
607 | - 2.0*pow3(meanV) | ||
608 | ); | ||
609 | |||
610 | centralMoments(0, 0, 3) -= | ||
611 | ( | ||
612 | 3.0*meanW*scaledMoments(0, 0, 2) | ||
613 | - 2.0*pow3(meanW) | ||
614 | ); | ||
615 | |||
616 | centralMoments(4, 0, 0) -= | ||
617 | ( | ||
618 | 4.0*meanU*scaledMoments(3, 0, 0) | ||
619 | - 6.0*sqrMeanU*scaledMoments(2, 0, 0) | ||
620 | + 3.0*pow4(meanU) | ||
621 | ); | ||
622 | |||
623 | centralMoments(0, 4, 0) -= | ||
624 | ( | ||
625 | 4.0*meanV*scaledMoments(0, 3, 0) | ||
626 | - 6.0*sqrMeanV*scaledMoments(0, 2, 0) | ||
627 | + 3.0*pow4(meanV) | ||
628 | ); | ||
629 | |||
630 | centralMoments(0, 0, 4) -= | ||
631 | ( | ||
632 | 4.0*meanW*scaledMoments(0, 0, 3) | ||
633 | - 6.0*sqrMeanW*scaledMoments(0, 0, 2) | ||
634 | + 3.0*pow4(meanW) | ||
635 | ); | ||
636 | |||
637 | if (m000 < SMALL) | ||
638 | { | ||
639 | // Use isotropic central moments | ||
640 | centralMoments(1, 1, 0) = 0.0; | ||
641 | centralMoments(1, 0, 1) = 0.0; | ||
642 | centralMoments(0, 1, 1) = 0.0; | ||
643 | } | ||
644 | else | ||
619 | c200 -= sqrMeanU; | ||
620 | c110 -= meanU*meanV; | ||
621 | c101 -= meanU*meanW; | ||
622 | c020 -= sqrMeanV; | ||
623 | c011 -= meanV*meanW; | ||
624 | c002 -= sqrMeanW; | ||
625 | |||
626 | c300 -= (3.0*meanU*s200 - 2.0*pow3(meanU)); | ||
627 | c030 -= (3.0*meanV*s020 - 2.0*pow3(meanV)); | ||
628 | c003 -= (3.0*meanW*s002 - 2.0*pow3(meanW)); | ||
629 | |||
630 | c400 -= (4.0*meanU*s300 - 6.0*sqrMeanU*s200 + 3.0*sqr(sqrMeanU)); | ||
631 | c040 -= (4.0*meanV*s030 - 6.0*sqrMeanV*s020 + 3.0*sqr(sqrMeanV)); | ||
632 | c004 -= (4.0*meanW*s003 - 6.0*sqrMeanW*s002 + 3.0*sqr(sqrMeanW)); | ||
633 | |||
634 | if (c200 <= 0.0) | ||
645 | 635 | { | { |
646 | centralMoments(1, 1, 0) -= meanU*meanV; | ||
647 | centralMoments(1, 0, 1) -= meanU*meanW; | ||
648 | centralMoments(0, 1, 1) -= meanV*meanW; | ||
636 | c200 = 0.0; | ||
637 | c300 = 0.0; | ||
638 | c400 = 0.0; | ||
649 | 639 | } | } |
650 | 640 | ||
651 | if (centralMoments(2, 0, 0) <= 0.0) | ||
652 | { | ||
653 | centralMoments(2, 0, 0) = 0.0; | ||
654 | centralMoments(3, 0, 0) = 0.0; | ||
655 | centralMoments(4, 0, 0) = 0.0; | ||
656 | } | ||
657 | |||
658 | scalar c200 = centralMoments(2, 0, 0); | ||
659 | |||
660 | if | ||
661 | ( | ||
662 | c200*centralMoments(4, 0, 0) | ||
663 | < pow3(c200) + sqr(centralMoments(3, 0, 0)) | ||
664 | ) | ||
641 | if (c200*c400 < pow3(c200) + sqr(c300)) | ||
665 | 642 | { | { |
666 | scalar q = centralMoments(3, 0, 0)/sqrt(pow3(c200)); | ||
667 | scalar eta = centralMoments(4, 0, 0)/sqr(c200); | ||
643 | scalar q = c300/sqrt(pow3(c200)); | ||
644 | scalar eta = c400/sqr(c200); | ||
668 | 645 | ||
669 | 646 | if (mag(q) > SMALL) | if (mag(q) > SMALL) |
670 | 647 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
672 | 649 | eta = 1.0 + sqr(q); | eta = 1.0 + sqr(q); |
673 | 650 | } | } |
674 | 651 | ||
675 | centralMoments(3, 0, 0) = q*sqrt(pow3(c200)); | ||
676 | centralMoments(4, 0, 0) = eta*sqr(c200); | ||
652 | c300 = q*sqrt(pow3(c200)); | ||
653 | c400 = eta*sqr(c200); | ||
677 | 654 | } | } |
678 | 655 | ||
679 | if (centralMoments(0, 2, 0) <= 0.0) | ||
656 | if (c020 <= 0.0) | ||
680 | 657 | { | { |
681 | centralMoments(0, 2, 0) = 0.0; | ||
682 | centralMoments(0, 3, 0) = 0.0; | ||
683 | centralMoments(0, 4, 0) = 0.0; | ||
658 | c020 = 0.0; | ||
659 | c030 = 0.0; | ||
660 | c040 = 0.0; | ||
684 | 661 | } | } |
685 | 662 | ||
686 | scalar c020 = centralMoments(0, 2, 0); | ||
687 | |||
688 | if | ||
689 | ( | ||
690 | c020*centralMoments(0, 4, 0) | ||
691 | < pow3(c020) + sqr(centralMoments(0, 3, 0)) | ||
692 | ) | ||
663 | if (c020*c040 < pow3(c020) + sqr(c030)) | ||
693 | 664 | { | { |
694 | scalar q = centralMoments(0, 3, 0)/sqrt(pow3(c020)); | ||
695 | scalar eta = centralMoments(0, 4, 0)/sqr(c020); | ||
665 | scalar q = c030/sqrt(pow3(c020)); | ||
666 | scalar eta = c040/sqr(c020); | ||
696 | 667 | ||
697 | 668 | if (mag(q) > SMALL) | if (mag(q) > SMALL) |
698 | 669 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
700 | 671 | eta = 1.0 + sqr(q); | eta = 1.0 + sqr(q); |
701 | 672 | } | } |
702 | 673 | ||
703 | centralMoments(0, 3, 0) = q*sqrt(pow3(c020)); | ||
704 | centralMoments(0, 4, 0) = eta*sqr(c020); | ||
674 | c030 = q*sqrt(pow3(c020)); | ||
675 | c040 = eta*sqr(c020); | ||
705 | 676 | } | } |
706 | 677 | ||
707 | if (centralMoments(0, 0, 2) <= 0.0) | ||
678 | if (c002 <= 0.0) | ||
708 | 679 | { | { |
709 | centralMoments(0, 0, 2) = 0.0; | ||
710 | centralMoments(0, 0, 3) = 0.0; | ||
711 | centralMoments(0, 0, 4) = 0.0; | ||
680 | c002 = 0.0; | ||
681 | c003 = 0.0; | ||
682 | c004 = 0.0; | ||
712 | 683 | } | } |
713 | 684 | ||
714 | scalar c002 = centralMoments(0, 0, 2); | ||
715 | |||
716 | if | ||
717 | ( | ||
718 | c002*centralMoments(0, 0, 4) | ||
719 | < pow3(c002) + sqr(centralMoments(0, 0, 3)) | ||
720 | ) | ||
685 | if (c002*c004 < pow3(c002) + sqr(c003)) | ||
721 | 686 | { | { |
722 | scalar q = centralMoments(0, 0, 3)/sqrt(pow3(c002)); | ||
723 | scalar eta = centralMoments(0, 0, 4)/sqr(c002); | ||
687 | scalar q = c003/sqrt(pow3(c002)); | ||
688 | scalar eta = c004/sqr(c002); | ||
724 | 689 | ||
725 | 690 | if (mag(q) > SMALL) | if (mag(q) > SMALL) |
726 | 691 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
728 | 693 | eta = 1.0 + sqr(q); | eta = 1.0 + sqr(q); |
729 | 694 | } | } |
730 | 695 | ||
731 | centralMoments(0, 0, 3) = q*sqrt(pow3(c002)); | ||
732 | centralMoments(0, 0, 4) = eta*sqr(c002); | ||
696 | c003 = q*sqrt(pow3(c002)); | ||
697 | c004 = eta*sqr(c002); | ||
733 | 698 | } | } |
734 | 699 | ||
735 | 700 | // Invert first direction | // Invert first direction |
736 | univariateMomentSet mDir1 | ||
737 | ( | ||
738 | { | ||
739 | 1.0, | ||
740 | 0.0, | ||
741 | centralMoments(2, 0, 0), | ||
742 | centralMoments(3, 0, 0), | ||
743 | centralMoments(4, 0, 0) | ||
744 | }, | ||
745 | "R" | ||
746 | ); | ||
701 | univariateMomentSet mDir1({1.0, 0.0, c200, c300, c400}, "R"); | ||
702 | |||
747 | 703 | // Find univariate quadrature in first direction | // Find univariate quadrature in first direction |
748 | 704 | univariateInverter_().invert(mDir1); | univariateInverter_().invert(mDir1); |
749 | 705 | ||
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
752 | 708 | scalarList absDir1(univariateInverter_().abscissae()); | scalarList absDir1(univariateInverter_().abscissae()); |
753 | 709 | ||
754 | 710 | // X direction is degenerate | // X direction is degenerate |
755 | if (centralMoments(2, 0, 0) < varMin_) | ||
711 | if (c200 < varMin_) | ||
756 | 712 | { | { |
757 | 713 | // X and y directions are degenerate | // X and y directions are degenerate |
758 | if (centralMoments(0, 2, 0) < varMin_) | ||
714 | if (c020 < varMin_) | ||
759 | 715 | { | { |
760 | univariateMomentSet mDir3 | ||
761 | ( | ||
762 | { | ||
763 | 1.0, | ||
764 | 0.0, | ||
765 | centralMoments(0, 0, 2), | ||
766 | centralMoments(0, 0, 3), | ||
767 | centralMoments(0, 0, 4) | ||
768 | }, | ||
769 | "R" | ||
770 | ); | ||
716 | univariateMomentSet mDir3({1.0, 0.0, c002, c003, c004}, "R"); | ||
771 | 717 | ||
772 | 718 | // Find univariate quadrature in first direction | // Find univariate quadrature in first direction |
773 | 719 | univariateInverter_().invert(mDir3); | univariateInverter_().invert(mDir3); |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
776 | 722 | scalarList wDir3(univariateInverter_().weights()); | scalarList wDir3(univariateInverter_().weights()); |
777 | 723 | scalarList absDir3(univariateInverter_().abscissae()); | scalarList absDir3(univariateInverter_().abscissae()); |
778 | 724 | ||
779 | for(label i = 1; i <= 3; i++) | ||
725 | for(label i = 0; i < 3; i++) | ||
780 | 726 | { | { |
781 | weights_(2, 2, i) = m000*wDir3[i - 1]; | ||
782 | abscissae_(2, 2, i) = | ||
727 | weights_(1, 1, i) = m000*wDir3[i]; | ||
728 | velocityAbscissae_(1, 1, i) = | ||
783 | 729 | vector | vector |
784 | 730 | ( | ( |
785 | 731 | meanU, | meanU, |
786 | 732 | meanV, | meanV, |
787 | absDir3[i - 1] + meanW | ||
733 | absDir3[i] + meanW | ||
788 | 734 | ); | ); |
789 | 735 | } | } |
790 | 736 | ||
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
799 | 745 | 1.0, | 1.0, |
800 | 746 | 0.0, | 0.0, |
801 | 747 | 0.0, | 0.0, |
802 | centralMoments(0, 2, 0), | ||
803 | centralMoments(0, 1, 1), | ||
804 | centralMoments(0, 0, 2), | ||
805 | centralMoments(0, 3, 0), | ||
806 | centralMoments(0, 0, 3), | ||
807 | centralMoments(0, 4, 0), | ||
808 | centralMoments(0, 0, 4) | ||
748 | c020, | ||
749 | c011, | ||
750 | c002, | ||
751 | c030, | ||
752 | c003, | ||
753 | c040, | ||
754 | c004 | ||
809 | 755 | }, | }, |
810 | 756 | twoDimMomentOrders, | twoDimMomentOrders, |
811 | 757 | "R" | "R" |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
821 | 767 | ||
822 | 768 | invert2D(mDir23, wDir23, absDir23); | invert2D(mDir23, wDir23, absDir23); |
823 | 769 | ||
824 | for (label j = 1; j <= 3; j++) | ||
770 | for (label j = 0; j < 3; j++) | ||
825 | 771 | { | { |
826 | for (label k = 1; k <= 3; k++) | ||
772 | for (label k = 0; k < 3; k++) | ||
827 | 773 | { | { |
828 | weights_(2, j, k) = m000*wDir23(j, k); | ||
829 | abscissae_(2, j, k) = | ||
774 | weights_(1, j, k) = m000*wDir23(j, k); | ||
775 | velocityAbscissae_(1, j, k) = | ||
830 | 776 | vector | vector |
831 | 777 | ( | ( |
832 | 778 | meanU, | meanU, |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
840 | 786 | } | } |
841 | 787 | } | } |
842 | 788 | // Y direction is degenerate | // Y direction is degenerate |
843 | else if (centralMoments(0, 2, 0) < varMin_) | ||
789 | else if (c020 < varMin_) | ||
844 | 790 | { | { |
845 | 791 | multivariateMomentSet mDir13 | multivariateMomentSet mDir13 |
846 | 792 | ( | ( |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
848 | 794 | 1.0, | 1.0, |
849 | 795 | 0.0, | 0.0, |
850 | 796 | 0.0, | 0.0, |
851 | centralMoments(2, 0, 0), | ||
852 | centralMoments(1, 0, 1), | ||
853 | centralMoments(0, 0, 2), | ||
854 | centralMoments(3, 0, 0), | ||
855 | centralMoments(0, 0, 3), | ||
856 | centralMoments(4, 0, 0), | ||
857 | centralMoments(0, 0, 4) | ||
797 | c200, | ||
798 | c101, | ||
799 | c002, | ||
800 | c300, | ||
801 | c003, | ||
802 | c400, | ||
803 | c004 | ||
858 | 804 | }, | }, |
859 | 805 | twoDimMomentOrders, | twoDimMomentOrders, |
860 | 806 | "R" | "R" |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
870 | 816 | ||
871 | 817 | invert2D(mDir13, wDir13, absDir13); | invert2D(mDir13, wDir13, absDir13); |
872 | 818 | ||
873 | for (label i = 1; i <= 3; i++) | ||
819 | for (label i = 0; i < 3; i++) | ||
874 | 820 | { | { |
875 | for (label k = 1; k <= 3; k++) | ||
821 | for (label k = 0; k < 3; k++) | ||
876 | 822 | { | { |
877 | weights_(i, 2, k) = m000*wDir13(i, k); | ||
878 | abscissae_(i, 2, k) = | ||
823 | weights_(i, 1, k) = m000*wDir13(i, k); | ||
824 | velocityAbscissae_(i, 1, k) = | ||
879 | 825 | vector | vector |
880 | 826 | ( | ( |
881 | 827 | absDir13(i, k).x() + meanU, | absDir13(i, k).x() + meanU, |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
896 | 842 | 1.0, | 1.0, |
897 | 843 | 0.0, | 0.0, |
898 | 844 | 0.0, | 0.0, |
899 | centralMoments(2, 0, 0), | ||
900 | centralMoments(1, 1, 0), | ||
901 | centralMoments(0, 2, 0), | ||
902 | centralMoments(3, 0, 0), | ||
903 | centralMoments(0, 3, 0), | ||
904 | centralMoments(4, 0, 0), | ||
905 | centralMoments(0, 4, 0) | ||
845 | c200, | ||
846 | c110, | ||
847 | c020, | ||
848 | c300, | ||
849 | c030, | ||
850 | c400, | ||
851 | c040 | ||
906 | 852 | }, | }, |
907 | 853 | twoDimMomentOrders, | twoDimMomentOrders, |
908 | 854 | "R" | "R" |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
919 | 865 | invert2D(mDir12, wDir12, abscissaeDir12); | invert2D(mDir12, wDir12, abscissaeDir12); |
920 | 866 | ||
921 | 867 | // Z direction is degenerate | // Z direction is degenerate |
922 | if (centralMoments(0, 0, 2) < varMin_) | ||
868 | if (c002 < varMin_) | ||
923 | 869 | { | { |
924 | for (label i = 1; i <= 3; i++) | ||
870 | for (label i = 0; i < 3; i++) | ||
925 | 871 | { | { |
926 | for (label j = 1; j <= 3; j++) | ||
872 | for (label j = 0; j < 3; j++) | ||
927 | 873 | { | { |
928 | weights_(i, j, 2) = m000*wDir12(i, j); | ||
929 | abscissae_(i, j, 2).x() = abscissaeDir12(i, j).x() + meanU; | ||
930 | abscissae_(i, j, 2).y() = abscissaeDir12(i, j).y() + meanV; | ||
874 | weights_(i, j, 1) = m000*wDir12(i, j); | ||
875 | velocityAbscissae_(i, j, 1).x() = | ||
876 | abscissaeDir12(i, j).x() + meanU; | ||
877 | velocityAbscissae_(i, j, 1).y() = | ||
878 | abscissaeDir12(i, j).y() + meanV; | ||
931 | 879 | } | } |
932 | 880 | } | } |
933 | 881 | ||
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
941 | 889 | scalar sumWeights2 = 0.0; | scalar sumWeights2 = 0.0; |
942 | 890 | scalar sumWeights3 = 0.0; | scalar sumWeights3 = 0.0; |
943 | 891 | ||
944 | for (label i = 1; i <= 3; i++) | ||
892 | for (label i = 0; i < 3; i++) | ||
945 | 893 | { | { |
946 | sumWeights1 += wDir12(1, i); | ||
947 | sumWeights2 += wDir12(2, i); | ||
948 | sumWeights3 += wDir12(3, i); | ||
894 | sumWeights1 += wDir12(0, i); | ||
895 | sumWeights2 += wDir12(1, i); | ||
896 | sumWeights3 += wDir12(2, i); | ||
949 | 897 | } | } |
950 | 898 | ||
951 | for (label i = 1; i <= 3; i++) | ||
899 | for (label i = 0; i < 3; i++) | ||
952 | 900 | { | { |
953 | wDir12(1, i) /= sumWeights1; | ||
954 | wDir12(2, i) /= sumWeights2; | ||
955 | wDir12(3, i) /= sumWeights3; | ||
901 | wDir12(0, i) /= sumWeights1; | ||
902 | wDir12(1, i) /= sumWeights2; | ||
903 | wDir12(2, i) /= sumWeights3; | ||
956 | 904 | } | } |
957 | 905 | ||
958 | 906 | // Compute Vf reconstruction | // Compute Vf reconstruction |
959 | 907 | scalarList Vf(3, 0.0); | scalarList Vf(3, 0.0); |
960 | for (label i = 1; i <= 3; i++) | ||
908 | for (label i = 0; i < 3; i++) | ||
961 | 909 | { | { |
962 | Vf[0] += wDir12(1, i)*abscissaeDir12(1, i).y(); | ||
963 | |||
964 | Vf[1] += wDir12(2, i)*abscissaeDir12(2, i).y(); | ||
965 | |||
966 | Vf[2] += wDir12(3, i)*abscissaeDir12(3, i).y(); | ||
910 | Vf[0] += wDir12(0, i)*abscissaeDir12(0, i).y(); | ||
911 | Vf[1] += wDir12(1, i)*abscissaeDir12(1, i).y(); | ||
912 | Vf[2] += wDir12(2, i)*abscissaeDir12(2, i).y(); | ||
967 | 913 | } | } |
968 | 914 | ||
969 | 915 | mappedList<scalar> absDir12(9, twoDimNodeIndexes, 0.0); | mappedList<scalar> absDir12(9, twoDimNodeIndexes, 0.0); |
970 | for (label i = 1; i <= 3; i++) | ||
916 | for (label i = 0; i < 3; i++) | ||
971 | 917 | { | { |
972 | for (label j = 1; j <= 3; j++) | ||
918 | for (label j = 0; j < 3; j++) | ||
973 | 919 | { | { |
974 | absDir12(i, j) = abscissaeDir12(i, j).y() - Vf[i-1]; | ||
920 | absDir12(i, j) = abscissaeDir12(i, j).y() - Vf[i]; | ||
975 | 921 | } | } |
976 | 922 | } | } |
977 | 923 | ||
978 | scalar sqrtC200 = sqrt(centralMoments(2,0,0)); | ||
979 | scalar sqrtC020 = sqrt(centralMoments(0,2,0)); | ||
980 | scalar sqrtC002 = sqrt(centralMoments(0,0,2)); | ||
924 | scalar sqrtC200 = sqrt(c200); | ||
925 | scalar sqrtC020 = sqrt(c020); | ||
926 | scalar sqrtC002 = sqrt(c002); | ||
981 | 927 | ||
982 | 928 | scalarSquareMatrix W1(3, 0.0); | scalarSquareMatrix W1(3, 0.0); |
983 | 929 | scalarSquareMatrix W2(3, 0.0); | scalarSquareMatrix W2(3, 0.0); |
984 | 930 | scalarSquareMatrix Vp(3, 0.0); | scalarSquareMatrix Vp(3, 0.0); |
985 | 931 | ||
986 | for (label i = 1; i <= 3; i++) | ||
932 | for (label i = 0; i < 3; i++) | ||
987 | 933 | { | { |
988 | W1(i-1, i-1) = wDir1[i-1]; | ||
989 | for (label j = 1; j <= 3; j++) | ||
934 | W1(i, i) = wDir1[i]; | ||
935 | for (label j = 0; j < 3; j++) | ||
990 | 936 | { | { |
991 | W2(i-1, j-1) = wDir12(i, j); | ||
992 | Vp(i-1, j-1) = absDir12(i, j); | ||
937 | W2(i, j) = wDir12(i, j); | ||
938 | Vp(i, j) = absDir12(i, j); | ||
993 | 939 | } | } |
994 | 940 | } | } |
995 | 941 | ||
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
1018 | 964 | } | } |
1019 | 965 | } | } |
1020 | 966 | ||
1021 | scalar c101s = centralMoments(1,0,1)/sqrtC200; | ||
1022 | scalar c011s = centralMoments(0,1,1)/sqrtC020; | ||
967 | scalar c101s = c101/sqrtC200; | ||
968 | scalar c011s = c011/sqrtC020; | ||
1023 | 969 | ||
1024 | if (sqr(c101s) >= centralMoments(0,0,2)*(1.0 - SMALL)) | ||
970 | if (sqr(c101s) >= c002*(1.0 - SMALL)) | ||
1025 | 971 | { | { |
1026 | 972 | c101s = sign(c101s)*sqrtC002; | c101s = sign(c101s)*sqrtC002; |
1027 | 973 | } | } |
1028 | else if (sqr(c011s) >= centralMoments(0,0,2)*(1.0 - SMALL)) | ||
974 | else if (sqr(c011s) >= c002*(1.0 - SMALL)) | ||
1029 | 975 | { | { |
1030 | scalar c110s = centralMoments(1,1,0)/(sqrtC200*sqrtC020); | ||
976 | scalar c110s = c110/(sqrtC200*sqrtC020); | ||
1031 | 977 | c011s = sign(c011s)*sqrtC002; | c011s = sign(c011s)*sqrtC002; |
1032 | 978 | c101s = c110s*c011s; | c101s = c110s*c011s; |
1033 | 979 | } | } |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
1053 | 999 | } | } |
1054 | 1000 | ||
1055 | 1001 | scalarList mu(5, 0.0); | scalarList mu(5, 0.0); |
1056 | mu[2] = max(centralMoments(0,0,2) - sumVarDir3, 0.0); | ||
1002 | mu[2] = max(c002 - sumVarDir3, 0.0); | ||
1057 | 1003 | ||
1058 | 1004 | scalar q = 0; | scalar q = 0; |
1059 | 1005 | scalar eta = 1; | scalar eta = 1; |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
1073 | 1019 | } | } |
1074 | 1020 | sum4 += + 6.0*sumVarDir3*mu[2]; | sum4 += + 6.0*sumVarDir3*mu[2]; |
1075 | 1021 | ||
1076 | q = (centralMoments(0,0,3) - sum3)/sum1; | ||
1077 | eta = (centralMoments(0,0,4) - sum4)/sum2; | ||
1022 | q = (c003 - sum3)/sum1; | ||
1023 | eta = (c004 - sum4)/sum2; | ||
1078 | 1024 | ||
1079 | 1025 | if (eta < sqr(q) + 1) | if (eta < sqr(q) + 1) |
1080 | 1026 | { | { |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
1086 | 1032 | mu[4] = eta*sqr(mu[2]); | mu[4] = eta*sqr(mu[2]); |
1087 | 1033 | ||
1088 | 1034 | // Invert final direction | // Invert final direction |
1089 | univariateMomentSet mDir3 | ||
1090 | ( | ||
1091 | { | ||
1092 | 1.0, | ||
1093 | 0.0, | ||
1094 | mu[2], | ||
1095 | mu[3], | ||
1096 | mu[4] | ||
1097 | }, | ||
1098 | "R" | ||
1099 | ); | ||
1035 | univariateMomentSet mDir3({1.0, 0.0, mu[2], mu[3], mu[4]}, "R"); | ||
1036 | |||
1100 | 1037 | // Find univariate quadrature in final direction | // Find univariate quadrature in final direction |
1101 | 1038 | univariateInverter_().invert(mDir3); | univariateInverter_().invert(mDir3); |
1102 | 1039 | ||
1103 | 1040 | scalarList wDir3(univariateInverter_().weights()); | scalarList wDir3(univariateInverter_().weights()); |
1104 | 1041 | scalarList absDir3(univariateInverter_().abscissae()); | scalarList absDir3(univariateInverter_().abscissae()); |
1105 | 1042 | ||
1106 | for (label i = 1; i <= 3; i++) | ||
1043 | for (label i = 0; i < 3; i++) | ||
1107 | 1044 | { | { |
1108 | for (label j = 1; j <= 3; j++) | ||
1045 | for (label j = 0; j < 3; j++) | ||
1109 | 1046 | { | { |
1110 | for (label k = 1; k <= 3; k++) | ||
1047 | for (label k = 0; k < 3; k++) | ||
1111 | 1048 | { | { |
1112 | 1049 | weights_(i, j, k) = | weights_(i, j, k) = |
1113 | m000*wDir1[i-1]*wDir12(i, j)*wDir3[k-1]; | ||
1050 | m000*wDir1[i]*wDir12(i, j)*wDir3[k]; | ||
1114 | 1051 | ||
1115 | abscissae_(i, j, k) = | ||
1052 | velocityAbscissae_(i, j, k) = | ||
1116 | 1053 | vector | vector |
1117 | 1054 | ( | ( |
1118 | absDir1[i-1] + meanU, | ||
1119 | Vf[i-1] + absDir12(i, j) + meanV, | ||
1120 | Wf(i-1, j-1) + absDir3[k-1] + meanW | ||
1055 | absDir1[i] + meanU, | ||
1056 | Vf[i] + absDir12(i, j) + meanV, | ||
1057 | Wf(i, j) + absDir3[k] + meanW | ||
1121 | 1058 | ); | ); |
1122 | 1059 | } | } |
1123 | 1060 | } | } |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert3D | |
1127 | 1064 | } | } |
1128 | 1065 | } | } |
1129 | 1066 | ||
1130 | void Foam::hyperbolicConditionalMomentInversion::invert | ||
1067 | bool Foam::multivariateMomentInversions::CHyQMOM::invert | ||
1131 | 1068 | ( | ( |
1132 | 1069 | const multivariateMomentSet& moments | const multivariateMomentSet& moments |
1133 | 1070 | ) | ) |
1134 | 1071 | { | { |
1135 | 1072 | reset(); | reset(); |
1136 | if (nDimensions_ == 3) | ||
1073 | |||
1074 | if (nvelocityDimensions_ == 3) | ||
1137 | 1075 | { | { |
1138 | 1076 | invert3D(moments); | invert3D(moments); |
1139 | 1077 | } | } |
1140 | else if (nDimensions_ == 2) | ||
1078 | else if (nvelocityDimensions_ == 2) | ||
1141 | 1079 | { | { |
1142 | mappedList<scalar> w | ||
1080 | mappedScalarList w | ||
1143 | 1081 | ( | ( |
1144 | nNodes_, | ||
1082 | getNNodes(2), | ||
1145 | 1083 | twoDimNodeIndexes | twoDimNodeIndexes |
1146 | 1084 | ); | ); |
1147 | 1085 | mappedList<vector2D> u | mappedList<vector2D> u |
1148 | 1086 | ( | ( |
1149 | nNodes_, | ||
1087 | getNNodes(2), | ||
1150 | 1088 | twoDimNodeIndexes | twoDimNodeIndexes |
1151 | 1089 | ); | ); |
1152 | 1090 | ||
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert | |
1155 | 1093 | forAll(u, nodei) | forAll(u, nodei) |
1156 | 1094 | { | { |
1157 | 1095 | weights_[nodei] = w[nodei]; | weights_[nodei] = w[nodei]; |
1158 | abscissae_[nodei] = | ||
1096 | velocityAbscissae_[nodei] = | ||
1159 | 1097 | vector | vector |
1160 | 1098 | ( | ( |
1161 | 1099 | u[nodei].x(), | u[nodei].x(), |
... | ... | void Foam::hyperbolicConditionalMomentInversion::invert | |
1166 | 1104 | } | } |
1167 | 1105 | else | else |
1168 | 1106 | { | { |
1169 | scalarList w(nNodes_, 0.0); | ||
1170 | scalarList u(nNodes_, 0.0); | ||
1107 | scalarList w(getNNodes(1), 0.0); | ||
1108 | scalarList u(getNNodes(1), 0.0); | ||
1171 | 1109 | ||
1172 | 1110 | invert1D(moments, w, u); | invert1D(moments, w, u); |
1173 | 1111 | ||
1174 | forAll(u, nodei) | ||
1112 | forAll(w, nodei) | ||
1175 | 1113 | { | { |
1176 | 1114 | weights_[nodei] = w[nodei]; | weights_[nodei] = w[nodei]; |
1177 | abscissae_[nodei] = vector(u[nodei], 0.0, 0.0); | ||
1115 | velocityAbscissae_[nodei] = vector(u[nodei], 0.0, 0.0); | ||
1178 | 1116 | } | } |
1179 | 1117 | } | } |
1180 | } | ||
1181 | 1118 | ||
1182 | void Foam::hyperbolicConditionalMomentInversion::reset() | ||
1183 | { | ||
1184 | forAll(weights_, nodei) | ||
1185 | { | ||
1186 | weights_[nodei] = 0.0; | ||
1187 | abscissae_[nodei] = vector::zero; | ||
1188 | } | ||
1119 | return true; | ||
1189 | 1120 | } | } |
1190 | 1121 | ||
1191 | 1122 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/CHyQMOM/CHyQMOMMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/hyperbolic/hyperbolicConditionalMomentInversion.H (similarity 67%) (mode: 100644) (index 1de2655..1cedb32) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::hyperbolicConditionalMomentInversion | ||
25 | Foam::multivariateMomentInversions::CHyQMOM | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Implementation of the hyperbolic conditional quadrature method of moment | Implementation of the hyperbolic conditional quadrature method of moment |
... | ... | Description | |
30 | 30 | is verified analytically. | is verified analytically. |
31 | 31 | ||
32 | 32 | SourceFiles | SourceFiles |
33 | hyperbolicConditionalMomentInversion.C | ||
34 | hyperbolicConditionalMomentInversionI.C | ||
33 | CHyQMOMMomentInversion.C | ||
35 | 34 | ||
36 | 35 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
37 | 36 | ||
38 | #ifndef hyperbolicConditionalMomentInversion_H | ||
39 | #define hyperbolicConditionalMomentInversion_H | ||
37 | #ifndef CHyQMOMMomentInversion_H | ||
38 | #define CHyQMOMMomentInversion_H | ||
40 | 39 | ||
41 | 40 | ||
42 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
... | ... | SourceFiles | |
48 | 47 | #include "dictionary.H" | #include "dictionary.H" |
49 | 48 | #include "mappedList.H" | #include "mappedList.H" |
50 | 49 | #include "univariateMomentSet.H" | #include "univariateMomentSet.H" |
51 | #include "multivariateMomentSet.H" | ||
50 | #include "multivariateMomentInversion.H" | ||
52 | 51 | #include "hyperbolicMomentInversion.H" | #include "hyperbolicMomentInversion.H" |
53 | 52 | ||
54 | 53 | ||
55 | 54 | namespace Foam | namespace Foam |
56 | 55 | { | { |
56 | namespace multivariateMomentInversions | ||
57 | { | ||
57 | 58 | ||
58 | 59 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
59 | Class hyperbolicConditionalMomentInversion Declaration | ||
60 | Class CHyQMOM Declaration | ||
60 | 61 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
61 | class hyperbolicConditionalMomentInversion | ||
62 | class CHyQMOM | ||
63 | : | ||
64 | public multivariateMomentInversion | ||
62 | 65 | { | { |
63 | 66 | // Private member data | // Private member data |
64 | 67 | ||
65 | //- Number of dimensions in velocity space | ||
66 | const label nDimensions_; | ||
67 | |||
68 | //- Number of moments | ||
69 | const label nMoments_; | ||
70 | |||
71 | //- List of the number of nodes | ||
72 | const label nNodes_; | ||
73 | |||
74 | //- Support of the NDF | ||
75 | const word support_; | ||
76 | |||
77 | //- Moments | ||
78 | mappedList<scalar> moments_; | ||
79 | |||
80 | //- Quadratrure abscissae | ||
81 | mappedList<vector> abscissae_; | ||
82 | |||
83 | //- Quadratrure weights | ||
84 | mappedList<scalar> weights_; | ||
85 | |||
86 | 68 | //- Univariate moment inversion method | //- Univariate moment inversion method |
87 | 69 | autoPtr<hyperbolicMomentInversion> univariateInverter_; | autoPtr<hyperbolicMomentInversion> univariateInverter_; |
88 | 70 | ||
... | ... | class hyperbolicConditionalMomentInversion | |
137 | 119 | const multivariateMomentSet& moments | const multivariateMomentSet& moments |
138 | 120 | ); | ); |
139 | 121 | ||
140 | //- Reset inverter | ||
141 | void reset(); | ||
142 | |||
143 | //- Return the number of moments given a number of dimensions | ||
144 | label getNMoments(const label nDims) const; | ||
145 | |||
146 | //- Return the moment orders give a number of dimensions | ||
147 | labelListList getMomentOrders(const label nDims) const; | ||
148 | |||
149 | //- Return the number of nodes given a number of dimensions | ||
150 | label getNNodes(const label nDims) const; | ||
151 | |||
152 | //- Return the node indexes give a number of dimensions | ||
153 | labelListList getNodeIndexes(const label nDims) const; | ||
154 | |||
155 | //- Disallow default bitwise copy construct | ||
156 | //hyperbolicConditionalMomentInversion(const hyperbolicConditionalMomentInversion&); | ||
157 | 122 | ||
158 | //- Disallow default bitwise assignment | ||
159 | //void operator=(const hyperbolicConditionalMomentInversion&); | ||
123 | public: | ||
160 | 124 | ||
125 | //- Runtime type information | ||
126 | TypeName("CHyQMOM"); | ||
161 | 127 | ||
162 | public: | ||
163 | 128 | ||
164 | 129 | // Constructors | // Constructors |
165 | 130 | ||
166 | 131 | // Construct from nMoments, momentMap, nNodes, and support type | // Construct from nMoments, momentMap, nNodes, and support type |
167 | hyperbolicConditionalMomentInversion | ||
132 | CHyQMOM | ||
168 | 133 | ( | ( |
169 | 134 | const dictionary& dict, | const dictionary& dict, |
170 | const label nDimensions | ||
135 | const labelListList& momentOrders, | ||
136 | const labelListList& nodeIndexes, | ||
137 | const labelList& velocityIndexes | ||
171 | 138 | ); | ); |
172 | 139 | ||
173 | 140 | ||
174 | 141 | //- Destructor | //- Destructor |
175 | virtual ~hyperbolicConditionalMomentInversion(); | ||
142 | virtual ~CHyQMOM(); | ||
176 | 143 | ||
177 | 144 | // Static data | // Static data |
178 | 145 | ||
146 | //- Return the number of moments given a number of dimensions | ||
147 | static label getNMoments(const label nDims); | ||
148 | |||
149 | //- Return the moment orders give a number of dimensions | ||
150 | static labelListList getMomentOrders(const label nDims); | ||
151 | |||
152 | //- Return the number of nodes given a number of dimensions | ||
153 | static label getNNodes(const label nDims); | ||
154 | |||
155 | //- Return the node indexes give a number of dimensions | ||
156 | static labelListList getNodeIndexes(const label nDims); | ||
157 | |||
179 | 158 | //- List of moment orders in two dimensions | //- List of moment orders in two dimensions |
180 | 159 | static const labelListList twoDimMomentOrders; | static const labelListList twoDimMomentOrders; |
181 | 160 | ||
... | ... | public: | |
192 | 171 | // Member Functions | // Member Functions |
193 | 172 | ||
194 | 173 | //- Invert moments to find weights and abscissae | //- Invert moments to find weights and abscissae |
195 | void invert(const multivariateMomentSet& moments); | ||
196 | |||
197 | //- Return number of moments | ||
198 | inline label nMoments(); | ||
199 | |||
200 | //- Return number of number of nodes in each dimension | ||
201 | inline label nNodes(); | ||
202 | |||
203 | //- Return mapped quadrature weights for each dimension | ||
204 | inline const mappedList<scalar>& weights() const; | ||
205 | |||
206 | //- Return mapped quadrature abscissae for each dimension | ||
207 | inline const mappedList<vector>& abscissae() const; | ||
174 | virtual bool invert(const multivariateMomentSet& moments); | ||
208 | 175 | }; | }; |
209 | 176 | ||
210 | 177 | ||
211 | 178 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
212 | 179 | ||
180 | } // End namespace multivariateMomentInversions | ||
213 | 181 | } // End namespace Foam | } // End namespace Foam |
214 | 182 | ||
215 | |||
216 | 183 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
217 | 184 | ||
218 | #include "hyperbolicConditionalMomentInversionI.H" | ||
219 | |||
220 | 185 | #endif | #endif |
221 | 186 | ||
222 | |||
223 | 187 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/CHyQMOMPlus/CHyQMOMPlusMomentInversion.C added (mode: 100644) (index 0000000..1f37eac) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "CHyQMOMPlusMomentInversion.H" | ||
27 | #include "QRMatrix.H" | ||
28 | #include "SVD.H" | ||
29 | #include "mappedLists.H" | ||
30 | #include "addToRunTimeSelectionTable.H" | ||
31 | |||
32 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
33 | |||
34 | namespace Foam | ||
35 | { | ||
36 | namespace multivariateMomentInversions | ||
37 | { | ||
38 | defineTypeNameAndDebug(CHyQMOMPlus, 0); | ||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | multivariateMomentInversion, | ||
42 | CHyQMOMPlus, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | |||
49 | const Foam::labelListList | ||
50 | Foam::multivariateMomentInversions::CHyQMOMPlus::CHyQMOMPlus::twoDimMomentOrders = | ||
51 | { | ||
52 | {0, 0}, | ||
53 | {1, 0}, | ||
54 | {0, 1}, | ||
55 | {2, 0}, | ||
56 | {1, 1}, | ||
57 | {0, 2}, | ||
58 | {3, 0}, | ||
59 | {2, 1}, | ||
60 | {1, 2}, | ||
61 | {0, 3}, | ||
62 | {4, 0}, | ||
63 | {0, 4} | ||
64 | }; | ||
65 | |||
66 | const Foam::labelListList | ||
67 | Foam::multivariateMomentInversions::CHyQMOMPlus::CHyQMOMPlus::threeDimMomentOrders = | ||
68 | { | ||
69 | {0, 0, 0}, | ||
70 | {1, 0, 0}, | ||
71 | {0, 1, 0}, | ||
72 | {0, 0, 1}, | ||
73 | {2, 0, 0}, | ||
74 | {1, 1, 0}, | ||
75 | {1, 0, 1}, | ||
76 | {0, 2, 0}, | ||
77 | {0, 1, 1}, | ||
78 | {0, 0, 2}, | ||
79 | {3, 0, 0}, | ||
80 | {2, 1, 0}, | ||
81 | {2, 0, 1}, | ||
82 | {1, 2, 0}, | ||
83 | {1, 1, 1}, | ||
84 | {1, 0, 2}, | ||
85 | {0, 3, 0}, | ||
86 | {0, 2, 1}, | ||
87 | {0, 1, 2}, | ||
88 | {0, 0, 3}, | ||
89 | {4, 0, 0}, | ||
90 | {0, 4, 0}, | ||
91 | {0, 0, 4} | ||
92 | }; | ||
93 | |||
94 | |||
95 | const Foam::labelListList | ||
96 | Foam::multivariateMomentInversions::CHyQMOMPlus::CHyQMOMPlus::twoDimNodeIndexes = | ||
97 | { | ||
98 | {0, 0}, | ||
99 | {0, 1}, | ||
100 | {0, 2}, | ||
101 | {1, 0}, | ||
102 | {1, 1}, | ||
103 | {1, 2}, | ||
104 | {2, 0}, | ||
105 | {2, 1}, | ||
106 | {2, 2} | ||
107 | }; | ||
108 | |||
109 | const Foam::labelListList | ||
110 | Foam::multivariateMomentInversions::CHyQMOMPlus::CHyQMOMPlus::threeDimNodeIndexes = | ||
111 | { | ||
112 | {0, 0, 0}, | ||
113 | {0, 0, 1}, | ||
114 | {0, 0, 2}, | ||
115 | {0, 1, 0}, | ||
116 | {0, 1, 1}, | ||
117 | {0, 1, 2}, | ||
118 | {0, 2, 0}, | ||
119 | {0, 2, 1}, | ||
120 | {0, 2, 2}, | ||
121 | {1, 0, 0}, | ||
122 | {1, 0, 1}, | ||
123 | {1, 0, 2}, | ||
124 | {1, 1, 0}, | ||
125 | {1, 1, 1}, | ||
126 | {1, 1, 2}, | ||
127 | {1, 2, 0}, | ||
128 | {1, 2, 1}, | ||
129 | {1, 2, 2}, | ||
130 | {2, 0, 0}, | ||
131 | {2, 0, 1}, | ||
132 | {2, 0, 2}, | ||
133 | {2, 1, 0}, | ||
134 | {2, 1, 1}, | ||
135 | {2, 1, 2}, | ||
136 | {2, 2, 0}, | ||
137 | {2, 2, 1}, | ||
138 | {2, 2, 2} | ||
139 | }; | ||
140 | |||
141 | |||
142 | Foam::label Foam::multivariateMomentInversions::CHyQMOMPlus::getNMoments | ||
143 | ( | ||
144 | const label nDims | ||
145 | ) | ||
146 | { | ||
147 | if (nDims == 1) | ||
148 | { | ||
149 | return 5; | ||
150 | } | ||
151 | else if (nDims == 2) | ||
152 | { | ||
153 | return 12; | ||
154 | } | ||
155 | else if (nDims == 3) | ||
156 | { | ||
157 | return 23; | ||
158 | } | ||
159 | return 0; | ||
160 | } | ||
161 | |||
162 | |||
163 | Foam::labelListList | ||
164 | Foam::multivariateMomentInversions::CHyQMOMPlus::getMomentOrders | ||
165 | ( | ||
166 | const label nDims | ||
167 | ) | ||
168 | { | ||
169 | if (nDims == 1) | ||
170 | { | ||
171 | return {{0}, {1}, {2}, {3}, {4}}; | ||
172 | } | ||
173 | else if (nDims == 2) | ||
174 | { | ||
175 | return twoDimMomentOrders; | ||
176 | } | ||
177 | else if (nDims == 3) | ||
178 | { | ||
179 | return threeDimMomentOrders; | ||
180 | } | ||
181 | |||
182 | return {{}}; | ||
183 | } | ||
184 | |||
185 | |||
186 | Foam::label Foam::multivariateMomentInversions::CHyQMOMPlus::getNNodes | ||
187 | ( | ||
188 | const label nDims | ||
189 | ) | ||
190 | { | ||
191 | if (nDims == 1) | ||
192 | { | ||
193 | return 3; | ||
194 | } | ||
195 | else if (nDims == 2) | ||
196 | { | ||
197 | return 9; | ||
198 | } | ||
199 | else if (nDims == 3) | ||
200 | { | ||
201 | return 27; | ||
202 | } | ||
203 | |||
204 | return 0; | ||
205 | } | ||
206 | |||
207 | |||
208 | Foam::labelListList | ||
209 | Foam::multivariateMomentInversions::CHyQMOMPlus::getNodeIndexes | ||
210 | ( | ||
211 | const label nDims | ||
212 | ) | ||
213 | { | ||
214 | if (nDims == 1) | ||
215 | { | ||
216 | return {{0}, {1}, {2}}; | ||
217 | } | ||
218 | else if (nDims == 2) | ||
219 | { | ||
220 | return twoDimNodeIndexes; | ||
221 | } | ||
222 | else if (nDims == 3) | ||
223 | { | ||
224 | return threeDimNodeIndexes; | ||
225 | } | ||
226 | |||
227 | return {{}}; | ||
228 | } | ||
229 | |||
230 | |||
231 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
232 | |||
233 | Foam::multivariateMomentInversions::CHyQMOMPlus::CHyQMOMPlus | ||
234 | ( | ||
235 | const dictionary& dict, | ||
236 | const labelListList& momentOrders, | ||
237 | const labelListList& nodeIndexes, | ||
238 | const labelList& velocityIndexes | ||
239 | ) | ||
240 | : | ||
241 | multivariateMomentInversion | ||
242 | ( | ||
243 | dict, | ||
244 | momentOrders, | ||
245 | nodeIndexes, | ||
246 | velocityIndexes | ||
247 | ), | ||
248 | univariateInverter_ | ||
249 | ( | ||
250 | new hyperbolicMomentInversion(dict) | ||
251 | ), | ||
252 | etaMin_(dict.lookupOrDefault("etaMin", 1.0e-10)), | ||
253 | qMax_(dict.lookupOrDefault("qMax", 100.0)), | ||
254 | smallNegRealizability_ | ||
255 | ( | ||
256 | dict.lookupOrDefault | ||
257 | ( | ||
258 | "smallNegRealizability", | ||
259 | 1.0e-6 | ||
260 | ) | ||
261 | ), | ||
262 | varMin_(dict.lookupOrDefault("varMin", 1.0e-10)), | ||
263 | minCorrelation_(dict.lookupOrDefault("minCorrelation", 1.0e-6)) | ||
264 | {} | ||
265 | |||
266 | |||
267 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
268 | |||
269 | Foam::multivariateMomentInversions::CHyQMOMPlus::~CHyQMOMPlus() | ||
270 | {} | ||
271 | |||
272 | |||
273 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
274 | Foam::scalar Foam::multivariateMomentInversions::CHyQMOMPlus::calcQ | ||
275 | ( | ||
276 | scalar q, | ||
277 | scalar eta | ||
278 | ) | ||
279 | { | ||
280 | if (mag(q) > SMALL) | ||
281 | { | ||
282 | scalar slope = (eta - 3.0)/q; | ||
283 | scalar sqrtDet = sqrt(8.0 + sqr(slope)); | ||
284 | |||
285 | if (q > 0.0) | ||
286 | { | ||
287 | return (slope + sqrtDet)/2.0; | ||
288 | } | ||
289 | else | ||
290 | { | ||
291 | return (slope - sqrtDet)/2.0; | ||
292 | } | ||
293 | } | ||
294 | else | ||
295 | { | ||
296 | return 0.0; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | void | ||
301 | Foam::multivariateMomentInversions::CHyQMOMPlus::realizabilityUnivariateMoments | ||
302 | ( | ||
303 | scalar& c2, | ||
304 | scalar& c3, | ||
305 | scalar& c4 | ||
306 | ) | ||
307 | { | ||
308 | if (c2 <= 0.0) | ||
309 | { | ||
310 | c2 = 0.0; | ||
311 | c3 = 0.0; | ||
312 | c4 = 0.0; | ||
313 | |||
314 | return; | ||
315 | } | ||
316 | |||
317 | if (c2*c4 < pow3(c2) + sqr(c3)) | ||
318 | { | ||
319 | scalar q = c3/pow(c2, 3.0/2.0); | ||
320 | scalar eta = c4/sqr(c2); | ||
321 | q = calcQ(q, eta); | ||
322 | eta = 1.0 + sqr(q); | ||
323 | c3 = q*pow(c2, 3.0/2.0); | ||
324 | c4 = eta*sqr(c2); | ||
325 | } | ||
326 | } | ||
327 | |||
328 | void Foam::multivariateMomentInversions::CHyQMOMPlus::invert1D | ||
329 | ( | ||
330 | const multivariateMomentSet& moments, | ||
331 | scalarList& weights1D, | ||
332 | scalarList& abscissae1D | ||
333 | ) | ||
334 | { | ||
335 | // One-dimensional inversion with realizability test | ||
336 | univariateMomentSet momentsToInvert | ||
337 | ( | ||
338 | { | ||
339 | moments(0), | ||
340 | moments(1), | ||
341 | moments(2), | ||
342 | moments(3), | ||
343 | moments(4) | ||
344 | }, | ||
345 | "R" | ||
346 | ); | ||
347 | |||
348 | // Find univariate quadrature in first direction | ||
349 | univariateInverter_().invert(momentsToInvert); | ||
350 | |||
351 | // Store univariate quadrature in first direction | ||
352 | forAll(weights1D, wi) | ||
353 | { | ||
354 | weights1D[wi] = univariateInverter_().weights()[wi]; | ||
355 | abscissae1D[wi] = univariateInverter_().abscissae()[wi]; | ||
356 | } | ||
357 | } | ||
358 | |||
359 | void Foam::multivariateMomentInversions::CHyQMOMPlus::invert2D | ||
360 | ( | ||
361 | const multivariateMomentSet& moments, | ||
362 | mappedList<scalar>& weights2D, | ||
363 | mappedList<vector2D>& abscissae2D | ||
364 | ) | ||
365 | { | ||
366 | scalar m00 = moments(0, 0); | ||
367 | label nWeights2D = weights2D.size(); | ||
368 | |||
369 | if (m00 < SMALL) | ||
370 | { | ||
371 | forAll(weights2D, wi) | ||
372 | { | ||
373 | weights2D[wi] = m00/scalar(nWeights2D); | ||
374 | abscissae2D[wi] = vector2D::zero; | ||
375 | } | ||
376 | |||
377 | return; | ||
378 | }; | ||
379 | |||
380 | // Calculate normalized moments | ||
381 | scalar s10 = moments(1)/m00; | ||
382 | scalar s01 = moments(0, 1)/m00; | ||
383 | scalar s20 = moments(2)/m00; | ||
384 | scalar s11 = moments(1, 1)/m00; | ||
385 | scalar s02 = moments(0, 2)/m00; | ||
386 | scalar s30 = moments(3)/m00; | ||
387 | scalar s03 = moments(0, 3)/m00; | ||
388 | scalar s21 = moments(2, 1)/m00; | ||
389 | scalar s12 = moments(1, 2)/m00; | ||
390 | scalar s40 = moments(4)/m00; | ||
391 | scalar s04 = moments(0, 4)/m00; | ||
392 | |||
393 | // Mean velocities and powers | ||
394 | scalar meanU = s10; | ||
395 | scalar meanV = s01; | ||
396 | scalar sqrMeanU = sqr(meanU); | ||
397 | scalar sqrMeanV = sqr(meanV); | ||
398 | |||
399 | // Calculate central moments | ||
400 | scalar c20 = s20 - sqrMeanU; | ||
401 | scalar c11 = s11 - meanU*meanV; | ||
402 | scalar c02 = s02 - sqrMeanV; | ||
403 | scalar c30 = s30; | ||
404 | scalar c03 = s03; | ||
405 | scalar c21 = s21; | ||
406 | scalar c12 = s12; | ||
407 | scalar c40 = s40; | ||
408 | scalar c04 = s04; | ||
409 | |||
410 | // NOTE: Sign changed due to -= operator | ||
411 | c30 -= (3.0*meanU*s20 - 2.0*pow3(meanU)); | ||
412 | c03 -= (3.0*meanV*s02 - 2.0*pow3(meanV)); | ||
413 | c21 -= (meanV*s20 + 2.0*meanU*s11 - 2.0*sqrMeanU*meanV); | ||
414 | c12 -= (meanU*s02 + 2.0*meanV*s11 - 2.0*sqrMeanV*meanU); | ||
415 | c40 -= (4.0*meanU*s30 - 6.0*sqrMeanU*s20 + 3.0*sqr(sqrMeanU)); | ||
416 | c04 -= (4.0*meanV*s03 - 6.0*sqrMeanV*s02 + 3.0*sqr(sqrMeanV)); | ||
417 | |||
418 | realizabilityUnivariateMoments(c20, c30, c40); | ||
419 | realizabilityUnivariateMoments(c02, c03, c04); | ||
420 | |||
421 | if (c20 < varMin_) | ||
422 | { | ||
423 | univariateMomentSet mDir2({1.0, 0.0, c02, c03, c04}, "R"); | ||
424 | |||
425 | //NOTE: Leave Vf elements null. AP | ||
426 | univariateInverter_().invert(mDir2); | ||
427 | |||
428 | scalarList wDir2(univariateInverter_().weights()); | ||
429 | scalarList absDir2(univariateInverter_().abscissae()); | ||
430 | |||
431 | forAll(wDir2, i) | ||
432 | { | ||
433 | forAll(wDir2, j) | ||
434 | { | ||
435 | if (i == 1) | ||
436 | { | ||
437 | weights2D(i, j) = m00*wDir2[j]; | ||
438 | abscissae2D(i, j) = vector2D(meanU, absDir2[j] + meanV); | ||
439 | } | ||
440 | else | ||
441 | { | ||
442 | weights2D(i, j) = 0.0; | ||
443 | abscissae2D(i, j) = vector2D::zero; | ||
444 | } | ||
445 | } | ||
446 | } | ||
447 | |||
448 | return; | ||
449 | } | ||
450 | |||
451 | // One-dimensional inversion with realizability test | ||
452 | univariateMomentSet mDir1({1.0, 0.0, c20, c30, c40}, "R"); | ||
453 | |||
454 | // Find univariate quadrature in first direction | ||
455 | univariateInverter_().invert(mDir1); | ||
456 | |||
457 | // Store univariate quadrature in first direction | ||
458 | scalarList wDir1(univariateInverter_().weights()); | ||
459 | scalarList absDir1(univariateInverter_().abscissae()); | ||
460 | |||
461 | if (c02 < varMin_) | ||
462 | { | ||
463 | forAll(wDir1, i) | ||
464 | { | ||
465 | forAll(wDir1, j) | ||
466 | { | ||
467 | if (j == 1) | ||
468 | { | ||
469 | weights2D(i, j) = m00*wDir1[i]; | ||
470 | abscissae2D(i, j) = vector2D(absDir1[i] + meanU, meanV); | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | weights2D(i, j) = 0.0; | ||
475 | abscissae2D(i, j) = vector2D::zero; | ||
476 | } | ||
477 | } | ||
478 | } | ||
479 | |||
480 | return; | ||
481 | } | ||
482 | |||
483 | // X and y directions are non-degenerate | ||
484 | |||
485 | // Order of polynomial | ||
486 | label pOrder = 2; | ||
487 | scalar sqrtC20 = sqrt(c20); | ||
488 | scalarList us(absDir1); | ||
489 | forAll(us, i) | ||
490 | { | ||
491 | us[i] /= sqrtC20; | ||
492 | } | ||
493 | |||
494 | scalar c11s = c11/sqrtC20; | ||
495 | scalar c21s = c21/c20; | ||
496 | |||
497 | scalar q = c30/pow3(sqrtC20); | ||
498 | scalar eta = c40/sqr(c20); | ||
499 | |||
500 | // Check for perfect correlation (v = a*u) | ||
501 | if (sqr(c11s) > c02*(1.0 - small)) | ||
502 | { | ||
503 | c11s = sign(c11s)*sqrt(c02); | ||
504 | pOrder = 1; | ||
505 | } | ||
506 | |||
507 | scalar r = eta - 1.0 - sqr(q); | ||
508 | scalar a0 = 0.0; | ||
509 | scalar a1 = 0.0; | ||
510 | |||
511 | if (r > minCorrelation_ && pOrder == 2) | ||
512 | { | ||
513 | a0 = (c21s - q*c11s)/r; | ||
514 | a1 = ((eta - 1.0)*c11s - q*c21s)/r; | ||
515 | } | ||
516 | else | ||
517 | { | ||
518 | a1 = c11s; | ||
519 | } | ||
520 | |||
521 | scalarList Vf(3, 0.0); | ||
522 | forAll(Vf, i) | ||
523 | { | ||
524 | Vf[i] = a1*us[i] + a0*(sqr(us[i]) - 1.0); | ||
525 | } | ||
526 | |||
527 | // Compute conditional variance | ||
528 | scalar b0 = c02; | ||
529 | |||
530 | forAll(Vf, vi) | ||
531 | { | ||
532 | b0 -= wDir1[vi]*sqr(Vf[vi]); | ||
533 | } | ||
534 | scalar b1 = 0.0; | ||
535 | |||
536 | if (b0 <= 0) | ||
537 | { | ||
538 | if (pOrder == 2) | ||
539 | { | ||
540 | forAll(Vf, i) | ||
541 | { | ||
542 | Vf[i] = c11s*us[i]; | ||
543 | } | ||
544 | |||
545 | b0 = c02; | ||
546 | forAll(Vf, vi) | ||
547 | { | ||
548 | b0 -= wDir1[vi]*sqr(Vf[vi]); | ||
549 | } | ||
550 | pOrder = 1; | ||
551 | } | ||
552 | } | ||
553 | |||
554 | b0 = max(b0, 0.0); | ||
555 | |||
556 | if (pOrder == 2) | ||
557 | { | ||
558 | b1 = c12/sqrtC20; | ||
559 | |||
560 | forAll(us, i) | ||
561 | { | ||
562 | b1 -= wDir1[i]*sqr(Vf[i])*us[i]; | ||
563 | } | ||
564 | } | ||
565 | |||
566 | scalarList mu2(3, b0); | ||
567 | |||
568 | forAll(mu2, i) | ||
569 | { | ||
570 | mu2[i] += b1*us[i]; | ||
571 | } | ||
572 | |||
573 | label minMu2i = findMin(mu2); | ||
574 | scalar minMu2 = mu2[minMu2i]; | ||
575 | |||
576 | if (minMu2 < 0) | ||
577 | { | ||
578 | b1 = -b0/us[minMu2i]; | ||
579 | |||
580 | forAll(mu2, i) | ||
581 | { | ||
582 | mu2[i] = b0 + b1*us[i]; | ||
583 | } | ||
584 | |||
585 | mu2[minMu2i] = 0.0; | ||
586 | } | ||
587 | |||
588 | // Check realizability of 3rd and 4th order moments | ||
589 | q = 0.0; | ||
590 | eta = 1.0; | ||
591 | scalar sum1 = 0.0; | ||
592 | |||
593 | forAll(mu2, i) | ||
594 | { | ||
595 | sum1 += wDir1[i]*sqrt(pow3(mu2[i])); | ||
596 | } | ||
597 | |||
598 | if (sum1 > small) | ||
599 | { | ||
600 | scalar sum03 = c03; | ||
601 | |||
602 | forAll(Vf, i) | ||
603 | { | ||
604 | sum03 -= (wDir1[i]*(pow3(Vf[i]) + 3.0*Vf[i]*mu2[i])); | ||
605 | } | ||
606 | q = sum03/sum1; | ||
607 | } | ||
608 | |||
609 | scalar sum2 = 0.0; | ||
610 | |||
611 | forAll(mu2, i) | ||
612 | { | ||
613 | sum2 += wDir1[i]*sqr(mu2[i]); | ||
614 | } | ||
615 | |||
616 | if (sum1 > small) | ||
617 | { | ||
618 | scalar sum04 = c04; | ||
619 | |||
620 | forAll(Vf, i) | ||
621 | { | ||
622 | sum04 -= | ||
623 | wDir1[i] | ||
624 | *( | ||
625 | pow4(Vf[i]) | ||
626 | + 6.0*sqr(Vf[i])*mu2[i] | ||
627 | + q*4.0*Vf[i]*sqrt(pow3(mu2[i])) | ||
628 | ); | ||
629 | } | ||
630 | |||
631 | eta = sum04/sum2; | ||
632 | |||
633 | if (eta < (sqr(q) + 1.0)) | ||
634 | { | ||
635 | q = calcQ(q, eta); | ||
636 | eta = sqr(q) + 1.0; | ||
637 | } | ||
638 | } | ||
639 | scalarList mu3(3, 0.0); | ||
640 | scalarList mu4(3, 0.0); | ||
641 | |||
642 | forAll(mu3, i) | ||
643 | { | ||
644 | mu3[i] = q*sqrt(pow3(mu2[i])); | ||
645 | mu4[i] = eta*sqr(mu2[i]); | ||
646 | } | ||
647 | |||
648 | for (label i = 0; i < 3; i++) | ||
649 | { | ||
650 | univariateMomentSet mMu({1.0, 0.0, mu2[i], mu3[i], mu4[i]}, "R"); | ||
651 | univariateInverter_().invert(mMu); | ||
652 | |||
653 | for (label j = 0; j < 3; j++) | ||
654 | { | ||
655 | weights2D(i, j) = m00*wDir1[i]*univariateInverter_().weights()[j]; | ||
656 | |||
657 | abscissae2D(i, j) = | ||
658 | vector2D | ||
659 | ( | ||
660 | absDir1[i] + meanU, | ||
661 | Vf[i] + univariateInverter_().abscissae()[j] + meanV | ||
662 | ); | ||
663 | } | ||
664 | } | ||
665 | } | ||
666 | |||
667 | void Foam::multivariateMomentInversions::CHyQMOMPlus::invert3D | ||
668 | ( | ||
669 | const multivariateMomentSet& moments | ||
670 | ) | ||
671 | { | ||
672 | scalar m000 = moments(0, 0, 0); | ||
673 | |||
674 | if (m000 < SMALL) | ||
675 | { | ||
676 | weights_(1,1,1) = m000; | ||
677 | return; | ||
678 | }; | ||
679 | |||
680 | // Calculate normalized moments | ||
681 | scalar s100 = moments(1)/m000; | ||
682 | scalar s010 = moments(0, 1)/m000; | ||
683 | scalar s001 = moments(0, 0, 1)/m000; | ||
684 | scalar s200 = moments(2)/m000; | ||
685 | scalar s110 = moments(1, 1, 0)/m000; | ||
686 | scalar s101 = moments(1, 0, 1)/m000; | ||
687 | scalar s020 = moments(0, 2)/m000; | ||
688 | scalar s011 = moments(0, 1, 1)/m000; | ||
689 | scalar s002 = moments(0, 0, 2)/m000; | ||
690 | scalar s300 = moments(3)/m000; | ||
691 | scalar s210 = moments(2, 1, 0)/m000; | ||
692 | scalar s201 = moments(2, 0, 1)/m000; | ||
693 | scalar s120 = moments(1, 2)/m000; | ||
694 | scalar s111 = moments(1, 1, 1)/m000; | ||
695 | scalar s102 = moments(1, 0, 2)/m000; | ||
696 | scalar s030 = moments(0, 3)/m000; | ||
697 | scalar s021 = moments(0, 2, 1)/m000; | ||
698 | scalar s012 = moments(0, 1, 2)/m000; | ||
699 | scalar s003 = moments(0, 0, 3)/m000; | ||
700 | scalar s400 = moments(4)/m000; | ||
701 | scalar s040 = moments(0, 4)/m000; | ||
702 | scalar s004 = moments(0, 0, 4)/m000; | ||
703 | |||
704 | // Calculate central moments | ||
705 | scalar meanU = s100; | ||
706 | scalar meanV = s010; | ||
707 | scalar meanW = s001; | ||
708 | scalar sqrMeanU = sqr(meanU); | ||
709 | scalar sqrMeanV = sqr(meanV); | ||
710 | scalar sqrMeanW = sqr(meanW); | ||
711 | |||
712 | scalar c200 = s200 - sqrMeanU; | ||
713 | scalar c110 = s110 - meanU*meanV; | ||
714 | scalar c101 = s101 - meanU*meanW; | ||
715 | scalar c020 = s020 - sqrMeanV; | ||
716 | scalar c011 = s011 - meanV*meanW; | ||
717 | scalar c002 = s002 - sqrMeanW; | ||
718 | scalar c300 = s300; | ||
719 | scalar c210 = s210; | ||
720 | scalar c201 = s201; | ||
721 | scalar c120 = s120; | ||
722 | scalar c111 = s111; | ||
723 | scalar c102 = s102; | ||
724 | scalar c030 = s030; | ||
725 | scalar c021 = s021; | ||
726 | scalar c012 = s012; | ||
727 | scalar c003 = s003; | ||
728 | scalar c400 = s400; | ||
729 | scalar c040 = s040; | ||
730 | scalar c004 = s004; | ||
731 | |||
732 | c300 -= (3.0*meanU*s200 - 2.0*pow3(meanU)); | ||
733 | c210 -= (meanV*s200 + 2.0*meanU*s110 - 2.0*sqrMeanU*meanV); | ||
734 | c201 -= (meanW*s200 + 2.0*meanU*s101 - 2.0*sqrMeanU*meanW); | ||
735 | c120 -= (meanU*s020 + 2.0*meanV*s110 - 2.0*sqrMeanV*meanU); | ||
736 | c111 -= (meanU*s011 + meanV*s101 + meanW*s110 - 2.0*meanU*meanV*meanW); | ||
737 | c102 -= (meanU*s002 + 2.0*meanW*s101 - 2.0*sqrMeanW*meanU); | ||
738 | c030 -= (3.0*meanV*s020 - 2.0*pow3(meanV)); | ||
739 | c021 -= (meanW*s020 + 2.0*meanV*s011 - 2.0*sqrMeanV*meanW); | ||
740 | c012 -= (meanV*s002 + 2.0*meanW*s011 - 2.0*sqrMeanW*meanV); | ||
741 | c003 -= (3.0*meanW*s002 - 2.0*pow3(meanW)); | ||
742 | |||
743 | c400 -= (4.0*meanU*s300 - 6.0*sqrMeanU*s200 + 3.0*sqr(sqrMeanU)); | ||
744 | c040 -= (4.0*meanV*s030 - 6.0*sqrMeanV*s020 + 3.0*sqr(sqrMeanV)); | ||
745 | c004 -= (4.0*meanW*s003 - 6.0*sqrMeanW*s002 + 3.0*sqr(sqrMeanW)); | ||
746 | |||
747 | realizabilityUnivariateMoments(c200, c300, c400); | ||
748 | realizabilityUnivariateMoments(c020, c030, c040); | ||
749 | realizabilityUnivariateMoments(c002, c003, c004); | ||
750 | |||
751 | // X direction is degenerate | ||
752 | if (c200 < varMin_) | ||
753 | { | ||
754 | // X and y directions are degenerate | ||
755 | if (c020 < varMin_) | ||
756 | { | ||
757 | univariateMomentSet mDir3({1.0, 0.0, c002, c003, c004}, "R"); | ||
758 | |||
759 | // Find univariate quadrature in first direction | ||
760 | univariateInverter_().invert(mDir3); | ||
761 | |||
762 | // Store univariate quadrature in first direction | ||
763 | scalarList wDir3(univariateInverter_().weights()); | ||
764 | scalarList absDir3(univariateInverter_().abscissae()); | ||
765 | |||
766 | for(label i = 0; i < 3; i++) | ||
767 | { | ||
768 | weights_(1, 1, i) = m000*wDir3[i]; | ||
769 | velocityAbscissae_(1, 1, i) = | ||
770 | vector | ||
771 | ( | ||
772 | meanU, | ||
773 | meanV, | ||
774 | absDir3[i] + meanW | ||
775 | ); | ||
776 | } | ||
777 | |||
778 | return; | ||
779 | } | ||
780 | // Only x direction is degenerate | ||
781 | else | ||
782 | { | ||
783 | multivariateMomentSet mDir23 | ||
784 | ( | ||
785 | { | ||
786 | 1.0, | ||
787 | 0.0, | ||
788 | 0.0, | ||
789 | c020, | ||
790 | c011, | ||
791 | c002, | ||
792 | c030, | ||
793 | c021, | ||
794 | c012, | ||
795 | c003, | ||
796 | c040, | ||
797 | c004 | ||
798 | }, | ||
799 | twoDimMomentOrders, | ||
800 | "R" | ||
801 | ); | ||
802 | |||
803 | mappedList<scalar> wDir23(9, twoDimNodeIndexes, 0.0); | ||
804 | mappedList<vector2D> absDir23 | ||
805 | ( | ||
806 | 9, | ||
807 | twoDimNodeIndexes, | ||
808 | vector2D::zero | ||
809 | ); | ||
810 | |||
811 | invert2D(mDir23, wDir23, absDir23); | ||
812 | |||
813 | for (label j = 0; j < 3; j++) | ||
814 | { | ||
815 | for (label k = 0; k < 3; k++) | ||
816 | { | ||
817 | weights_(1, j, k) = m000*wDir23(j, k); | ||
818 | velocityAbscissae_(1, j, k) = | ||
819 | vector | ||
820 | ( | ||
821 | meanU, | ||
822 | absDir23(j, k).x() + meanV, | ||
823 | absDir23(j, k).y() + meanW | ||
824 | ); | ||
825 | } | ||
826 | } | ||
827 | |||
828 | return; | ||
829 | } | ||
830 | } | ||
831 | |||
832 | // Invert first direction | ||
833 | univariateMomentSet mDir1({1.0, 0.0, c200, c300, c400}, "R"); | ||
834 | |||
835 | // Find univariate quadrature in first direction | ||
836 | univariateInverter_().invert(mDir1); | ||
837 | |||
838 | // Store univariate quadrature in first direction | ||
839 | scalarList wDir1(univariateInverter_().weights()); | ||
840 | scalarList absDir1(univariateInverter_().abscissae()); | ||
841 | |||
842 | // Y direction is degenerate | ||
843 | if (c020 < varMin_) | ||
844 | { | ||
845 | multivariateMomentSet mDir13 | ||
846 | ( | ||
847 | { | ||
848 | 1.0, | ||
849 | 0.0, | ||
850 | 0.0, | ||
851 | c200, | ||
852 | c101, | ||
853 | c002, | ||
854 | c300, | ||
855 | c201, | ||
856 | c102, | ||
857 | c003, | ||
858 | c400, | ||
859 | c004 | ||
860 | }, | ||
861 | twoDimMomentOrders, | ||
862 | "R" | ||
863 | ); | ||
864 | |||
865 | mappedList<scalar> wDir13(9, twoDimNodeIndexes, 0.0); | ||
866 | mappedList<vector2D> absDir13 | ||
867 | ( | ||
868 | 9, | ||
869 | twoDimNodeIndexes, | ||
870 | vector2D::zero | ||
871 | ); | ||
872 | |||
873 | invert2D(mDir13, wDir13, absDir13); | ||
874 | |||
875 | for (label i = 0; i < 3; i++) | ||
876 | { | ||
877 | for (label k = 0; k < 3; k++) | ||
878 | { | ||
879 | weights_(i, 1, k) = m000*wDir13(i, k); | ||
880 | velocityAbscissae_(i, 1, k) = | ||
881 | vector | ||
882 | ( | ||
883 | absDir13(i, k).x() + meanU, | ||
884 | meanV, | ||
885 | absDir13(i, k).y() + meanW | ||
886 | ); | ||
887 | } | ||
888 | } | ||
889 | |||
890 | return; | ||
891 | } | ||
892 | // X and y directions are non-degenerate | ||
893 | else | ||
894 | { | ||
895 | multivariateMomentSet mDir12 | ||
896 | ( | ||
897 | { | ||
898 | 1.0, | ||
899 | 0.0, | ||
900 | 0.0, | ||
901 | c200, | ||
902 | c110, | ||
903 | c020, | ||
904 | c300, | ||
905 | c210, | ||
906 | c120, | ||
907 | c030, | ||
908 | c400, | ||
909 | c040 | ||
910 | }, | ||
911 | twoDimMomentOrders, | ||
912 | "R" | ||
913 | ); | ||
914 | |||
915 | mappedList<scalar> wDir12(9, twoDimNodeIndexes, 0.0); | ||
916 | mappedList<vector2D> abscissaeDir12 | ||
917 | ( | ||
918 | 9, | ||
919 | twoDimNodeIndexes, | ||
920 | vector2D::zero | ||
921 | ); | ||
922 | |||
923 | invert2D(mDir12, wDir12, abscissaeDir12); | ||
924 | |||
925 | // Z direction is degenerate | ||
926 | if (c002 < varMin_) | ||
927 | { | ||
928 | for (label i = 0; i < 3; i++) | ||
929 | { | ||
930 | for (label j = 0; j < 3; j++) | ||
931 | { | ||
932 | weights_(i, j, 1) = m000*wDir12(i, j); | ||
933 | velocityAbscissae_(i, j, 1) = | ||
934 | vector | ||
935 | ( | ||
936 | abscissaeDir12(i, j).x() + meanU, | ||
937 | abscissaeDir12(i, j).y() + meanV, | ||
938 | meanW | ||
939 | ); | ||
940 | } | ||
941 | } | ||
942 | |||
943 | return; | ||
944 | } | ||
945 | // All directions are non-degenerate | ||
946 | label NB = 6; | ||
947 | |||
948 | for (label i = 0; i < 3; i++) | ||
949 | { | ||
950 | wDir12(0, i) /= wDir1[0]; | ||
951 | wDir12(1, i) /= wDir1[1]; | ||
952 | wDir12(2, i) /= wDir1[2]; | ||
953 | } | ||
954 | |||
955 | // Compute Vf reconstruction | ||
956 | scalarList Vf(3, 0.0); | ||
957 | for (label i = 0; i < 3; i++) | ||
958 | { | ||
959 | Vf[0] += wDir12(0, i)*abscissaeDir12(0, i).y(); | ||
960 | Vf[1] += wDir12(1, i)*abscissaeDir12(1, i).y(); | ||
961 | Vf[2] += wDir12(2, i)*abscissaeDir12(2, i).y(); | ||
962 | } | ||
963 | |||
964 | mappedList<scalar> absDir2(9, twoDimNodeIndexes, 0.0); | ||
965 | for (label i = 0; i < 3; i++) | ||
966 | { | ||
967 | for (label j = 0; j < 3; j++) | ||
968 | { | ||
969 | absDir2(i, j) = abscissaeDir12(i, j).y() - Vf[i]; | ||
970 | } | ||
971 | } | ||
972 | |||
973 | scalar sqrtC200 = sqrt(c200); | ||
974 | scalar sqrtC020 = sqrt(c020); | ||
975 | scalar sqrtC002 = sqrt(c002); | ||
976 | |||
977 | scalarSquareMatrix RAB(3, 0.0); | ||
978 | scalarSquareMatrix Vps(3, 0.0); | ||
979 | |||
980 | for (label i = 0; i < 3; i++) | ||
981 | { | ||
982 | for (label j = 0; j < 3; j++) | ||
983 | { | ||
984 | RAB(i, j) = wDir12(i, j)*wDir1[i]; | ||
985 | Vps(i, j) = absDir2(i, j)/sqrtC020; | ||
986 | } | ||
987 | } | ||
988 | |||
989 | scalarSquareMatrix UABs(3, 0.0); | ||
990 | scalarSquareMatrix VABs(Vps); | ||
991 | |||
992 | scalarSquareMatrix C00(RAB); | ||
993 | scalarSquareMatrix C10(RAB); | ||
994 | scalarSquareMatrix C01(RAB); | ||
995 | scalarSquareMatrix C11(RAB); | ||
996 | scalarSquareMatrix C20(RAB); | ||
997 | scalarSquareMatrix C02(RAB); | ||
998 | |||
999 | for (label i = 0; i < 3; i++) | ||
1000 | { | ||
1001 | for (label j = 0; j < 3; j++) | ||
1002 | { | ||
1003 | UABs(i, j) = absDir1[i]/sqrtC200; | ||
1004 | VABs(i, j) += Vf[i]/sqrtC020; | ||
1005 | |||
1006 | C10(i, j) *= UABs(i, j); | ||
1007 | C01(i, j) *= VABs(i, j); | ||
1008 | C11(i, j) *= UABs(i, j)*VABs(i, j); | ||
1009 | C20(i, j) *= sqr(UABs(i, j)); | ||
1010 | C02(i, j) *= sqr(VABs(i, j)); | ||
1011 | } | ||
1012 | } | ||
1013 | |||
1014 | scalarSquareMatrix A(6, 0.0); | ||
1015 | scalarSquareMatrix Vc0(3, 1.0); | ||
1016 | scalarSquareMatrix Vc1(3, 0.0); | ||
1017 | scalarSquareMatrix Vc2(3, 0.0); | ||
1018 | scalarSquareMatrix Vc3(3, 0.0); | ||
1019 | scalarSquareMatrix Vc4(3, 0.0); | ||
1020 | scalarSquareMatrix Vc5(3, 0.0); | ||
1021 | |||
1022 | A(0, 0) = 1.0; | ||
1023 | A(0, 4) = 1.0; | ||
1024 | A(1, 1) = 1.0; | ||
1025 | A(4, 0) = 1.0; | ||
1026 | A(5, 0) = 1.0; | ||
1027 | |||
1028 | for (label i = 0; i < 3; i++) | ||
1029 | { | ||
1030 | for (label j = 0; j < 3; j++) | ||
1031 | { | ||
1032 | Vc1(i, j) = UABs(i, j); | ||
1033 | Vc2(i, j) = Vps(i, j); | ||
1034 | Vc3(i, j) = Vc1(i, j)*Vc2(i, j); | ||
1035 | Vc4(i, j) = sqr(Vc1(i, j)); | ||
1036 | Vc5(i, j) = sqr(Vc2(i, j)); | ||
1037 | |||
1038 | A(0, 5) += C00(i, j)*Vc5(i, j); | ||
1039 | |||
1040 | A(1, 4) += C10(i, j)*Vc4(i, j); | ||
1041 | A(1, 5) += C10(i, j)*Vc5(i, j); | ||
1042 | |||
1043 | A(2, 1) += C01(i, j)*Vc1(i, j); | ||
1044 | A(2, 2) += C01(i, j)*Vc2(i, j); | ||
1045 | A(2, 3) += C01(i, j)*Vc3(i, j); | ||
1046 | A(2, 4) += C01(i, j)*Vc4(i, j); | ||
1047 | A(2, 5) += C01(i, j)*Vc5(i, j); | ||
1048 | |||
1049 | A(3, 0) += C11(i, j); | ||
1050 | A(3, 1) += C11(i, j)*Vc1(i, j); | ||
1051 | A(3, 2) += C11(i, j)*Vc2(i, j); | ||
1052 | A(3, 3) += C11(i, j)*Vc3(i, j); | ||
1053 | A(3, 4) += C11(i, j)*Vc4(i, j); | ||
1054 | A(3, 5) += C11(i, j)*Vc5(i, j); | ||
1055 | |||
1056 | A(4, 1) += C20(i, j)*Vc1(i, j); | ||
1057 | A(4, 4) += C20(i, j)*Vc4(i, j); | ||
1058 | A(4, 5) += C20(i, j)*Vc5(i, j); | ||
1059 | |||
1060 | A(5, 1) += C02(i, j)*Vc1(i, j); | ||
1061 | A(5, 2) += C02(i, j)*Vc2(i, j); | ||
1062 | A(5, 3) += C02(i, j)*Vc3(i, j); | ||
1063 | A(5, 4) += C02(i, j)*Vc4(i, j); | ||
1064 | A(5, 5) += C02(i, j)*Vc5(i, j); | ||
1065 | } | ||
1066 | } | ||
1067 | |||
1068 | scalar c101s = c101/sqrtC200; | ||
1069 | scalar c011s = c011/sqrtC020; | ||
1070 | scalar c111s = c111/sqrtC200/sqrtC020; | ||
1071 | scalar c110s = c110/sqrtC200/sqrtC020; | ||
1072 | scalar c201s = c201/c200; | ||
1073 | scalar c021s = c021/c020; | ||
1074 | |||
1075 | if (sqr(c101s) >= c002*(1.0 - small)) | ||
1076 | { | ||
1077 | c101s = sign(c101s)*sqrtC002; | ||
1078 | NB = 2; | ||
1079 | } | ||
1080 | else if (sqr(c011s) >= c002*(1.0 - small)) | ||
1081 | { | ||
1082 | c011s = sign(c011s)*sqrtC002; | ||
1083 | c101s = c110s*c011s; | ||
1084 | NB = 3; | ||
1085 | } | ||
1086 | |||
1087 | scalarRectangularMatrix r(6, 1, 0.0); | ||
1088 | r(1, 0) = c101s; | ||
1089 | r(2, 0) = c011s; | ||
1090 | r(3, 0) = c111s; | ||
1091 | r(4, 0) = c201s; | ||
1092 | r(5, 0) = c021s; | ||
1093 | Foam::SVD svd(A, 1e-3); | ||
1094 | scalarField c(6, 0.0); | ||
1095 | scalarRectangularMatrix tmpc(svd.VSinvUt()*r); | ||
1096 | |||
1097 | forAll(c, i) | ||
1098 | { | ||
1099 | c[i] = tmpc(i,0); | ||
1100 | } | ||
1101 | |||
1102 | scalarSquareMatrix Wf | ||
1103 | ( | ||
1104 | c[0]*Vc0 + c[1]*Vc1 + c[2]*Vc2 + c[3]*Vc3 + c[4]*Vc4 + c[5]*Vc5 | ||
1105 | ); | ||
1106 | |||
1107 | scalar sum002 = 0.0; | ||
1108 | scalar sum102 = 0.0; | ||
1109 | scalar sum012 = 0.0; | ||
1110 | |||
1111 | for (label i = 0; i < 3; i++) | ||
1112 | { | ||
1113 | for (label j = 0; j < 3; j++) | ||
1114 | { | ||
1115 | sum002 += RAB(i, j)*sqr(Wf(i, j)); | ||
1116 | sum102 += RAB(i, j)*UABs(i, j)*sqr(Wf(i, j)); | ||
1117 | sum012 += RAB(i, j)*VABs(i, j)*sqr(Wf(i, j)); | ||
1118 | } | ||
1119 | } | ||
1120 | |||
1121 | scalar c102s = c102/sqrtC200; | ||
1122 | scalar c012s = c012/sqrtC020; | ||
1123 | scalar b0 = 1.0; | ||
1124 | forAll(Vf, i) | ||
1125 | { | ||
1126 | b0 -= wDir1[i]*sqr(Vf[i])/c020; | ||
1127 | } | ||
1128 | scalarList d(3, 0.0); | ||
1129 | d[0] = c002 - sum002; | ||
1130 | |||
1131 | if (NB > 3) | ||
1132 | { | ||
1133 | d[1] = c102s - sum102; | ||
1134 | if (mag(b0) > minCorrelation_) | ||
1135 | { | ||
1136 | d[2] = (c012s - sum012 - d[0]*c110s)/b0; | ||
1137 | } | ||
1138 | } | ||
1139 | |||
1140 | scalarSquareMatrix mu2(3, 0.0); | ||
1141 | |||
1142 | if (d[0] > 0) | ||
1143 | { | ||
1144 | mu2 = d[0]*scalarSquareMatrix(3, 1.0) + d[1]*UABs + d[2]*Vps; | ||
1145 | } | ||
1146 | |||
1147 | if (min(mu2) < 0) | ||
1148 | { | ||
1149 | scalarSquareMatrix X(d[1]*UABs + d[2]*Vps); | ||
1150 | scalar x = min(X); | ||
1151 | scalar y = -d[0]/(x - 1e-10); | ||
1152 | mu2 = | ||
1153 | d[0]*scalarSquareMatrix(3, 1.0) | ||
1154 | + y*(d[1]*UABs + d[2]*Vps); | ||
1155 | } | ||
1156 | |||
1157 | // Check realizability of 3rd and 4th order moments | ||
1158 | scalar q = 0.0; | ||
1159 | scalar eta = 1.0; | ||
1160 | scalar sum1 = 0.0; | ||
1161 | for (label i = 0; i < 3; i++) | ||
1162 | { | ||
1163 | for (label j = 0; j < 3; j++) | ||
1164 | { | ||
1165 | if (mu2(i, j) < 0) | ||
1166 | { | ||
1167 | mu2(i, j) = 0.0; | ||
1168 | } | ||
1169 | |||
1170 | sum1 += RAB(i, j)*sqrt(pow3(mu2(i, j))); | ||
1171 | } | ||
1172 | } | ||
1173 | |||
1174 | if (sum1 > small) | ||
1175 | { | ||
1176 | scalar sum3 = c003; | ||
1177 | for (label i = 0; i < 3; i++) | ||
1178 | { | ||
1179 | for (label j = 0; j < 3; j++) | ||
1180 | { | ||
1181 | sum3 -= | ||
1182 | RAB(i, j)*(pow3(Wf(i, j)) + 3.0*Wf(i, j)*mu2(i, j)); | ||
1183 | } | ||
1184 | } | ||
1185 | |||
1186 | q = sum3/sum1; | ||
1187 | } | ||
1188 | |||
1189 | scalar sum2 = 0.0; | ||
1190 | |||
1191 | for (label i = 0; i < 3; i++) | ||
1192 | { | ||
1193 | for (label j = 0; j < 3; j++) | ||
1194 | { | ||
1195 | sum2 += RAB(i, j)*sqr(mu2(i, j)); | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | if (sum1 > small) | ||
1200 | { | ||
1201 | scalar sum04A = c004; | ||
1202 | scalar sum04B = 0.0; | ||
1203 | |||
1204 | for (label i = 0; i < 3; i++) | ||
1205 | { | ||
1206 | for (label j = 0; j < 3; j++) | ||
1207 | { | ||
1208 | sum04A -= | ||
1209 | RAB(i, j) | ||
1210 | *( | ||
1211 | pow4(Wf(i, j)) | ||
1212 | + 6.0*sqr(Wf(i, j))*mu2(i, j) | ||
1213 | ); | ||
1214 | |||
1215 | sum04B -= 4.0*RAB(i, j)*Wf(i, j)*sqrt(pow3(mu2(i, j))); | ||
1216 | } | ||
1217 | } | ||
1218 | |||
1219 | scalar etaA = sum04A/sum2; | ||
1220 | scalar etaB = sum04B/sum2; | ||
1221 | eta = etaA + q*etaB; | ||
1222 | |||
1223 | if (eta < (sqr(q) + 1.0)) | ||
1224 | { | ||
1225 | q = calcQ(q, eta); | ||
1226 | eta = sqr(q) + 1.0; | ||
1227 | } | ||
1228 | } | ||
1229 | |||
1230 | scalarSquareMatrix mu3(3, 0.0); | ||
1231 | scalarSquareMatrix mu4(3, 0.0); | ||
1232 | |||
1233 | for (label i = 0; i < 3; i++) | ||
1234 | { | ||
1235 | for (label j = 0; j < 3; j++) | ||
1236 | { | ||
1237 | mu3(i, j) = q*sqrt(pow3(mu2(i, j))); | ||
1238 | mu4(i, j) = eta*sqr(mu2(i, j)); | ||
1239 | } | ||
1240 | } | ||
1241 | |||
1242 | for (label i = 0; i < 3; i++) | ||
1243 | { | ||
1244 | for (label j = 0; j < 3; j++) | ||
1245 | { | ||
1246 | univariateMomentSet mMu | ||
1247 | ( | ||
1248 | {1.0, 0.0, mu2(i, j), mu3(i, j), mu4(i, j)}, | ||
1249 | "R" | ||
1250 | ); | ||
1251 | |||
1252 | univariateInverter_().invert(mMu); | ||
1253 | |||
1254 | for (label k = 0; k < 3; k++) | ||
1255 | { | ||
1256 | weights_(i, j, k) = | ||
1257 | m000 | ||
1258 | *wDir1[i] | ||
1259 | *wDir12(i, j) | ||
1260 | *univariateInverter_().weights()[k]; | ||
1261 | |||
1262 | velocityAbscissae_(i, j, k) = | ||
1263 | vector | ||
1264 | ( | ||
1265 | absDir1[i] + meanU, | ||
1266 | Vf[i] + absDir2(i, j) + meanV, | ||
1267 | Wf(i, j) | ||
1268 | + univariateInverter_().abscissae()[k] | ||
1269 | + meanW | ||
1270 | ); | ||
1271 | } | ||
1272 | } | ||
1273 | } | ||
1274 | } | ||
1275 | } | ||
1276 | |||
1277 | bool Foam::multivariateMomentInversions::CHyQMOMPlus::invert | ||
1278 | ( | ||
1279 | const multivariateMomentSet& moments | ||
1280 | ) | ||
1281 | { | ||
1282 | reset(); | ||
1283 | |||
1284 | if (nvelocityDimensions_ == 3) | ||
1285 | { | ||
1286 | invert3D(moments); | ||
1287 | } | ||
1288 | else if (nvelocityDimensions_ == 2) | ||
1289 | { | ||
1290 | mappedScalarList w | ||
1291 | ( | ||
1292 | getNNodes(2), | ||
1293 | twoDimNodeIndexes | ||
1294 | ); | ||
1295 | mappedList<vector2D> u | ||
1296 | ( | ||
1297 | getNNodes(2), | ||
1298 | twoDimNodeIndexes | ||
1299 | ); | ||
1300 | |||
1301 | invert2D(moments, w, u); | ||
1302 | |||
1303 | forAll(u, nodei) | ||
1304 | { | ||
1305 | weights_[nodei] = w[nodei]; | ||
1306 | velocityAbscissae_[nodei] = | ||
1307 | vector | ||
1308 | ( | ||
1309 | u[nodei].x(), | ||
1310 | u[nodei].y(), | ||
1311 | 0.0 | ||
1312 | ); | ||
1313 | } | ||
1314 | } | ||
1315 | else | ||
1316 | { | ||
1317 | scalarList w(getNNodes(1), 0.0); | ||
1318 | scalarList u(getNNodes(1), 0.0); | ||
1319 | |||
1320 | invert1D(moments, w, u); | ||
1321 | |||
1322 | forAll(w, nodei) | ||
1323 | { | ||
1324 | weights_[nodei] = w[nodei]; | ||
1325 | velocityAbscissae_[nodei] = vector(u[nodei], 0.0, 0.0); | ||
1326 | } | ||
1327 | } | ||
1328 | |||
1329 | return true; | ||
1330 | } | ||
1331 | |||
1332 | |||
1333 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/CHyQMOMPlus/CHyQMOMPlusMomentInversion.H renamed from multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/hyperbolic/hyperbolicConditionalMomentInversion.H (similarity 70%) (mode: 100644) (index 1de2655..7d80e49) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::hyperbolicConditionalMomentInversion | ||
25 | Foam::multivariateMomentInversions::CHyQMOMPlus | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Implementation of the hyperbolic conditional quadrature method of moment | Implementation of the hyperbolic conditional quadrature method of moment |
... | ... | Description | |
31 | 31 | ||
32 | 32 | SourceFiles | SourceFiles |
33 | 33 | hyperbolicConditionalMomentInversion.C | hyperbolicConditionalMomentInversion.C |
34 | hyperbolicConditionalMomentInversionI.C | ||
35 | 34 | ||
36 | 35 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
37 | 36 | ||
38 | #ifndef hyperbolicConditionalMomentInversion_H | ||
39 | #define hyperbolicConditionalMomentInversion_H | ||
37 | #ifndef CHyQMOMPlusMomentInversion_H | ||
38 | #define CHyQMOMPlusMomentInversion_H | ||
40 | 39 | ||
41 | 40 | ||
42 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
... | ... | SourceFiles | |
48 | 47 | #include "dictionary.H" | #include "dictionary.H" |
49 | 48 | #include "mappedList.H" | #include "mappedList.H" |
50 | 49 | #include "univariateMomentSet.H" | #include "univariateMomentSet.H" |
51 | #include "multivariateMomentSet.H" | ||
50 | #include "multivariateMomentInversion.H" | ||
52 | 51 | #include "hyperbolicMomentInversion.H" | #include "hyperbolicMomentInversion.H" |
53 | 52 | ||
54 | 53 | ||
55 | 54 | namespace Foam | namespace Foam |
56 | 55 | { | { |
56 | namespace multivariateMomentInversions | ||
57 | { | ||
57 | 58 | ||
58 | 59 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
59 | Class hyperbolicConditionalMomentInversion Declaration | ||
60 | Class CHyQMOMPlus Declaration | ||
60 | 61 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
61 | class hyperbolicConditionalMomentInversion | ||
62 | class CHyQMOMPlus | ||
63 | : | ||
64 | public multivariateMomentInversion | ||
62 | 65 | { | { |
63 | 66 | // Private member data | // Private member data |
64 | 67 | ||
65 | //- Number of dimensions in velocity space | ||
66 | const label nDimensions_; | ||
67 | |||
68 | //- Number of moments | ||
69 | const label nMoments_; | ||
70 | |||
71 | //- List of the number of nodes | ||
72 | const label nNodes_; | ||
73 | |||
74 | //- Support of the NDF | ||
75 | const word support_; | ||
76 | |||
77 | //- Moments | ||
78 | mappedList<scalar> moments_; | ||
79 | |||
80 | //- Quadratrure abscissae | ||
81 | mappedList<vector> abscissae_; | ||
82 | |||
83 | //- Quadratrure weights | ||
84 | mappedList<scalar> weights_; | ||
85 | |||
86 | 68 | //- Univariate moment inversion method | //- Univariate moment inversion method |
87 | 69 | autoPtr<hyperbolicMomentInversion> univariateInverter_; | autoPtr<hyperbolicMomentInversion> univariateInverter_; |
88 | 70 | ||
... | ... | class hyperbolicConditionalMomentInversion | |
137 | 119 | const multivariateMomentSet& moments | const multivariateMomentSet& moments |
138 | 120 | ); | ); |
139 | 121 | ||
140 | //- Reset inverter | ||
141 | void reset(); | ||
142 | |||
143 | //- Return the number of moments given a number of dimensions | ||
144 | label getNMoments(const label nDims) const; | ||
145 | |||
146 | //- Return the moment orders give a number of dimensions | ||
147 | labelListList getMomentOrders(const label nDims) const; | ||
148 | |||
149 | //- Return the number of nodes given a number of dimensions | ||
150 | label getNNodes(const label nDims) const; | ||
151 | |||
152 | //- Return the node indexes give a number of dimensions | ||
153 | labelListList getNodeIndexes(const label nDims) const; | ||
154 | |||
155 | 122 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
156 | //hyperbolicConditionalMomentInversion(const hyperbolicConditionalMomentInversion&); | ||
123 | //CHyQMOMPlus(const CHyQMOMPlus&); | ||
157 | 124 | ||
158 | 125 | //- Disallow default bitwise assignment | //- Disallow default bitwise assignment |
159 | //void operator=(const hyperbolicConditionalMomentInversion&); | ||
126 | //void operator=(const CHyQMOMPlus&); | ||
160 | 127 | ||
161 | 128 | ||
162 | 129 | public: | public: |
163 | 130 | ||
131 | //- Runtime type information | ||
132 | TypeName("CHyQMOMPlus"); | ||
133 | |||
134 | |||
164 | 135 | // Constructors | // Constructors |
165 | 136 | ||
166 | 137 | // Construct from nMoments, momentMap, nNodes, and support type | // Construct from nMoments, momentMap, nNodes, and support type |
167 | hyperbolicConditionalMomentInversion | ||
138 | CHyQMOMPlus | ||
168 | 139 | ( | ( |
169 | 140 | const dictionary& dict, | const dictionary& dict, |
170 | const label nDimensions | ||
141 | const labelListList& momentOrders, | ||
142 | const labelListList& nodeIndexes, | ||
143 | const labelList& velocityIndexes | ||
171 | 144 | ); | ); |
172 | 145 | ||
173 | 146 | ||
174 | 147 | //- Destructor | //- Destructor |
175 | virtual ~hyperbolicConditionalMomentInversion(); | ||
148 | virtual ~CHyQMOMPlus(); | ||
176 | 149 | ||
177 | 150 | // Static data | // Static data |
178 | 151 | ||
152 | //- Return the number of moments given a number of dimensions | ||
153 | static label getNMoments(const label nDims); | ||
154 | |||
155 | //- Return the moment orders give a number of dimensions | ||
156 | static labelListList getMomentOrders(const label nDims); | ||
157 | |||
158 | //- Return the number of nodes given a number of dimensions | ||
159 | static label getNNodes(const label nDims); | ||
160 | |||
161 | //- Return the node indexes give a number of dimensions | ||
162 | static labelListList getNodeIndexes(const label nDims); | ||
163 | |||
179 | 164 | //- List of moment orders in two dimensions | //- List of moment orders in two dimensions |
180 | 165 | static const labelListList twoDimMomentOrders; | static const labelListList twoDimMomentOrders; |
181 | 166 | ||
... | ... | public: | |
192 | 177 | // Member Functions | // Member Functions |
193 | 178 | ||
194 | 179 | //- Invert moments to find weights and abscissae | //- Invert moments to find weights and abscissae |
195 | void invert(const multivariateMomentSet& moments); | ||
196 | |||
197 | //- Return number of moments | ||
198 | inline label nMoments(); | ||
199 | |||
200 | //- Return number of number of nodes in each dimension | ||
201 | inline label nNodes(); | ||
202 | |||
203 | //- Return mapped quadrature weights for each dimension | ||
204 | inline const mappedList<scalar>& weights() const; | ||
205 | |||
206 | //- Return mapped quadrature abscissae for each dimension | ||
207 | inline const mappedList<vector>& abscissae() const; | ||
180 | virtual bool invert(const multivariateMomentSet& moments); | ||
208 | 181 | }; | }; |
209 | 182 | ||
210 | 183 | ||
211 | 184 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
212 | 185 | ||
186 | } // End namespace multivariateMomentInversions | ||
213 | 187 | } // End namespace Foam | } // End namespace Foam |
214 | 188 | ||
215 | |||
216 | 189 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
217 | 190 | ||
218 | #include "hyperbolicConditionalMomentInversionI.H" | ||
219 | |||
220 | 191 | #endif | #endif |
221 | 192 | ||
222 | |||
223 | 193 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/TensorProduct/TensorProductMomentInversion.C added (mode: 100644) (index 0000000..9e5f1e1) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "TensorProductMomentInversion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | namespace multivariateMomentInversions | ||
34 | { | ||
35 | defineTypeNameAndDebug(TensorProduct, 0); | ||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | multivariateMomentInversion, | ||
39 | TensorProduct, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | void Foam::multivariateMomentInversions::TensorProduct::buildIndexes | ||
46 | ( | ||
47 | labelListList& nodeIndexes, | ||
48 | const labelList& nNodes, | ||
49 | label dimi, | ||
50 | label& nodei, | ||
51 | labelList& index | ||
52 | ) | ||
53 | { | ||
54 | if (dimi < nNodes.size()) | ||
55 | { | ||
56 | for (label i = 0; i < nNodes[dimi]; i++) | ||
57 | { | ||
58 | index[dimi] = i; | ||
59 | buildIndexes(nodeIndexes, nNodes, dimi+1, nodei, index); | ||
60 | } | ||
61 | } | ||
62 | else | ||
63 | { | ||
64 | nodeIndexes[nodei] = index; | ||
65 | nodei++; | ||
66 | } | ||
67 | } | ||
68 | |||
69 | |||
70 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
71 | |||
72 | Foam::multivariateMomentInversions::TensorProduct::TensorProduct | ||
73 | ( | ||
74 | const dictionary& dict, | ||
75 | const labelListList& momentOrders, | ||
76 | const labelListList& nodeIndexes, | ||
77 | const labelList& velocityIndexes | ||
78 | ) | ||
79 | : | ||
80 | multivariateMomentInversion | ||
81 | ( | ||
82 | dict, | ||
83 | momentOrders, | ||
84 | nodeIndexes, | ||
85 | velocityIndexes | ||
86 | ), | ||
87 | nPureMoments_(nNodes_.size(), 0), | ||
88 | supports_(dict.lookup("supports")), | ||
89 | univariateInverters_(nNodes_.size()) | ||
90 | { | ||
91 | forAll(univariateInverters_, dimi) | ||
92 | { | ||
93 | univariateInverters_.set | ||
94 | ( | ||
95 | dimi, | ||
96 | univariateMomentInversion::New | ||
97 | ( | ||
98 | dict.subDict("basicQuadrature" + Foam::name(dimi)) | ||
99 | ).ptr() | ||
100 | ); | ||
101 | } | ||
102 | |||
103 | forAll(momentOrders_, mi) | ||
104 | { | ||
105 | forAll(nPureMoments_, dimi) | ||
106 | { | ||
107 | nPureMoments_[dimi] = | ||
108 | max | ||
109 | ( | ||
110 | nPureMoments_[dimi], | ||
111 | momentOrders_[mi][dimi] + 1 | ||
112 | ); | ||
113 | } | ||
114 | } | ||
115 | } | ||
116 | |||
117 | |||
118 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
119 | |||
120 | Foam::multivariateMomentInversions::TensorProduct::~TensorProduct() | ||
121 | {} | ||
122 | |||
123 | |||
124 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
125 | |||
126 | bool Foam::multivariateMomentInversions::TensorProduct::invert | ||
127 | ( | ||
128 | const multivariateMomentSet& moments | ||
129 | ) | ||
130 | { | ||
131 | reset(); | ||
132 | labelList nNonZeroNodes(nNodes_.size(), 0); | ||
133 | labelList zeroOrder(momentOrders_[0].size(), 0); | ||
134 | |||
135 | label vi = 0; | ||
136 | label si = 0; | ||
137 | |||
138 | forAll(univariateInverters_, dimi) | ||
139 | { | ||
140 | univariateMomentSet univariateMoments | ||
141 | ( | ||
142 | nPureMoments_[dimi], | ||
143 | supports_[dimi], | ||
144 | 0.0 | ||
145 | ); | ||
146 | |||
147 | forAll(univariateMoments, mi) | ||
148 | { | ||
149 | labelList momentOrder(zeroOrder); | ||
150 | momentOrder[dimi] = mi; | ||
151 | univariateMoments[mi] = moments(momentOrder); | ||
152 | } | ||
153 | |||
154 | if (!univariateMoments.isRealizable(false)) | ||
155 | { | ||
156 | return false; | ||
157 | } | ||
158 | |||
159 | univariateInverters_[dimi].invert(univariateMoments); | ||
160 | |||
161 | const scalarList& abscissae = | ||
162 | univariateInverters_[dimi].abscissae(); | ||
163 | |||
164 | nNonZeroNodes[dimi] = abscissae.size(); | ||
165 | |||
166 | if (max(univariateInverters_[dimi].weights()) < small) | ||
167 | { | ||
168 | nNonZeroNodes[dimi] = 0; | ||
169 | } | ||
170 | |||
171 | if (nNonZeroNodes[dimi] > 0) | ||
172 | { | ||
173 | forAll(nodeIndexes_, nodei) | ||
174 | { | ||
175 | label nodeIndex = nodeIndexes_[nodei][dimi]; | ||
176 | |||
177 | if (nodeIndex < abscissae.size()) | ||
178 | { | ||
179 | if (dimi == velocityIndexes_[vi]) | ||
180 | { | ||
181 | velocityAbscissae_[nodei][vi] = abscissae[nodeIndex]; | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | abscissae_[nodei][si] = abscissae[nodeIndex]; | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
191 | if (dimi == velocityIndexes_[vi]) | ||
192 | { | ||
193 | vi++; | ||
194 | } | ||
195 | else | ||
196 | { | ||
197 | si++; | ||
198 | } | ||
199 | } | ||
200 | |||
201 | if (max(nNonZeroNodes) == 0) | ||
202 | { | ||
203 | return true; | ||
204 | } | ||
205 | |||
206 | label totNonZeroNodes = 1; | ||
207 | label nDims = 0; | ||
208 | |||
209 | forAll(nNonZeroNodes, dimi) | ||
210 | { | ||
211 | if (nNonZeroNodes[dimi] > 0) | ||
212 | { | ||
213 | totNonZeroNodes *= nNonZeroNodes[dimi]; | ||
214 | nDims++; | ||
215 | } | ||
216 | } | ||
217 | |||
218 | labelListList nonZeroNodeIndexes(totNonZeroNodes, labelList(nDims, 0)); | ||
219 | { | ||
220 | label nodei = 0; | ||
221 | labelList index(nDims); | ||
222 | buildIndexes(nonZeroNodeIndexes, nNonZeroNodes, 0, nodei, index); | ||
223 | } | ||
224 | |||
225 | scalarList mixedMoments(nonZeroNodeIndexes.size(), 0.0); | ||
226 | scalarSquareMatrix R(nonZeroNodeIndexes.size(), 1.0); | ||
227 | |||
228 | forAll(nonZeroNodeIndexes, nodei) | ||
229 | { | ||
230 | mixedMoments[nodei] = moments(nonZeroNodeIndexes[nodei]); | ||
231 | } | ||
232 | |||
233 | forAll(nonZeroNodeIndexes, mi) | ||
234 | { | ||
235 | forAll(nonZeroNodeIndexes, nodei) | ||
236 | { | ||
237 | vi = 0; | ||
238 | si = 0; | ||
239 | |||
240 | forAll(nonZeroNodeIndexes[nodei], dimi) | ||
241 | { | ||
242 | if (dimi == velocityIndexes_[vi]) | ||
243 | { | ||
244 | R(mi, nodei) *= | ||
245 | pow | ||
246 | ( | ||
247 | velocityAbscissae_(nonZeroNodeIndexes[nodei])[vi], | ||
248 | nonZeroNodeIndexes[mi][dimi] | ||
249 | ); | ||
250 | vi++; | ||
251 | } | ||
252 | else | ||
253 | { | ||
254 | R(mi, nodei) *= | ||
255 | pow | ||
256 | ( | ||
257 | abscissae_(nonZeroNodeIndexes[nodei])[si], | ||
258 | nonZeroNodeIndexes[mi][dimi] | ||
259 | ); | ||
260 | si++; | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | } | ||
265 | |||
266 | scalarList weights(nNonZeroNodes.size()); | ||
267 | solve(weights, R, mixedMoments); | ||
268 | |||
269 | forAll(nonZeroNodeIndexes, nodei) | ||
270 | { | ||
271 | weights_(nonZeroNodeIndexes[nodei]) = weights[nodei]; | ||
272 | } | ||
273 | |||
274 | return true; | ||
275 | } | ||
276 | |||
277 | |||
278 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/TensorProduct/TensorProductMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.H (similarity 54%) (mode: 100644) (index 9f98bdd..0efa7be) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::breakupKernel | ||
25 | Foam::multivariateMomentInversions::TensorProduct | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Abstract class for breakup kernels. | ||
28 | Tensor product moment inversion for multidimensional moment sets | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | breakupKernel.C | ||
31 | TensorProductMomentInversion.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef breakupKernel_H | ||
36 | #define breakupKernel_H | ||
35 | #ifndef TensorProductMomentInversion_H | ||
36 | #define TensorProductMomentInversion_H | ||
37 | 37 | ||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | 38 | ||
43 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 40 | ||
41 | #include "scalar.H" | ||
42 | #include "vector2D.H" | ||
43 | #include "vector.H" | ||
44 | #include "scalarMatrices.H" | ||
45 | #include "dictionary.H" | ||
46 | #include "mappedLists.H" | ||
47 | #include "Vandermonde.H" | ||
48 | #include "multivariateMomentInversion.H" | ||
49 | #include "univariateMomentInversion.H" | ||
50 | |||
51 | |||
45 | 52 | namespace Foam | namespace Foam |
46 | 53 | { | { |
47 | namespace populationBalanceSubModels | ||
54 | namespace multivariateMomentInversions | ||
48 | 55 | { | { |
49 | 56 | ||
50 | 57 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
51 | Class breakupKernel Declaration | ||
58 | Class TensorProduct Declaration | ||
52 | 59 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | |||
54 | class breakupKernel | ||
60 | class TensorProduct | ||
61 | : | ||
62 | public multivariateMomentInversion | ||
55 | 63 | { | { |
56 | // Private member functions | ||
64 | // Private member data | ||
57 | 65 | ||
58 | //- Disallow default bitwise copy construct | ||
59 | breakupKernel(const breakupKernel&); | ||
66 | //- Number of pure moments in each direction | ||
67 | labelList nPureMoments_; | ||
60 | 68 | ||
61 | //- Disallow default bitwise assignment | ||
62 | void operator=(const breakupKernel&); | ||
69 | //- Support of the NDF | ||
70 | wordList supports_; | ||
63 | 71 | ||
72 | //- Univariate moment inversion method | ||
73 | PtrList<univariateMomentInversion> univariateInverters_; | ||
64 | 74 | ||
65 | protected: | ||
66 | 75 | ||
67 | // Protected data | ||
68 | |||
69 | //- Dictionary | ||
70 | const dictionary& dict_; | ||
71 | |||
72 | //- Mesh | ||
73 | const fvMesh& mesh_; | ||
76 | // Private member functions | ||
74 | 77 | ||
75 | //- Coefficient of aggregation kernel | ||
76 | const dimensionedScalar Cb_; | ||
78 | //- Construct non-zero nodes indexes | ||
79 | void buildIndexes | ||
80 | ( | ||
81 | labelListList& nodeIndexes, | ||
82 | const labelList& nNodes, | ||
83 | label dimi, | ||
84 | label& nodei, | ||
85 | labelList& index | ||
86 | ); | ||
77 | 87 | ||
78 | 88 | ||
79 | 89 | public: | public: |
80 | 90 | ||
81 | 91 | //- Runtime type information | //- Runtime type information |
82 | TypeName("breakupKernel"); | ||
83 | |||
84 | // Declare runtime constructor selection table | ||
85 | declareRunTimeSelectionTable | ||
86 | ( | ||
87 | autoPtr, | ||
88 | breakupKernel, | ||
89 | dictionary, | ||
90 | ( | ||
91 | const dictionary& dict, | ||
92 | const fvMesh& mesh | ||
93 | ), | ||
94 | (dict, mesh) | ||
95 | ); | ||
92 | TypeName("TensorProduct"); | ||
96 | 93 | ||
97 | 94 | ||
98 | 95 | // Constructors | // Constructors |
99 | 96 | ||
100 | //- Construct from components | ||
101 | breakupKernel | ||
97 | // Construct from nMoments, momentMap, nNodes, and support type | ||
98 | TensorProduct | ||
102 | 99 | ( | ( |
103 | 100 | const dictionary& dict, | const dictionary& dict, |
104 | const fvMesh& mesh | ||
105 | ); | ||
106 | |||
107 | |||
108 | // Selectors | ||
109 | |||
110 | static autoPtr<breakupKernel> New | ||
111 | ( | ||
112 | const dictionary& dict, | ||
113 | const fvMesh& mesh | ||
101 | const labelListList& momentOrders, | ||
102 | const labelListList& nodeIndexes, | ||
103 | const labelList& velocityIndexes | ||
114 | 104 | ); | ); |
115 | 105 | ||
116 | 106 | ||
117 | 107 | //- Destructor | //- Destructor |
118 | virtual ~breakupKernel(); | ||
108 | virtual ~TensorProduct(); | ||
119 | 109 | ||
120 | 110 | ||
121 | 111 | // Member Functions | // Member Functions |
122 | 112 | ||
123 | //- Breakup kernel | ||
124 | virtual scalar Kb | ||
125 | ( | ||
126 | const scalar& abscissa, | ||
127 | const label celli, | ||
128 | const label environment = 0 | ||
129 | ) const = 0; | ||
113 | //- Invert moments to find weights and abscissae | ||
114 | virtual bool invert(const multivariateMomentSet& moments); | ||
130 | 115 | }; | }; |
131 | 116 | ||
132 | 117 | ||
133 | 118 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
134 | 119 | ||
135 | } // End namespace populationBalanceSubModels | ||
120 | } // End namespace multivariateMomentInversions | ||
136 | 121 | } // End namespace Foam | } // End namespace Foam |
137 | 122 | ||
123 | |||
138 | 124 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
139 | 125 | ||
140 | 126 | #endif | #endif |
141 | 127 | ||
128 | |||
142 | 129 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/conditional/conditionalMomentInversion.C changed (mode: 100644) (index 904a350..c0ee29f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | 26 | #include "conditionalMomentInversion.H" | #include "conditionalMomentInversion.H" |
27 | #include "addToRunTimeSelectionTable.H" | ||
27 | 28 | ||
28 | 29 | ||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | namespace multivariateMomentInversions | ||
35 | { | ||
36 | defineTypeNameAndDebug(conditional, 0); | ||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | multivariateMomentInversion, | ||
40 | conditional, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
29 | 46 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
30 | 47 | ||
31 | Foam::conditionalMomentInversion::conditionalMomentInversion | ||
48 | Foam::multivariateMomentInversions::conditional::conditional | ||
32 | 49 | ( | ( |
33 | 50 | const dictionary& dict, | const dictionary& dict, |
34 | 51 | const labelListList& momentOrders, | const labelListList& momentOrders, |
35 | 52 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
36 | const labelList& nNodes, | ||
37 | const List<word>& support | ||
53 | const labelList& velocityIndexes | ||
38 | 54 | ) | ) |
39 | 55 | : | : |
40 | nMoments_(momentOrders.size()), | ||
41 | nNodes_(nNodes), | ||
42 | nDims_(momentOrders[0].size()), | ||
43 | support_(support), | ||
44 | abscissae_(nDims_), | ||
45 | weights_(nDims_), | ||
46 | moments_(nMoments_, momentOrders, support[0], 0.0), | ||
47 | conditionalMoments_(nDims_), | ||
48 | invVR_(nDims_ - 1), | ||
49 | momentInverter_ | ||
56 | multivariateMomentInversion | ||
50 | 57 | ( | ( |
51 | univariateMomentInversion::New(dict.subDict("basicQuadrature")) | ||
52 | ) | ||
58 | dict, | ||
59 | momentOrders, | ||
60 | nodeIndexes, | ||
61 | velocityIndexes | ||
62 | ), | ||
63 | nPureMoments_(nNodes_.size(), 0), | ||
64 | supports_(dict.lookup("supports")), | ||
65 | moments_(momentOrders.size(), momentOrders, supports_[0], 0.0), | ||
66 | conditionalWeights_(nNodes_.size()), | ||
67 | conditionalMoments_(nNodes_.size()), | ||
68 | invVR_(nNodes_.size() - 1), | ||
69 | momentInverters_(nNodes_.size()) | ||
53 | 70 | { | { |
71 | forAll(momentInverters_, dimi) | ||
72 | { | ||
73 | momentInverters_.set | ||
74 | ( | ||
75 | dimi, | ||
76 | univariateMomentInversion::New | ||
77 | ( | ||
78 | dict.subDict("basicQuadrature" + Foam::name(dimi)) | ||
79 | ).ptr() | ||
80 | ); | ||
81 | } | ||
82 | |||
83 | forAll(momentOrders_, mi) | ||
84 | { | ||
85 | forAll(nPureMoments_, dimi) | ||
86 | { | ||
87 | nPureMoments_[dimi] = | ||
88 | max | ||
89 | ( | ||
90 | nPureMoments_[dimi], | ||
91 | momentOrders_[mi][dimi] + 1 | ||
92 | ); | ||
93 | } | ||
94 | } | ||
95 | |||
54 | 96 | labelList nNodesCM = nNodes_; | labelList nNodesCM = nNodes_; |
55 | 97 | ||
56 | 98 | forAll(nNodes_, dimi) | forAll(nNodes_, dimi) |
... | ... | Foam::conditionalMomentInversion::conditionalMomentInversion | |
59 | 101 | labelList pos(nDimensions); | labelList pos(nDimensions); |
60 | 102 | label mi = 0; | label mi = 0; |
61 | 103 | Map<label> nodeMap(0); | Map<label> nodeMap(0); |
62 | setNodeMap(nodeMap, nDimensions, nNodes, 0, mi, pos); | ||
104 | setNodeMap(nodeMap, nDimensions, nNodes_, 0, mi, pos); | ||
63 | 105 | label nCmpts = nodeMap.size(); | label nCmpts = nodeMap.size(); |
64 | 106 | ||
65 | weights_.set(dimi, new mappedList<scalar>(nCmpts, nodeMap, 0.0)); | ||
66 | abscissae_.set(dimi, new mappedList<scalar>(nCmpts, nodeMap, 0.0)); | ||
107 | conditionalWeights_.set | ||
108 | ( | ||
109 | dimi, | ||
110 | new mappedScalarList(nCmpts, nodeMap, 0.0) | ||
111 | ); | ||
67 | 112 | } | } |
68 | 113 | ||
69 | 114 | forAll(conditionalMoments_, dimi) | forAll(conditionalMoments_, dimi) |
... | ... | Foam::conditionalMomentInversion::conditionalMomentInversion | |
115 | 160 | ) | ) |
116 | 161 | ); | ); |
117 | 162 | } | } |
118 | |||
119 | // Set all lists to zero | ||
120 | reset(); | ||
121 | 163 | } | } |
122 | 164 | ||
123 | 165 | ||
124 | 166 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
125 | 167 | ||
126 | Foam::conditionalMomentInversion::~conditionalMomentInversion() | ||
168 | Foam::multivariateMomentInversions::conditional::~conditional() | ||
127 | 169 | {} | {} |
128 | 170 | ||
129 | 171 | ||
130 | 172 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
131 | 173 | ||
132 | void Foam::conditionalMomentInversion::invert | ||
174 | bool Foam::multivariateMomentInversions::conditional::invert | ||
133 | 175 | ( | ( |
134 | 176 | const multivariateMomentSet& moments | const multivariateMomentSet& moments |
135 | 177 | ) | ) |
136 | 178 | { | { |
137 | 179 | reset(); | reset(); |
138 | 180 | ||
139 | forAll(moments, mi) | ||
181 | forAll(invVR_, dimi) | ||
140 | 182 | { | { |
141 | moments_[mi] = moments[mi]; | ||
183 | forAll(invVR_[dimi], ai) | ||
184 | { | ||
185 | invVR_[dimi][ai] = scalarSquareMatrix(nNodes_[dimi]); | ||
186 | } | ||
187 | |||
188 | forAll(conditionalMoments_[dimi], dimj) | ||
189 | { | ||
190 | forAll(conditionalMoments_[dimi][dimj], ai) | ||
191 | { | ||
192 | conditionalMoments_[dimi][dimj][ai] = 0.0; | ||
193 | } | ||
194 | } | ||
195 | } | ||
196 | |||
197 | forAll(conditionalWeights_, dimi) | ||
198 | { | ||
199 | forAll(conditionalWeights_[dimi], ai) | ||
200 | { | ||
201 | conditionalWeights_[dimi][ai] = 0.0; | ||
202 | } | ||
142 | 203 | } | } |
143 | 204 | ||
205 | moments_ = moments; | ||
206 | |||
144 | 207 | // Invert primary direction first | // Invert primary direction first |
145 | labelList pos(nDims_, 0); | ||
208 | labelList pos(nNodes_.size(), 0); | ||
146 | 209 | ||
147 | univariateMomentSet momentsToInvert(2*nNodes_[0], support_[0]); | ||
210 | univariateMomentSet momentsToInvert(nPureMoments_[0], supports_[0]); | ||
148 | 211 | ||
149 | for (label mi = 0; mi < 2*nNodes_[0]; mi++) | ||
212 | forAll(momentsToInvert, mi) | ||
150 | 213 | { | { |
151 | pos[0] = mi; | ||
152 | momentsToInvert[mi] = moments_(pos); | ||
214 | momentsToInvert[mi] = moments(mi); | ||
153 | 215 | } | } |
154 | 216 | ||
155 | momentInverter_().invert(momentsToInvert); | ||
217 | if (!momentsToInvert.isRealizable(false)) | ||
218 | { | ||
219 | return false; | ||
220 | } | ||
221 | |||
222 | momentInverters_[0].invert(momentsToInvert); | ||
156 | 223 | ||
157 | for (label nodei = 0; nodei < nNodes_[0]; nodei++) | ||
224 | const scalarList& weights = momentInverters_[0].weights(); | ||
225 | const scalarList& abscissae = momentInverters_[0].abscissae(); | ||
226 | |||
227 | vi_ = 0; | ||
228 | si_ = 0; | ||
229 | |||
230 | forAll(weights, nodei) | ||
158 | 231 | { | { |
159 | // First component of the weights and abscissae only have one direction | ||
160 | // Copy from univariateMomentSet to stored copy | ||
161 | weights_[0](nodei) = momentInverter_().weights()[nodei]; | ||
162 | abscissae_[0](nodei) = momentInverter_().abscissae()[nodei]; | ||
232 | conditionalWeights_[0](nodei) = weights[nodei]; | ||
163 | 233 | } | } |
164 | 234 | ||
165 | // Solve remaining directions | ||
166 | for (label dimi = 1; dimi < nDims_; dimi++) | ||
235 | forAll(nodeIndexes_, nodei) | ||
167 | 236 | { | { |
168 | for (label dimj = 0; dimj < dimi; dimj++) | ||
237 | label index = nodeIndexes_[nodei][0]; | ||
238 | |||
239 | if (index < weights.size()) | ||
169 | 240 | { | { |
170 | if (dimj == 0) | ||
241 | weights_[nodei] = weights[index]; | ||
242 | |||
243 | if (velocityIndexes_[vi_] == 0) | ||
171 | 244 | { | { |
172 | labelList pos(dimi, 0); | ||
173 | setVR(dimi - 1, pos, 0); | ||
245 | velocityAbscissae_[nodei][0] = abscissae[index]; | ||
174 | 246 | } | } |
247 | else | ||
248 | { | ||
249 | abscissae_[nodei][0] = abscissae[index]; | ||
250 | } | ||
251 | } | ||
252 | } | ||
253 | |||
254 | // Solve remaining directions | ||
255 | for (label dimi = 1; dimi < nNodes_.size(); dimi++) | ||
256 | { | ||
257 | //- Set invVR matrices | ||
258 | { | ||
259 | labelList pos(dimi, 0); | ||
260 | setVR(dimi - 1, pos, 0); | ||
261 | } | ||
262 | |||
263 | for (label dimj = 0; dimj < dimi; dimj++) | ||
264 | { | ||
175 | 265 | labelList posC(dimi + 1, 0); | labelList posC(dimi + 1, 0); |
176 | 266 | cycleAlphaCM(dimi, dimj, 0, posC); | cycleAlphaCM(dimi, dimj, 0, posC); |
177 | 267 | } | } |
178 | 268 | ||
269 | if (velocityIndexes_[vi_] == dimi - 1) | ||
270 | { | ||
271 | vi_++; | ||
272 | |||
273 | if (vi_ >= velocityIndexes_.size()) | ||
274 | { | ||
275 | vi_ = 0; | ||
276 | } | ||
277 | } | ||
278 | else | ||
279 | { | ||
280 | si_++; | ||
281 | } | ||
282 | |||
179 | 283 | labelList posW(dimi + 1, 0); | labelList posW(dimi + 1, 0); |
180 | cycleAlphaWheeler(dimi, 0, posW); | ||
284 | |||
285 | if (!cycleAlphaWheeler(dimi, 0, posW)) | ||
286 | { | ||
287 | return false; | ||
288 | } | ||
181 | 289 | } | } |
290 | |||
291 | return true; | ||
182 | 292 | } | } |
183 | 293 | ||
184 | void Foam::conditionalMomentInversion::setNodeMap | ||
294 | void Foam::multivariateMomentInversions::conditional::setNodeMap | ||
185 | 295 | ( | ( |
186 | 296 | Map<label>& map, | Map<label>& map, |
187 | 297 | const label nDimensions, | const label nDimensions, |
... | ... | void Foam::conditionalMomentInversion::setNodeMap | |
217 | 327 | } | } |
218 | 328 | } | } |
219 | 329 | ||
220 | void Foam::conditionalMomentInversion::cycleAlphaCM | ||
330 | void | ||
331 | Foam::multivariateMomentInversions::conditional::cycleAlphaCM | ||
221 | 332 | ( | ( |
222 | 333 | const label dimi, | const label dimi, |
223 | 334 | const label dimj, | const label dimj, |
... | ... | void Foam::conditionalMomentInversion::cycleAlphaCM | |
228 | 339 | if (dimj == ai) | if (dimj == ai) |
229 | 340 | { | { |
230 | 341 | cycleAlphaCM(dimi, dimj, ai+1, pos); | cycleAlphaCM(dimi, dimj, ai+1, pos); |
342 | |||
231 | 343 | return; | return; |
232 | 344 | } | } |
233 | 345 | else if (ai < dimi) | else if (ai < dimi) |
... | ... | void Foam::conditionalMomentInversion::cycleAlphaCM | |
237 | 349 | pos[ai] = i; | pos[ai] = i; |
238 | 350 | cycleAlphaCM(dimi, dimj, ai+1, pos); | cycleAlphaCM(dimi, dimj, ai+1, pos); |
239 | 351 | } | } |
352 | |||
240 | 353 | return; | return; |
241 | 354 | } | } |
242 | 355 | else if (ai == dimi) | else if (ai == dimi) |
243 | 356 | { | { |
244 | for (label i = 0; i < 2*nNodes_[dimi]; i++) | ||
357 | for (label i = 0; i < nPureMoments_[dimi]; i++) | ||
245 | 358 | { | { |
246 | 359 | pos[dimi] = i; | pos[dimi] = i; |
247 | 360 | cycleAlphaCM(dimi, dimj, ai+1, pos); | cycleAlphaCM(dimi, dimj, ai+1, pos); |
248 | 361 | } | } |
362 | |||
249 | 363 | return; | return; |
250 | 364 | } | } |
251 | 365 | else | else |
252 | 366 | { | { |
253 | scalarRectangularMatrix Yold(nNodes_[dimj], 1, 0.0); | ||
367 | labelList posVR(max(1, dimj), 0); | ||
254 | 368 | ||
255 | for (label i = 0; i < nNodes_[dimj]; i++) | ||
369 | if (dimj != 0) | ||
370 | { | ||
371 | for (label i = 0; i < posVR.size(); i++) | ||
372 | { | ||
373 | posVR[i] = pos[i]; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | const scalarSquareMatrix& invVR = invVR_[dimj](posVR); | ||
378 | label size = invVR.m(); | ||
379 | scalarRectangularMatrix nu(size, 1, 0.0); | ||
380 | |||
381 | for (label i = 0; i < size; i++) | ||
256 | 382 | { | { |
257 | 383 | pos[dimj] = i; | pos[dimj] = i; |
258 | 384 | ||
259 | 385 | if (dimj == 0) | if (dimj == 0) |
260 | 386 | { | { |
261 | labelList posM(nDims_, 0); | ||
262 | |||
387 | labelList posM(nNodes_.size(), 0); | ||
263 | 388 | for (label mi = 0; mi < pos.size(); mi++) | for (label mi = 0; mi < pos.size(); mi++) |
264 | 389 | { | { |
265 | 390 | posM[mi] = pos[mi]; | posM[mi] = pos[mi]; |
266 | 391 | } | } |
267 | |||
268 | Yold(i, 0) = moments_(posM); | ||
392 | nu(i, 0) = moments_(posM); | ||
269 | 393 | } | } |
270 | 394 | else | else |
271 | 395 | { | { |
272 | Yold(i, 0) = | ||
273 | conditionalMoments_[dimi][dimj - 1](pos); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | labelList posVR(max(1, dimj), 0); | ||
278 | |||
279 | if (dimj != 0) | ||
280 | { | ||
281 | for (label i = 0; i < posVR.size(); i++) | ||
282 | { | ||
283 | posVR[i] = pos[i]; | ||
396 | nu(i, 0) = conditionalMoments_[dimi][dimj - 1](pos); | ||
284 | 397 | } | } |
285 | 398 | } | } |
286 | 399 | ||
287 | scalarRectangularMatrix Ynew = invVR_[dimj](posVR)*Yold; | ||
400 | scalarRectangularMatrix gamma = invVR*nu; | ||
288 | 401 | ||
289 | 402 | for (label i = 0; i < nNodes_[dimj]; i++) | for (label i = 0; i < nNodes_[dimj]; i++) |
290 | 403 | { | { |
291 | 404 | pos[dimj] = i; | pos[dimj] = i; |
292 | conditionalMoments_[dimi][dimj](pos) = Ynew(i, 0); | ||
405 | if (i < size) | ||
406 | { | ||
407 | conditionalMoments_[dimi][dimj](pos) = gamma(i, 0); | ||
408 | } | ||
409 | else | ||
410 | { | ||
411 | conditionalMoments_[dimi][dimj](pos) = 0.0; | ||
412 | } | ||
293 | 413 | } | } |
294 | 414 | } | } |
295 | 415 | } | } |
296 | 416 | ||
297 | void Foam::conditionalMomentInversion::setVR | ||
417 | void Foam::multivariateMomentInversions::conditional::setVR | ||
298 | 418 | ( | ( |
299 | const label dimi, | ||
419 | const label dimj, | ||
300 | 420 | labelList& pos, | labelList& pos, |
301 | 421 | label ai | label ai |
302 | 422 | ) | ) |
303 | 423 | { | { |
304 | if (ai < dimi) | ||
424 | if (ai < dimj) | ||
305 | 425 | { | { |
306 | 426 | for (label i = 0; i < nNodes_[ai]; i++) | for (label i = 0; i < nNodes_[ai]; i++) |
307 | 427 | { | { |
308 | 428 | pos[ai] = i; | pos[ai] = i; |
309 | |||
310 | setVR(dimi, pos, ai + 1); | ||
429 | setVR(dimj, pos, ai + 1); | ||
311 | 430 | } | } |
312 | 431 | } | } |
313 | 432 | else | else |
314 | 433 | { | { |
315 | scalarDiagonalMatrix x(nNodes_[dimi], 0.0); | ||
316 | scalarSquareMatrix invR(nNodes_[dimi], 0.0); | ||
434 | scalarDiagonalMatrix weights; | ||
435 | scalarDiagonalMatrix x; | ||
317 | 436 | ||
318 | for (label nodei = 0; nodei < nNodes_[dimi]; nodei++) | ||
437 | for (label nodei = 0; nodei < nNodes_[dimj]; nodei++) | ||
319 | 438 | { | { |
320 | if (nodei >= momentInverter_().nNodes()) | ||
439 | pos[dimj] = nodei; | ||
440 | scalar abscissa = 0.0; | ||
441 | scalar weight = conditionalWeights_[dimj](pos); | ||
442 | if (velocityIndexes_[vi_] == dimj) | ||
321 | 443 | { | { |
322 | weights_[dimi](pos) = scalar(0); | ||
323 | abscissae_[dimi](pos) = scalar(0); | ||
324 | continue; | ||
444 | abscissa = velocityAbscissae_(pos)[vi_]; | ||
445 | } | ||
446 | else | ||
447 | { | ||
448 | abscissa = abscissae_(pos)[si_]; | ||
325 | 449 | } | } |
326 | 450 | ||
327 | pos[dimi] = nodei; | ||
328 | x[nodei] = abscissae_[dimi](pos); | ||
329 | invR[nodei][nodei] = 1.0/weights_[dimi](pos); | ||
451 | if (mag(abscissa) > small && weight > small) | ||
452 | { | ||
453 | x.append(abscissa); | ||
454 | weights.append(weight); | ||
455 | } | ||
456 | } | ||
457 | |||
458 | scalarSquareMatrix invR(weights.size(), 0.0); | ||
459 | |||
460 | forAll(weights, nodei) | ||
461 | { | ||
462 | invR[nodei][nodei] = 1.0/weights[nodei]; | ||
330 | 463 | } | } |
331 | 464 | ||
332 | 465 | Vandermonde V(x); | Vandermonde V(x); |
333 | 466 | scalarSquareMatrix invV(V.inv()); | scalarSquareMatrix invV(V.inv()); |
334 | labelList posVR(max(1, dimi), 0); | ||
467 | labelList posVR(max(1, dimj), 0); | ||
335 | 468 | ||
336 | if (dimi > 0) | ||
469 | if (dimj > 0) | ||
337 | 470 | { | { |
338 | 471 | for (label ai = 0; ai < posVR.size(); ai++) | for (label ai = 0; ai < posVR.size(); ai++) |
339 | 472 | { | { |
... | ... | void Foam::conditionalMomentInversion::setVR | |
341 | 474 | } | } |
342 | 475 | } | } |
343 | 476 | ||
344 | invVR_[dimi](posVR) = invR*invV; | ||
477 | invVR_[dimj](posVR) = invR*invV; | ||
345 | 478 | } | } |
346 | 479 | } | } |
347 | 480 | ||
348 | void Foam::conditionalMomentInversion::cycleAlphaWheeler | ||
481 | bool Foam::multivariateMomentInversions::conditional::cycleAlphaWheeler | ||
349 | 482 | ( | ( |
350 | 483 | const label dimi, | const label dimi, |
351 | 484 | label ai, | label ai, |
... | ... | void Foam::conditionalMomentInversion::cycleAlphaWheeler | |
357 | 490 | for (label i = 0; i < nNodes_[ai]; i++) | for (label i = 0; i < nNodes_[ai]; i++) |
358 | 491 | { | { |
359 | 492 | pos[ai] = i; | pos[ai] = i; |
360 | |||
361 | 493 | cycleAlphaWheeler(dimi, ai + 1, pos); | cycleAlphaWheeler(dimi, ai + 1, pos); |
362 | 494 | } | } |
363 | 495 | ||
364 | return; | ||
496 | return true; | ||
365 | 497 | } | } |
366 | 498 | else | else |
367 | 499 | { | { |
368 | univariateMomentSet momentsToInvert(2*nNodes_[dimi], support_[dimi]); | ||
500 | pos[dimi] = 0; | ||
501 | scalar cm0 = conditionalMoments_[dimi][dimi - 1](pos); | ||
502 | |||
503 | if (mag(cm0) < small) | ||
504 | { | ||
505 | for (label nodei = 0; nodei < nNodes_[dimi]; nodei++) | ||
506 | { | ||
507 | pos[dimi] = nodei; | ||
508 | conditionalWeights_[dimi](pos) = cm0/nNodes_[dimi]; | ||
509 | } | ||
510 | |||
511 | forAll(nodeIndexes_, nodei) | ||
512 | { | ||
513 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
514 | pos[dimi] = nodeIndex[dimi]; | ||
515 | |||
516 | if (compare(pos, nodeIndex)) | ||
517 | { | ||
518 | weights_[nodei] /= nNodes_[dimi]; | ||
519 | } | ||
520 | } | ||
521 | |||
522 | return true; | ||
523 | } | ||
524 | |||
525 | univariateMomentSet momentsToInvert | ||
526 | ( | ||
527 | nPureMoments_[dimi], | ||
528 | supports_[dimi] | ||
529 | ); | ||
369 | 530 | ||
370 | 531 | forAll(momentsToInvert, mi) | forAll(momentsToInvert, mi) |
371 | 532 | { | { |
372 | 533 | pos[dimi] = mi; | pos[dimi] = mi; |
373 | momentsToInvert[mi] = | ||
374 | conditionalMoments_[dimi][dimi - 1](pos); | ||
534 | momentsToInvert[mi] = conditionalMoments_[dimi][dimi - 1](pos); | ||
375 | 535 | } | } |
376 | 536 | ||
377 | momentInverter_().invert(momentsToInvert); | ||
378 | |||
379 | for (label nodei = 0; nodei < nNodes_[ai]; nodei++) | ||
537 | if (!momentsToInvert.isRealizable(false)) | ||
380 | 538 | { | { |
381 | pos[dimi] = nodei; | ||
539 | return false; | ||
540 | } | ||
382 | 541 | ||
383 | weights_[dimi](pos) = | ||
384 | momentInverter_().weights()[nodei]; | ||
542 | momentInverters_[dimi].invert(momentsToInvert); | ||
543 | const scalarList& weights = momentInverters_[dimi].weights(); | ||
544 | const scalarList& abscissae = momentInverters_[dimi].abscissae(); | ||
385 | 545 | ||
386 | abscissae_[dimi](pos) = | ||
387 | momentInverter_().abscissae()[nodei]; | ||
546 | forAll(weights, nodei) | ||
547 | { | ||
548 | pos[dimi] = nodei; | ||
549 | conditionalWeights_[dimi](pos) = weights[nodei]; | ||
388 | 550 | } | } |
389 | return; | ||
390 | } | ||
391 | } | ||
392 | 551 | ||
393 | void Foam::conditionalMomentInversion::reset() | ||
394 | { | ||
395 | forAll(moments_, mi) | ||
396 | { | ||
397 | moments_[mi] = 0.0; | ||
398 | } | ||
399 | |||
400 | forAll(invVR_, dimi) | ||
401 | { | ||
402 | forAll(invVR_[dimi], ai) | ||
552 | forAll(nodeIndexes_, nodei) | ||
403 | 553 | { | { |
404 | for (label i = 0; i < nNodes_[dimi]; i++) | ||
554 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
555 | label index = nodeIndex[dimi]; | ||
556 | pos[dimi] = index; | ||
557 | |||
558 | bool sameNode = compare(pos, nodeIndex); | ||
559 | |||
560 | if (index < weights.size() && sameNode) | ||
405 | 561 | { | { |
406 | for (label j = 0; j < nNodes_[dimi]; j++) | ||
562 | weights_[nodei] *= weights[index]; | ||
563 | |||
564 | if (velocityIndexes_[vi_] == dimi) | ||
565 | { | ||
566 | velocityAbscissae_[nodei][vi_] = abscissae[index]; | ||
567 | } | ||
568 | else | ||
407 | 569 | { | { |
408 | invVR_[dimi][ai](i, j) = 0.0; | ||
570 | abscissae_[nodei][si_] = abscissae[index]; | ||
409 | 571 | } | } |
410 | 572 | } | } |
411 | } | ||
412 | |||
413 | forAll(conditionalMoments_[dimi], dimj) | ||
414 | { | ||
415 | forAll(conditionalMoments_[dimi][dimj], ai) | ||
573 | else if (sameNode && nodei != 0) | ||
416 | 574 | { | { |
417 | conditionalMoments_[dimi][dimj][ai] = 0.0; | ||
575 | weights_[nodei] = 0; | ||
418 | 576 | } | } |
419 | 577 | } | } |
420 | } | ||
421 | 578 | ||
422 | forAll(abscissae_, dimi) | ||
423 | { | ||
424 | forAll(abscissae_[dimi], ai) | ||
425 | { | ||
426 | weights_[dimi][ai] = 0.0; | ||
427 | abscissae_[dimi][ai] = 0.0; | ||
428 | } | ||
579 | return true; | ||
429 | 580 | } | } |
430 | 581 | } | } |
431 | 582 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/conditional/conditionalMomentInversion.H changed (mode: 100644) (index ed0368a..5bf8d83) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::conditionalMomentInversion | ||
25 | Foam::multivariateMomentInversions::conditional | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Implementation of the conditional quadrature method of moments | Implementation of the conditional quadrature method of moments |
... | ... | Description | |
37 | 37 | ||
38 | 38 | SourceFiles | SourceFiles |
39 | 39 | conditionalMomentInversion.C | conditionalMomentInversion.C |
40 | conditionalMomentInversionI.C | ||
41 | 40 | ||
42 | 41 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
43 | 42 | ||
... | ... | SourceFiles | |
50 | 49 | #include "scalar.H" | #include "scalar.H" |
51 | 50 | #include "scalarMatrices.H" | #include "scalarMatrices.H" |
52 | 51 | #include "dictionary.H" | #include "dictionary.H" |
52 | #include "multivariateMomentInversion.H" | ||
53 | 53 | #include "univariateMomentSet.H" | #include "univariateMomentSet.H" |
54 | 54 | #include "univariateMomentInversion.H" | #include "univariateMomentInversion.H" |
55 | 55 | #include "multivariateMomentSet.H" | #include "multivariateMomentSet.H" |
56 | 56 | #include "Vandermonde.H" | #include "Vandermonde.H" |
57 | #include "mappedList.H" | ||
57 | #include "mappedLists.H" | ||
58 | 58 | #include "PtrList.H" | #include "PtrList.H" |
59 | 59 | ||
60 | 60 | namespace Foam | namespace Foam |
61 | 61 | { | { |
62 | namespace multivariateMomentInversions | ||
63 | { | ||
62 | 64 | ||
63 | 65 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
64 | 66 | Class conditionalMomentInversion Declaration | Class conditionalMomentInversion Declaration |
65 | 67 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
66 | class conditionalMomentInversion | ||
68 | class conditional | ||
69 | : | ||
70 | public multivariateMomentInversion | ||
67 | 71 | { | { |
68 | 72 | // Private member data | // Private member data |
69 | 73 | ||
70 | //- Number of moments | ||
71 | const label nMoments_; | ||
72 | |||
73 | //- List of the number of nodes | ||
74 | const labelList nNodes_; | ||
75 | |||
76 | //- Number of dimensions | ||
77 | const label nDims_; | ||
74 | //- Number of pure moments in each direction | ||
75 | labelList nPureMoments_; | ||
78 | 76 | ||
79 | 77 | //- Type of support for each direction | //- Type of support for each direction |
80 | const List<word> support_; | ||
81 | |||
82 | //- Quadratrure abscissae | ||
83 | PtrList<mappedList<scalar> > abscissae_; | ||
84 | |||
85 | //- Quadratrure weights | ||
86 | PtrList<mappedList<scalar> > weights_; | ||
78 | wordList supports_; | ||
87 | 79 | ||
88 | 80 | //- Stored moments | //- Stored moments |
89 | 81 | multivariateMomentSet moments_; | multivariateMomentSet moments_; |
90 | 82 | ||
83 | //- Conditional weights | ||
84 | PtrList<mappedList<scalar>> conditionalWeights_; | ||
85 | |||
91 | 86 | //- Stored conditional moments | //- Stored conditional moments |
92 | PtrList<PtrList<mappedList<scalar> > > conditionalMoments_; | ||
87 | PtrList<PtrList<mappedList<scalar>>> conditionalMoments_; | ||
93 | 88 | ||
94 | 89 | //- Inverted VanderMonde matricies | //- Inverted VanderMonde matricies |
95 | 90 | PtrList<mappedList<scalarSquareMatrix> > invVR_; | PtrList<mappedList<scalarSquareMatrix> > invVR_; |
96 | 91 | ||
97 | 92 | //- Univariate moment inversion method | //- Univariate moment inversion method |
98 | autoPtr<univariateMomentInversion> momentInverter_; | ||
93 | PtrList<univariateMomentInversion> momentInverters_; | ||
94 | |||
95 | //- Current indexes | ||
96 | label vi_; | ||
97 | label si_; | ||
99 | 98 | ||
100 | 99 | ||
101 | 100 | // Private member functions | // Private member functions |
... | ... | class conditionalMomentInversion | |
130 | 129 | ||
131 | 130 | //- Once all of the conditional moments are known, said moments are | //- Once all of the conditional moments are known, said moments are |
132 | 131 | // inverted to find the weights and abscissae | // inverted to find the weights and abscissae |
133 | void cycleAlphaWheeler | ||
132 | bool cycleAlphaWheeler | ||
134 | 133 | ( | ( |
135 | 134 | const label dimi, | const label dimi, |
136 | 135 | label alphai, | label alphai, |
137 | 136 | labelList& pos | labelList& pos |
138 | 137 | ); | ); |
139 | 138 | ||
140 | //- Reset inverter | ||
141 | void reset(); | ||
142 | |||
143 | //- Disallow default bitwise copy construct | ||
144 | //conditionalMomentInversion(const conditionalMomentInversion&); | ||
145 | 139 | ||
146 | //- Disallow default bitwise assignment | ||
147 | //void operator=(const conditionalMomentInversion&); | ||
140 | public: | ||
148 | 141 | ||
142 | //- Runtime type information | ||
143 | TypeName("conditional"); | ||
149 | 144 | ||
150 | public: | ||
151 | 145 | ||
152 | 146 | // Constructors | // Constructors |
153 | 147 | ||
154 | 148 | // Construct from nMoments, momentMap, nNodes, and support type | // Construct from nMoments, momentMap, nNodes, and support type |
155 | conditionalMomentInversion | ||
149 | conditional | ||
156 | 150 | ( | ( |
157 | 151 | const dictionary& dict, | const dictionary& dict, |
158 | 152 | const labelListList& momentOrders, | const labelListList& momentOrders, |
159 | 153 | const labelListList& nodeIndexes, | const labelListList& nodeIndexes, |
160 | const labelList& nNodes, | ||
161 | const List<word>& support | ||
154 | const labelList& velocityIndexes | ||
162 | 155 | ); | ); |
163 | 156 | ||
164 | 157 | ||
165 | 158 | //- Destructor | //- Destructor |
166 | virtual ~conditionalMomentInversion(); | ||
159 | virtual ~conditional(); | ||
167 | 160 | ||
168 | 161 | ||
169 | 162 | // Member Functions | // Member Functions |
170 | 163 | ||
171 | 164 | //- Invert moments to find weights and abscissae | //- Invert moments to find weights and abscissae |
172 | void invert(const multivariateMomentSet& moments); | ||
173 | |||
174 | //- Return number of moments | ||
175 | inline label nMoments(); | ||
176 | |||
177 | //- Return number of number of nodes in each dimension | ||
178 | inline const labelList& nNodes(); | ||
179 | |||
180 | //- Return mapped quadrature weights for each dimension | ||
181 | inline const PtrList<mappedList<scalar>>& weights() const; | ||
182 | |||
183 | //- Return mapped quadrature abscissae for each dimension | ||
184 | inline const PtrList<mappedList<scalar>>& abscissae() const; | ||
165 | virtual bool invert(const multivariateMomentSet& moments); | ||
185 | 166 | }; | }; |
186 | 167 | ||
187 | 168 | ||
188 | 169 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
189 | 170 | ||
171 | } // End namespace multivariateMomentInversions | ||
190 | 172 | } // End namespace Foam | } // End namespace Foam |
191 | 173 | ||
192 | 174 | ||
193 | 175 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
194 | 176 | ||
195 | #include "conditionalMomentInversionI.H" | ||
196 | 177 | ||
197 | 178 | #endif | #endif |
198 | 179 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/conditional/conditionalMomentInversionI.H deleted (index c3c84a9..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2017 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::conditionalMomentInversion::nMoments() | ||
31 | { | ||
32 | return nMoments_; | ||
33 | } | ||
34 | |||
35 | //- Return the list of nNodes | ||
36 | const Foam::labelList& Foam::conditionalMomentInversion::nNodes() | ||
37 | { | ||
38 | return nNodes_; | ||
39 | } | ||
40 | |||
41 | //- Return mapped list of weights | ||
42 | const Foam::PtrList<Foam::mappedList< Foam::scalar>>& | ||
43 | Foam::conditionalMomentInversion::weights() const | ||
44 | { | ||
45 | return weights_; | ||
46 | } | ||
47 | |||
48 | //- Return mapped list of abscissae | ||
49 | const Foam::PtrList< Foam::mappedList< Foam::scalar> >& | ||
50 | Foam::conditionalMomentInversion::abscissae() const | ||
51 | { | ||
52 | return abscissae_; | ||
53 | } | ||
54 | |||
55 | |||
56 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/hyperbolic/hyperbolicConditionalMomentInversionI.H deleted (index 633ea93..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2018 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::hyperbolicConditionalMomentInversion::nMoments() | ||
31 | { | ||
32 | return nMoments_; | ||
33 | } | ||
34 | |||
35 | //- Return the list of nNodes | ||
36 | Foam::label Foam::hyperbolicConditionalMomentInversion::nNodes() | ||
37 | { | ||
38 | return nNodes_; | ||
39 | } | ||
40 | |||
41 | //- Return mapped list of weights | ||
42 | const Foam::mappedList<Foam::scalar>& | ||
43 | Foam::hyperbolicConditionalMomentInversion::weights() const | ||
44 | { | ||
45 | return weights_; | ||
46 | } | ||
47 | |||
48 | //- Return mapped list of abscissae | ||
49 | const Foam::mappedList< Foam::vector>& | ||
50 | Foam::hyperbolicConditionalMomentInversion::abscissae() const | ||
51 | { | ||
52 | return abscissae_; | ||
53 | } | ||
54 | |||
55 | |||
56 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/monoKinetic/monoKineticMomentInversion.C added (mode: 100644) (index 0000000..a71d089) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "monoKineticMomentInversion.H" | ||
27 | #include "mappedLists.H" | ||
28 | #include "addToRunTimeSelectionTable.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | namespace multivariateMomentInversions | ||
35 | { | ||
36 | defineTypeNameAndDebug(monoKinetic, 0); | ||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | multivariateMomentInversion, | ||
40 | monoKinetic, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | } | ||
45 | |||
46 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
47 | |||
48 | Foam::multivariateMomentInversions::monoKinetic::monoKinetic | ||
49 | ( | ||
50 | const dictionary& dict, | ||
51 | const labelListList& momentOrders, | ||
52 | const labelListList& nodeIndexes, | ||
53 | const labelList& velocityIndexes | ||
54 | ) | ||
55 | : | ||
56 | multivariateMomentInversion | ||
57 | ( | ||
58 | dict, | ||
59 | momentOrders, | ||
60 | nodeIndexes, | ||
61 | velocityIndexes | ||
62 | ), | ||
63 | nSizeMoments_(calcNSizeMoments(momentOrders)), | ||
64 | sizeInverter_ | ||
65 | ( | ||
66 | univariateMomentInversion::New(dict.subDict("basicQuadrature")) | ||
67 | ) | ||
68 | {} | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::multivariateMomentInversions::monoKinetic::~monoKinetic() | ||
74 | {} | ||
75 | |||
76 | |||
77 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
78 | |||
79 | Foam::label Foam::multivariateMomentInversions::monoKinetic::calcNSizeMoments | ||
80 | ( | ||
81 | const labelListList& momentOrders | ||
82 | ) | ||
83 | { | ||
84 | label maxOrder = 0; | ||
85 | |||
86 | forAll(momentOrders, mi) | ||
87 | { | ||
88 | const labelList& momentOrder = momentOrders[mi]; | ||
89 | maxOrder = max(maxOrder, momentOrder[0]); | ||
90 | } | ||
91 | |||
92 | return maxOrder + 1; | ||
93 | } | ||
94 | |||
95 | |||
96 | bool Foam::multivariateMomentInversions::monoKinetic::invert | ||
97 | ( | ||
98 | const multivariateMomentSet& moments | ||
99 | ) | ||
100 | { | ||
101 | reset(); | ||
102 | |||
103 | univariateMomentSet sizeMoments(nSizeMoments_, "RPlus", 0.0); | ||
104 | |||
105 | forAll(sizeMoments, mi) | ||
106 | { | ||
107 | sizeMoments[mi] = moments(mi); | ||
108 | } | ||
109 | |||
110 | if (!sizeMoments.isRealizable(false)) | ||
111 | { | ||
112 | return false; | ||
113 | } | ||
114 | |||
115 | sizeInverter_->invert(sizeMoments); | ||
116 | const scalarList& sizeWeights(sizeInverter_->weights()); | ||
117 | const scalarList& sizeAbscissae(sizeInverter_->abscissae()); | ||
118 | |||
119 | forAll(sizeWeights, nodei) | ||
120 | { | ||
121 | weights_[nodei] = sizeWeights[nodei]; | ||
122 | abscissae_[nodei][0] = sizeAbscissae[nodei]; | ||
123 | } | ||
124 | |||
125 | label nSizeNodes = sizeWeights.size(); | ||
126 | |||
127 | if (nSizeNodes > 0) | ||
128 | { | ||
129 | scalarDiagonalMatrix x(nSizeNodes, 0.0); | ||
130 | scalarSquareMatrix invR(nSizeNodes, 0.0); | ||
131 | |||
132 | forAll(sizeWeights, nodei) | ||
133 | { | ||
134 | x[nodei] = max(sizeAbscissae[nodei], small); | ||
135 | invR[nodei][nodei] = 1.0/max(sizeWeights[nodei], 1e-10); | ||
136 | } | ||
137 | |||
138 | Vandermonde V(x); | ||
139 | scalarSquareMatrix invVR = invR*V.inv(); | ||
140 | |||
141 | // Compute conditional velocity moments and invert | ||
142 | for (label dimi = 0; dimi < nvelocityDimensions_; dimi++) | ||
143 | { | ||
144 | labelList pureMomentOrder(nDistributionDims_, 0); | ||
145 | pureMomentOrder[dimi + 1] = 1; | ||
146 | |||
147 | scalarRectangularMatrix M(nSizeNodes, 1, 0); | ||
148 | |||
149 | for (label nodei = 0; nodei < nSizeNodes; nodei++) | ||
150 | { | ||
151 | pureMomentOrder[0] = nodei; | ||
152 | M(nodei, 0) = moments(pureMomentOrder); | ||
153 | } | ||
154 | |||
155 | scalarRectangularMatrix nu = invVR*M; | ||
156 | |||
157 | forAll(sizeWeights, nodei) | ||
158 | { | ||
159 | if (sizeWeights[nodei] > 1e-10) | ||
160 | { | ||
161 | velocityAbscissae_[nodei][dimi] = nu(nodei, 0); | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | |||
167 | return true; | ||
168 | } | ||
169 | |||
170 | |||
171 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/monoKinetic/monoKineticMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.H (similarity 54%) (mode: 100644) (index b902d23..435233e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::nucleationModel | ||
25 | Foam::multivariateMomentInversions::monoKinetic | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Abstract class for nucleation model. | ||
28 | Implementation of the monokinetic velocity distribution moment set | ||
29 | inversion | ||
29 | 30 | ||
30 | 31 | SourceFiles | SourceFiles |
31 | nucleationModel.C | ||
32 | monoKineticmonoKineticMomentInversion.C | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef nucleationModel_H | ||
36 | #define nucleationModel_H | ||
36 | #ifndef monoKineticMomentInversion_H | ||
37 | #define monoKineticMomentInversion_H | ||
37 | 38 | ||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "moments.H" | ||
41 | #include "dimensionedTypes.H" | ||
42 | #include "runTimeSelectionTables.H" | ||
43 | 39 | ||
44 | 40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
45 | 41 | ||
42 | #include "scalar.H" | ||
43 | #include "vectorList.H" | ||
44 | #include "scalarMatrices.H" | ||
45 | #include "dictionary.H" | ||
46 | #include "mappedLists.H" | ||
47 | #include "Vandermonde.H" | ||
48 | #include "multivariateMomentInversion.H" | ||
49 | #include "univariateMomentInversion.H" | ||
50 | |||
51 | |||
46 | 52 | namespace Foam | namespace Foam |
47 | 53 | { | { |
48 | namespace populationBalanceSubModels | ||
54 | namespace multivariateMomentInversions | ||
49 | 55 | { | { |
50 | 56 | ||
51 | 57 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
52 | Class nucleationModel Declaration | ||
58 | Class monoKinetic Declaration | ||
53 | 59 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
54 | |||
55 | class nucleationModel | ||
60 | class monoKinetic | ||
61 | : | ||
62 | public multivariateMomentInversion | ||
56 | 63 | { | { |
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | nucleationModel(const nucleationModel&); | ||
64 | // Private member data | ||
61 | 65 | ||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const nucleationModel&); | ||
66 | //- Number of size moments | ||
67 | const label nSizeMoments_; | ||
64 | 68 | ||
69 | //- Moment orders of conditional velocity distribution | ||
70 | const labelListList velocityMomentOrders_; | ||
65 | 71 | ||
66 | protected: | ||
72 | //- Univariate moment inversion method | ||
73 | autoPtr<univariateMomentInversion> sizeInverter_; | ||
67 | 74 | ||
68 | // Protected data | ||
69 | 75 | ||
70 | const dictionary& dict_; | ||
76 | // Private member functions | ||
71 | 77 | ||
72 | //- Reference to mesh | ||
73 | const fvMesh& mesh_; | ||
78 | //- Calculate the number of pure size moments | ||
79 | label calcNSizeMoments(const labelListList& momentOrders); | ||
74 | 80 | ||
75 | 81 | ||
76 | 82 | public: | public: |
77 | 83 | ||
78 | 84 | //- Runtime type information | //- 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 | ); | ||
85 | TypeName("monoKinetic"); | ||
93 | 86 | ||
94 | 87 | ||
95 | 88 | // Constructors | // Constructors |
96 | 89 | ||
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 | ||
90 | // Construct from nMoments, momentMap, nNodes, and support type | ||
91 | monoKinetic | ||
108 | 92 | ( | ( |
109 | 93 | const dictionary& dict, | const dictionary& dict, |
110 | const fvMesh& mesh | ||
94 | const labelListList& momentOrders, | ||
95 | const labelListList& nodeIndexes, | ||
96 | const labelList& velocityIndexes | ||
111 | 97 | ); | ); |
112 | 98 | ||
113 | 99 | ||
114 | 100 | //- Destructor | //- Destructor |
115 | virtual ~nucleationModel(); | ||
101 | virtual ~monoKinetic(); | ||
116 | 102 | ||
117 | 103 | ||
118 | 104 | // Member Functions | // Member Functions |
119 | 105 | ||
120 | //- Nucleation rate | ||
121 | virtual scalar nucleationSource | ||
122 | ( | ||
123 | const label& momentOrder, | ||
124 | const label celli, | ||
125 | const label environment = 0 | ||
126 | ) const = 0; | ||
106 | //- Invert moments to find weights and abscissae | ||
107 | virtual bool invert(const multivariateMomentSet& moments); | ||
127 | 108 | }; | }; |
128 | 109 | ||
129 | 110 | ||
130 | 111 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
131 | 112 | ||
132 | } // End namespace populationBalanceSubModels | ||
113 | } // End namespace multivariateMomentInversions | ||
133 | 114 | } // End namespace Foam | } // End namespace Foam |
134 | 115 | ||
135 | 116 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/multivariateMomentInversion/multivariateMomentInversion.C added (mode: 100644) (index 0000000..2acb1b9) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 | #include "mappedLists.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | defineTypeNameAndDebug(multivariateMomentInversion, 0); | ||
34 | defineRunTimeSelectionTable(multivariateMomentInversion, dictionary); | ||
35 | } | ||
36 | |||
37 | |||
38 | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // | ||
39 | |||
40 | bool Foam::multivariateMomentInversion::compare | ||
41 | ( | ||
42 | const labelList& index1, | ||
43 | const labelList& index2 | ||
44 | ) | ||
45 | { | ||
46 | label size = min(index1.size(), index2.size()); | ||
47 | |||
48 | for (label i = 0; i < size; i++) | ||
49 | { | ||
50 | if (index1[i] != index2[i]) | ||
51 | { | ||
52 | return false; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | return true; | ||
57 | } | ||
58 | |||
59 | |||
60 | bool Foam::multivariateMomentInversion::compare | ||
61 | ( | ||
62 | const labelList& index1, | ||
63 | const labelList& index2, | ||
64 | const label size | ||
65 | ) | ||
66 | { | ||
67 | for (label i = 0; i < size; i++) | ||
68 | { | ||
69 | if (index1[i] != index2[i]) | ||
70 | { | ||
71 | return false; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | return true; | ||
76 | } | ||
77 | |||
78 | |||
79 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
80 | |||
81 | Foam::multivariateMomentInversion::multivariateMomentInversion | ||
82 | ( | ||
83 | const dictionary& dict, | ||
84 | const labelListList& momentOrders, | ||
85 | const labelListList& nodeIndexes, | ||
86 | const labelList& velocityIndexes | ||
87 | ) | ||
88 | : | ||
89 | nDistributionDims_(momentOrders[0].size()), | ||
90 | nvelocityDimensions_ | ||
91 | ( | ||
92 | velocityIndexes[0] == -1 ? 0 : velocityIndexes.size() | ||
93 | ), | ||
94 | momentOrders_(momentOrders), | ||
95 | nodeIndexes_(nodeIndexes), | ||
96 | velocityIndexes_(velocityIndexes), | ||
97 | nNodes_(nDistributionDims_, 1), | ||
98 | weights_(nodeIndexes.size(), nodeIndexes, 0.0), | ||
99 | abscissae_ | ||
100 | ( | ||
101 | nodeIndexes.size(), | ||
102 | nodeIndexes, | ||
103 | scalarList(nDistributionDims_ - nvelocityDimensions_, 0.0) | ||
104 | ), | ||
105 | velocityAbscissae_(nodeIndexes.size(), nodeIndexes, Zero) | ||
106 | { | ||
107 | forAll(nodeIndexes_, nodei) | ||
108 | { | ||
109 | forAll(nodeIndexes_[nodei], dimi) | ||
110 | { | ||
111 | nNodes_[dimi] = max(nNodes_[dimi], nodeIndexes[nodei][dimi] + 1); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (velocityIndexes_.size() == 0) | ||
116 | { | ||
117 | velocityIndexes_.append(-1); | ||
118 | } | ||
119 | } | ||
120 | |||
121 | |||
122 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
123 | |||
124 | Foam::multivariateMomentInversion::~multivariateMomentInversion() | ||
125 | {} | ||
126 | |||
127 | |||
128 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
129 | |||
130 | void Foam::multivariateMomentInversion::reset() | ||
131 | { | ||
132 | forAll(weights_, nodei) | ||
133 | { | ||
134 | weights_[nodei] = 0.0; | ||
135 | abscissae_[nodei] = scalarList(abscissae_[0].size(), 0.0); | ||
136 | velocityAbscissae_[nodei] = Zero; | ||
137 | } | ||
138 | } | ||
139 | |||
140 | |||
141 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/multivariateMomentInversion/multivariateMomentInversion.H added (mode: 100644) (index 0000000..034b5b7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 | General class for multivariate moment inversions | ||
29 | |||
30 | SourceFiles | ||
31 | multivariateMomentInversion.C | ||
32 | multivariateMomentInversionI.H | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef multivariateMomentInversion_H | ||
37 | #define multivariateMomentInversion_H | ||
38 | |||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | #include "scalarList.H" | ||
43 | #include "vectorList.H" | ||
44 | #include "dictionary.H" | ||
45 | #include "mappedLists.H" | ||
46 | #include "Vandermonde.H" | ||
47 | #include "multivariateMomentSet.H" | ||
48 | #include "runTimeSelectionTables.H" | ||
49 | |||
50 | |||
51 | namespace Foam | ||
52 | { | ||
53 | |||
54 | /*---------------------------------------------------------------------------*\ | ||
55 | Class multivariateMomentInversion Declaration | ||
56 | \*---------------------------------------------------------------------------*/ | ||
57 | class multivariateMomentInversion | ||
58 | { | ||
59 | protected: | ||
60 | // Protected member data | ||
61 | |||
62 | //- Number of dimensions in distribution | ||
63 | const label nDistributionDims_; | ||
64 | |||
65 | //- Number of dimensions in velocity space | ||
66 | const label nvelocityDimensions_; | ||
67 | |||
68 | //- Moment orders of full distribution | ||
69 | const labelListList& momentOrders_; | ||
70 | |||
71 | //- Node indexes of full distribution | ||
72 | const labelListList& nodeIndexes_; | ||
73 | |||
74 | //- List of velocity indexes | ||
75 | labelList velocityIndexes_; | ||
76 | |||
77 | //- Number of nodes in each direction | ||
78 | labelList nNodes_; | ||
79 | |||
80 | //- Quadratrure weights | ||
81 | mappedScalarList weights_; | ||
82 | |||
83 | //- Quadratrure size abscissae | ||
84 | mappedList<scalarList> abscissae_; | ||
85 | |||
86 | //- Quadratrure velocity abscissae | ||
87 | mappedVectorList velocityAbscissae_; | ||
88 | |||
89 | |||
90 | // Protected member functions | ||
91 | |||
92 | //- Reset inverter | ||
93 | void reset(); | ||
94 | |||
95 | //- Compare indexes up to the minimum size | ||
96 | static bool compare(const labelList& index1, const labelList& index2); | ||
97 | |||
98 | //- Compare indexes up to dimi | ||
99 | static bool compare | ||
100 | ( | ||
101 | const labelList& index1, | ||
102 | const labelList& index2, | ||
103 | const label size | ||
104 | ); | ||
105 | |||
106 | |||
107 | public: | ||
108 | |||
109 | //- Runtime type information | ||
110 | TypeName("multivariateMomentInversion"); | ||
111 | |||
112 | // Declare runtime constructor selection table | ||
113 | declareRunTimeSelectionTable | ||
114 | ( | ||
115 | autoPtr, | ||
116 | multivariateMomentInversion, | ||
117 | dictionary, | ||
118 | ( | ||
119 | const dictionary& dict, | ||
120 | const labelListList& momentOrders, | ||
121 | const labelListList& nodeIndexes, | ||
122 | const labelList& velocityIndexes | ||
123 | ), | ||
124 | (dict, momentOrders, nodeIndexes, velocityIndexes) | ||
125 | ); | ||
126 | |||
127 | |||
128 | // Constructors | ||
129 | |||
130 | // Construct from nMoments, momentMap, nNodes, and support type | ||
131 | multivariateMomentInversion | ||
132 | ( | ||
133 | const dictionary& dict, | ||
134 | const labelListList& momentOrders, | ||
135 | const labelListList& nodeIndexes, | ||
136 | const labelList& velocityIndexes | ||
137 | ); | ||
138 | |||
139 | |||
140 | // Selectors | ||
141 | |||
142 | static autoPtr<multivariateMomentInversion> New | ||
143 | ( | ||
144 | const dictionary& dict, | ||
145 | const labelListList& momentOrders, | ||
146 | const labelListList& nodeIndexes, | ||
147 | const labelList& velocityIndexes | ||
148 | ); | ||
149 | |||
150 | |||
151 | //- Destructor | ||
152 | virtual ~multivariateMomentInversion(); | ||
153 | |||
154 | |||
155 | // Member Functions | ||
156 | |||
157 | //- Invert moments to find weights and abscissae | ||
158 | virtual bool invert(const multivariateMomentSet& moments) = 0; | ||
159 | |||
160 | //- Return mapped quadrature weights for each dimension | ||
161 | inline const mappedScalarList& weights() const; | ||
162 | |||
163 | //- Return mapped quadrature size abscissae for each dimension | ||
164 | inline const mappedList<scalarList>& abscissae() const; | ||
165 | |||
166 | //- Return mapped quadrature velocity abscissae for each dimension | ||
167 | inline const mappedVectorList& velocityAbscissae() const; | ||
168 | }; | ||
169 | |||
170 | |||
171 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
172 | |||
173 | } // End namespace Foam | ||
174 | |||
175 | |||
176 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
177 | |||
178 | #include "multivariateMomentInversionI.H" | ||
179 | |||
180 | #endif | ||
181 | |||
182 | |||
183 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/multivariateMomentInversion/multivariateMomentInversionI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversionI.H (similarity 78%) (mode: 100644) (index 62291f8..5c4e769) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | |||
26 | 27 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
27 | 28 | ||
28 | const Foam::scalarList& Foam::univariateMomentInversion::abscissae() const | ||
29 | const Foam::mappedScalarList& | ||
30 | Foam::multivariateMomentInversion::weights() const | ||
29 | 31 | { | { |
30 | return abscissae_; | ||
32 | return weights_; | ||
31 | 33 | } | } |
32 | 34 | ||
33 | Foam::label Foam::univariateMomentInversion::nNodes() const | ||
35 | const Foam::mappedList<Foam::scalarList>& | ||
36 | Foam::multivariateMomentInversion::abscissae() const | ||
34 | 37 | { | { |
35 | return nNodes_; | ||
38 | return abscissae_; | ||
36 | 39 | } | } |
37 | 40 | ||
38 | const Foam::scalarList& Foam::univariateMomentInversion::weights() const | ||
41 | const Foam::mappedVectorList& | ||
42 | Foam::multivariateMomentInversion::velocityAbscissae() const | ||
39 | 43 | { | { |
40 | return weights_; | ||
44 | return velocityAbscissae_; | ||
41 | 45 | } | } |
42 | 46 | ||
47 | |||
43 | 48 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/multivariateMomentInversion/newMultivariateMomentInversion.C copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/newMixingModel.C (similarity 64%) (mode: 100644) (index 2d4228f..60fb1fb) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
20 | 20 | ||
21 | 21 | You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | |||
24 | 23 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 24 | ||
26 | #include "mixingModel.H" | ||
25 | #include "multivariateMomentInversion.H" | ||
27 | 26 | ||
28 | 27 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // |
29 | 28 | ||
30 | Foam::autoPtr<Foam::mixingModel> Foam::mixingModel::New | ||
29 | Foam::autoPtr<Foam::multivariateMomentInversion> | ||
30 | Foam::multivariateMomentInversion::New | ||
31 | 31 | ( | ( |
32 | const word& name, | ||
33 | 32 | const dictionary& dict, | const dictionary& dict, |
34 | const surfaceScalarField& phi | ||
33 | const labelListList& momentOrders, | ||
34 | const labelListList& nodeIndexes, | ||
35 | const labelList& velocityIndexes | ||
35 | 36 | ) | ) |
36 | 37 | { | { |
37 | word mixingModelType(dict.lookup("mixingModel")); | ||
38 | word multivariateMomentInversionType | ||
39 | ( | ||
40 | dict.lookup("type") | ||
41 | ); | ||
38 | 42 | ||
39 | Info<< "Selecting mixingModel " | ||
40 | << mixingModelType << endl; | ||
43 | Info<< "Selecting multivariateMomentInversion " | ||
44 | << multivariateMomentInversionType << endl; | ||
41 | 45 | ||
42 | 46 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
43 | dictionaryConstructorTablePtr_->find(mixingModelType); | ||
47 | dictionaryConstructorTablePtr_->find(multivariateMomentInversionType); | ||
44 | 48 | ||
45 | 49 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
46 | 50 | { | { |
47 | 51 | FatalErrorInFunction | FatalErrorInFunction |
48 | << "Unknown mixingModelType type " | ||
49 | << mixingModelType << endl << endl | ||
50 | << "Valid mixingModelType types are :" << endl | ||
52 | << "Unknown multivariateMomentInversionType type " | ||
53 | << multivariateMomentInversionType << endl << endl | ||
54 | << "Valid multivariateMomentInversionType types are :" << endl | ||
51 | 55 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
52 | 56 | << abort(FatalError); | << abort(FatalError); |
53 | 57 | } | } |
54 | 58 | ||
55 | 59 | return | return |
56 | autoPtr<mixingModel> | ||
60 | autoPtr<multivariateMomentInversion> | ||
57 | 61 | ( | ( |
58 | 62 | cstrIter() | cstrIter() |
59 | 63 | ( | ( |
60 | name, | ||
61 | dict.subDict(mixingModelType + "Coeffs"), | ||
62 | phi | ||
64 | dict, | ||
65 | momentOrders, | ||
66 | nodeIndexes, | ||
67 | velocityIndexes | ||
63 | 68 | ) | ) |
64 | 69 | ); | ); |
65 | 70 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/sizeCHyQMOM/sizeCHyQMOMMomentInversion.C added (mode: 100644) (index 0000000..1ed7d53) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "sizeCHyQMOMMomentInversion.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | |||
30 | template<class velocityInversion> | ||
31 | Foam::multivariateMomentInversions::sizeCHyQMOMBase<velocityInversion>:: | ||
32 | sizeCHyQMOMBase | ||
33 | ( | ||
34 | const dictionary& dict, | ||
35 | const labelListList& momentOrders, | ||
36 | const labelListList& nodeIndexes, | ||
37 | const labelList& velocityIndexes | ||
38 | ) | ||
39 | : | ||
40 | multivariateMomentInversion | ||
41 | ( | ||
42 | dict, | ||
43 | momentOrders, | ||
44 | nodeIndexes, | ||
45 | velocityIndexes | ||
46 | ), | ||
47 | nSizeMoments_(calcNSizeMoments(momentOrders)), | ||
48 | velocityMomentOrders_ | ||
49 | ( | ||
50 | velocityInversion::getMomentOrders | ||
51 | ( | ||
52 | nvelocityDimensions_ | ||
53 | ) | ||
54 | ), | ||
55 | nSizeNodes_(nSizeMoments_/2), | ||
56 | velocityNodeIndexes_ | ||
57 | ( | ||
58 | velocityInversion::getNodeIndexes | ||
59 | ( | ||
60 | nvelocityDimensions_ | ||
61 | ) | ||
62 | ), | ||
63 | sizeInverter_ | ||
64 | ( | ||
65 | univariateMomentInversion::New(dict.subDict("basicQuadrature")) | ||
66 | ), | ||
67 | velocityInverter_ | ||
68 | ( | ||
69 | new velocityInversion | ||
70 | ( | ||
71 | dict, | ||
72 | velocityMomentOrders_, | ||
73 | velocityNodeIndexes_, | ||
74 | nvelocityDimensions_ == 1 | ||
75 | ? labelList({0}) | ||
76 | : ( | ||
77 | (nvelocityDimensions_ == 2) | ||
78 | ? labelList({0, 1}) | ||
79 | : labelList({0, 1, 2}) | ||
80 | ) | ||
81 | ) | ||
82 | ) | ||
83 | {} | ||
84 | |||
85 | |||
86 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
87 | |||
88 | template<class velocityInversion> | ||
89 | Foam::multivariateMomentInversions::sizeCHyQMOMBase<velocityInversion>:: | ||
90 | ~sizeCHyQMOMBase() | ||
91 | {} | ||
92 | |||
93 | |||
94 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
95 | |||
96 | template<class velocityInversion> | ||
97 | Foam::label Foam::multivariateMomentInversions::sizeCHyQMOMBase<velocityInversion>:: | ||
98 | calcNSizeMoments | ||
99 | ( | ||
100 | const labelListList& momentOrders | ||
101 | ) | ||
102 | { | ||
103 | label maxOrder = 0; | ||
104 | |||
105 | forAll(momentOrders, mi) | ||
106 | { | ||
107 | const labelList& momentOrder = momentOrders[mi]; | ||
108 | if (momentOrder[0] > maxOrder) | ||
109 | { | ||
110 | maxOrder = momentOrder[0]; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | return maxOrder + 1; | ||
115 | } | ||
116 | |||
117 | |||
118 | template<class velocityInversion> | ||
119 | bool Foam::multivariateMomentInversions::sizeCHyQMOMBase<velocityInversion>:: | ||
120 | invert | ||
121 | ( | ||
122 | const multivariateMomentSet& moments | ||
123 | ) | ||
124 | { | ||
125 | reset(); | ||
126 | scalar m0 = moments(0); | ||
127 | |||
128 | if (mag(m0) < small) | ||
129 | { | ||
130 | forAll(weights_, nodei) | ||
131 | { | ||
132 | weights_[nodei] = max(m0, 0)/weights_.size(); | ||
133 | } | ||
134 | return true; | ||
135 | } | ||
136 | |||
137 | univariateMomentSet sizeMoments(nSizeMoments_, "RPlus", 0.0); | ||
138 | |||
139 | forAll(sizeMoments, mi) | ||
140 | { | ||
141 | sizeMoments[mi] = moments(mi); | ||
142 | } | ||
143 | |||
144 | if (!sizeMoments.isRealizable(false)) | ||
145 | { | ||
146 | return false; | ||
147 | } | ||
148 | |||
149 | sizeInverter_->invert(sizeMoments); | ||
150 | const scalarList& sizeWeights(sizeInverter_->weights()); | ||
151 | const scalarList& sizeAbscissae(sizeInverter_->abscissae()); | ||
152 | |||
153 | forAll(nodeIndexes_, nodei) | ||
154 | { | ||
155 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
156 | label sizeNode = nodeIndex[0]; | ||
157 | |||
158 | if (sizeNode < sizeInverter_->nNodes()) | ||
159 | { | ||
160 | weights_(nodeIndex) = sizeWeights[sizeNode]; | ||
161 | abscissae_(nodeIndex)[0] = sizeAbscissae[sizeNode]; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | label nSizeNodes = sizeWeights.size(); | ||
166 | |||
167 | if (nSizeNodes > 0) | ||
168 | { | ||
169 | scalarDiagonalMatrix x(nSizeNodes, 0.0); | ||
170 | scalarSquareMatrix invR(nSizeNodes, 0.0); | ||
171 | |||
172 | forAll(sizeWeights, nodei) | ||
173 | { | ||
174 | x[nodei] = max(sizeAbscissae[nodei], small); | ||
175 | invR[nodei][nodei] = 1.0/max(sizeWeights[nodei], small); | ||
176 | } | ||
177 | |||
178 | Vandermonde V(x); | ||
179 | scalarSquareMatrix invVR = invR*V.inv(); | ||
180 | |||
181 | // Compute conditional velocity moments and invert | ||
182 | PtrList<mappedScalarList> conditionalMoments(nSizeNodes); | ||
183 | |||
184 | forAll(conditionalMoments, sNodei) | ||
185 | { | ||
186 | conditionalMoments.set | ||
187 | ( | ||
188 | sNodei, | ||
189 | new mappedList<scalar> | ||
190 | ( | ||
191 | velocityMomentOrders_.size(), | ||
192 | velocityMomentOrders_, | ||
193 | 0.0 | ||
194 | ) | ||
195 | ); | ||
196 | } | ||
197 | |||
198 | forAll(velocityMomentOrders_, mi) | ||
199 | { | ||
200 | const labelList& velocityMomentOrder = velocityMomentOrders_[mi]; | ||
201 | labelList pureMomentOrder(nDistributionDims_, 0); | ||
202 | |||
203 | for (label dimi = 1; dimi < nDistributionDims_; dimi++) | ||
204 | { | ||
205 | pureMomentOrder[dimi] = velocityMomentOrder[dimi - 1]; | ||
206 | } | ||
207 | |||
208 | scalarRectangularMatrix M(nSizeNodes, 1, 0); | ||
209 | |||
210 | for (label sNodei = 0; sNodei < nSizeNodes; sNodei++) | ||
211 | { | ||
212 | pureMomentOrder[0] = sNodei; | ||
213 | M(sNodei, 0) = moments(pureMomentOrder); | ||
214 | } | ||
215 | |||
216 | scalarRectangularMatrix nu = invVR*M; | ||
217 | |||
218 | forAll(conditionalMoments, sNodei) | ||
219 | { | ||
220 | conditionalMoments[sNodei](velocityMomentOrder) = nu(sNodei, 0); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | forAll(conditionalMoments, sNodei) | ||
225 | { | ||
226 | if (sizeWeights[sNodei] > small) | ||
227 | { | ||
228 | multivariateMomentSet momentsToInvert | ||
229 | ( | ||
230 | velocityMomentOrders_.size(), | ||
231 | velocityMomentOrders_, | ||
232 | "R" | ||
233 | ); | ||
234 | |||
235 | forAll(momentsToInvert, mi) | ||
236 | { | ||
237 | momentsToInvert(velocityMomentOrders_[mi]) = | ||
238 | conditionalMoments[sNodei](velocityMomentOrders_[mi]); | ||
239 | } | ||
240 | |||
241 | velocityInverter_->invert(momentsToInvert); | ||
242 | |||
243 | forAll(velocityNodeIndexes_, nodei) | ||
244 | { | ||
245 | const labelList& velocityNodeIndex = | ||
246 | velocityNodeIndexes_[nodei]; | ||
247 | |||
248 | labelList nodeIndex(nDistributionDims_, 0); | ||
249 | |||
250 | nodeIndex[0] = sNodei; | ||
251 | |||
252 | for (label dimi = 1; dimi < nDistributionDims_; dimi++) | ||
253 | { | ||
254 | nodeIndex[dimi] = velocityNodeIndex[dimi - 1]; | ||
255 | } | ||
256 | |||
257 | weights_(nodeIndex) *= | ||
258 | velocityInverter_->weights()(velocityNodeIndex); | ||
259 | |||
260 | velocityAbscissae_(nodeIndex) = | ||
261 | velocityInverter_->velocityAbscissae() | ||
262 | ( | ||
263 | velocityNodeIndex | ||
264 | ); | ||
265 | } | ||
266 | } | ||
267 | else | ||
268 | { | ||
269 | forAll(velocityNodeIndexes_, nodei) | ||
270 | { | ||
271 | const labelList& velocityNodeIndex = | ||
272 | velocityNodeIndexes_[nodei]; | ||
273 | |||
274 | labelList nodeIndex(nDistributionDims_, 0); | ||
275 | nodeIndex[0] = sNodei; | ||
276 | |||
277 | for (label dimi = 1; dimi < nDistributionDims_; dimi++) | ||
278 | { | ||
279 | nodeIndex[dimi] = velocityNodeIndex[dimi - 1]; | ||
280 | } | ||
281 | |||
282 | weights_(nodeIndex) /= (weights_.size()/nSizeNodes_); | ||
283 | } | ||
284 | } | ||
285 | } | ||
286 | } | ||
287 | else | ||
288 | { | ||
289 | forAll(weights_, nodei) | ||
290 | { | ||
291 | weights_[nodei] = m0/weights_.size(); | ||
292 | } | ||
293 | } | ||
294 | |||
295 | return true; | ||
296 | } | ||
297 | |||
298 | |||
299 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/sizeCHyQMOM/sizeCHyQMOMMomentInversion.H added (mode: 100644) (index 0000000..cc0a3ea) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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::multivariateMomentInversions::sizeCHyQMOM | ||
26 | |||
27 | Description | ||
28 | Implementation of the hyperbolic conditional quadrature method of moment | ||
29 | for velocity with conditioning on size. | ||
30 | |||
31 | SourceFiles | ||
32 | sizeCHyQMOMMomentInversion.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef sizeCHyQMOMMomentInversion_H | ||
37 | #define sizeCHyQMOMMomentInversion_H | ||
38 | |||
39 | |||
40 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
41 | |||
42 | #include "scalar.H" | ||
43 | #include "vector2D.H" | ||
44 | #include "vector.H" | ||
45 | #include "scalarMatrices.H" | ||
46 | #include "dictionary.H" | ||
47 | #include "mappedLists.H" | ||
48 | #include "Vandermonde.H" | ||
49 | #include "multivariateMomentInversion.H" | ||
50 | #include "univariateMomentInversion.H" | ||
51 | |||
52 | namespace Foam | ||
53 | { | ||
54 | namespace multivariateMomentInversions | ||
55 | { | ||
56 | |||
57 | /*---------------------------------------------------------------------------*\ | ||
58 | Class sizeCHyQMOM Declaration | ||
59 | \*---------------------------------------------------------------------------*/ | ||
60 | template<class velocityInversion> | ||
61 | class sizeCHyQMOMBase | ||
62 | : | ||
63 | public multivariateMomentInversion | ||
64 | { | ||
65 | // Private member data | ||
66 | |||
67 | //- Number of pure size moments | ||
68 | const label nSizeMoments_; | ||
69 | |||
70 | //- Moment orders of conditional velocity distribution | ||
71 | const labelListList velocityMomentOrders_; | ||
72 | |||
73 | //-Number of nodes in size direction | ||
74 | const label nSizeNodes_; | ||
75 | |||
76 | //- Node indexes of conditional velocity distribution | ||
77 | const labelListList velocityNodeIndexes_; | ||
78 | |||
79 | //- Univariate moment inversion method | ||
80 | autoPtr<univariateMomentInversion> sizeInverter_; | ||
81 | |||
82 | //- Velocity moment inversion method | ||
83 | autoPtr<velocityInversion> velocityInverter_; | ||
84 | |||
85 | |||
86 | // Private member functions | ||
87 | |||
88 | //- Calculate the number of pure size moments | ||
89 | label calcNSizeMoments(const labelListList& momentOrders); | ||
90 | |||
91 | |||
92 | public: | ||
93 | |||
94 | //- Runtime type information | ||
95 | TypeName("sizeCHyQMOMBase"); | ||
96 | |||
97 | // Constructors | ||
98 | |||
99 | // Construct from nMoments, momentMap, nNodes, and support type | ||
100 | sizeCHyQMOMBase | ||
101 | ( | ||
102 | const dictionary& dict, | ||
103 | const labelListList& momentOrders, | ||
104 | const labelListList& nodeIndexes, | ||
105 | const labelList& velocityIndexes | ||
106 | ); | ||
107 | |||
108 | |||
109 | //- Destructor | ||
110 | virtual ~sizeCHyQMOMBase(); | ||
111 | |||
112 | |||
113 | // Member Functions | ||
114 | |||
115 | //- Invert moments to find weights and abscissae | ||
116 | virtual bool invert(const multivariateMomentSet& moments); | ||
117 | }; | ||
118 | |||
119 | |||
120 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
121 | |||
122 | } // End namespace multivariateMomentInversions | ||
123 | } // End namespace Foam | ||
124 | |||
125 | |||
126 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
127 | |||
128 | #ifdef NoRepository | ||
129 | #include "sizeCHyQMOMMomentInversion.C" | ||
130 | #endif | ||
131 | |||
132 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
133 | |||
134 | #endif | ||
135 | |||
136 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/sizeCHyQMOM/sizeCHyQMOMMomentInversions.C copied from file multiphaseEulerPbeFoam/mappedList/mappedLists.H (similarity 72%) (mode: 100644) (index c3da4aa..c56c332) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
21 | 21 | You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | Class | ||
25 | Foam::mappedLists | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | |||
31 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
32 | 25 | ||
33 | #ifndef mappedLists_H | ||
34 | #define mappedLists_H | ||
35 | |||
36 | #include "mappedList.H" | ||
26 | #include "addToRunTimeSelectionTable.H" | ||
27 | #include "sizeCHyQMOMMomentInversions.H" | ||
37 | 28 | ||
38 | 29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
39 | 30 | ||
40 | 31 | namespace Foam | namespace Foam |
41 | 32 | { | { |
42 | |||
43 | typedef mappedList<label> mappedLabelList; | ||
44 | |||
45 | typedef mappedList<scalar> mappedScalarList; | ||
46 | |||
47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
48 | |||
49 | } // End namespace Foam | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
53 | |||
54 | #endif | ||
33 | namespace multivariateMomentInversions | ||
34 | { | ||
35 | addNamedToRunTimeSelectionTable | ||
36 | ( | ||
37 | multivariateMomentInversion, | ||
38 | sizeCHyQMOM, | ||
39 | dictionary, | ||
40 | sizeCHyQMOM | ||
41 | ); | ||
42 | |||
43 | addNamedToRunTimeSelectionTable | ||
44 | ( | ||
45 | multivariateMomentInversion, | ||
46 | sizeCHyQMOMPlus, | ||
47 | dictionary, | ||
48 | sizeCHyQMOMPlus | ||
49 | ); | ||
50 | } | ||
51 | } | ||
55 | 52 | ||
56 | 53 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/sizeCHyQMOM/sizeCHyQMOMMomentInversions.H copied from file multiphaseEulerPbeFoam/mappedList/mappedLists.H (similarity 71%) (mode: 100644) (index c3da4aa..7409141) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
21 | 21 | You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | Class | ||
25 | Foam::mappedLists | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | |||
31 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
32 | 25 | ||
33 | #ifndef mappedLists_H | ||
34 | #define mappedLists_H | ||
35 | |||
36 | #include "mappedList.H" | ||
26 | #ifndef sizeCHyQMOMMomentInversions_H | ||
27 | #define sizeCHyQMOMMomentInversions_H | ||
37 | 28 | ||
38 | 29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
39 | 30 | ||
40 | namespace Foam | ||
41 | { | ||
42 | |||
43 | typedef mappedList<label> mappedLabelList; | ||
44 | |||
45 | typedef mappedList<scalar> mappedScalarList; | ||
31 | #include "sizeCHyQMOMMomentInversion.H" | ||
32 | #include "CHyQMOMMomentInversion.H" | ||
33 | #include "CHyQMOMPlusMomentInversion.H" | ||
46 | 34 | ||
47 | 35 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
48 | 36 | ||
49 | } // End namespace Foam | ||
37 | namespace Foam | ||
38 | { | ||
39 | namespace multivariateMomentInversions | ||
40 | { | ||
41 | typedef multivariateMomentInversions::sizeCHyQMOMBase<CHyQMOM> sizeCHyQMOM; | ||
42 | defineTemplateTypeNameWithName(sizeCHyQMOM, "sizeCHyQMOM"); | ||
50 | 43 | ||
44 | typedef sizeCHyQMOMBase<CHyQMOMPlus> sizeCHyQMOMPlus; | ||
45 | defineTemplateTypeNameWithName(sizeCHyQMOMPlus, "sizeCHyQMOMPlus"); | ||
46 | } | ||
47 | } | ||
51 | 48 | ||
52 | 49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
53 | 50 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussLobattoMomentInversion/gaussLobattoMomentInversion.C changed (mode: 100644) (index c2c06c5..83d2eb4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussLobattoMomentInversion/gaussLobattoMomentInversion.H changed (mode: 100644) (index e24b4dc..8541dd6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussMomentInversion/gaussMomentInversion.C changed (mode: 100644) (index 800a8ce..0b0e3be) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussMomentInversion/gaussMomentInversion.H changed (mode: 100644) (index 37de44c..2686d12) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussRadauMomentInversion/gaussRadauMomentInversion.C changed (mode: 100644) (index 36df207..b1e64aa) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussRadauMomentInversion/gaussRadauMomentInversion.H changed (mode: 100644) (index 87f4775..6f03560) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/hyperbolicMomentInversion/hyperbolicMomentInversion.C changed (mode: 100755) (index 6fce354..d0dd5c1) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | void Foam::hyperbolicMomentInversion::invert | |
107 | 107 | { | { |
108 | 108 | if (moments[0] < SMALL) | if (moments[0] < SMALL) |
109 | 109 | { | { |
110 | weights_[0] = 0.0; | ||
110 | 111 | weights_[1] = moments[0]; | weights_[1] = moments[0]; |
112 | weights_[2] = 0.0; | ||
113 | |||
114 | abscissae_[0] = 0.0; | ||
115 | abscissae_[1] = 0.0; | ||
116 | abscissae_[2] = 0.0; | ||
111 | 117 | ||
112 | 118 | return; | return; |
113 | 119 | } | } |
... | ... | void Foam::hyperbolicMomentInversion::invert | |
153 | 159 | << centralMoments[2] | << centralMoments[2] |
154 | 160 | << endl; | << endl; |
155 | 161 | } | } |
162 | |||
156 | 163 | for (label ci = 2; ci < nInvertibleMoments_; ci++) | for (label ci = 2; ci < nInvertibleMoments_; ci++) |
157 | 164 | { | { |
158 | 165 | centralMoments[ci] = 0.0; | centralMoments[ci] = 0.0; |
... | ... | void Foam::hyperbolicMomentInversion::invert | |
192 | 199 | centralMoments[3] = q*c2*sqrtC2; | centralMoments[3] = q*c2*sqrtC2; |
193 | 200 | centralMoments[4] = eta*sqrC2; | centralMoments[4] = eta*sqrC2; |
194 | 201 | ||
195 | if (realizability < smallNegRealizability_) | ||
202 | if (realizability < smallNegRealizability_ && debug) | ||
196 | 203 | { | { |
197 | 204 | WarningInFunction | WarningInFunction |
198 | 205 | << "Fourth-order central moment is too small." | << "Fourth-order central moment is too small." |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/hyperbolicMomentInversion/hyperbolicMomentInversion.H changed (mode: 100755) (index 24f2d05..a49ebdb) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/newUnivariateMomentInversion.C changed (mode: 100644) (index 492a177..3120866) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversion.C changed (mode: 100644) (index 180879a..f0afda2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversion.H changed (mode: 100644) (index dbbe3ff..c20d9f9) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class univariateMomentInversion | |
56 | 56 | scalar smallM0_; | scalar smallM0_; |
57 | 57 | ||
58 | 58 | ||
59 | // Private member functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | univariateMomentInversion(const univariateMomentInversion&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const univariateMomentInversion&); | ||
66 | |||
67 | |||
68 | 59 | protected: | protected: |
69 | 60 | ||
70 | 61 | // Protected data | // Protected data |
... | ... | public: | |
122 | 113 | const dictionary& dict | const dictionary& dict |
123 | 114 | ); | ); |
124 | 115 | ||
116 | //- Disallow default bitwise copy construct | ||
117 | univariateMomentInversion(const univariateMomentInversion&) = delete; | ||
118 | |||
125 | 119 | ||
126 | 120 | //- Destructor | //- Destructor |
127 | 121 | virtual ~univariateMomentInversion(); | virtual ~univariateMomentInversion(); |
... | ... | public: | |
170 | 164 | //- Return quadrature weigths | //- Return quadrature weigths |
171 | 165 | inline const scalarList& weights() const; | inline const scalarList& weights() const; |
172 | 166 | ||
167 | // Member Operators | ||
168 | |||
169 | //- Disallow default bitwise assignment | ||
170 | void operator=(const univariateMomentInversion&) = delete; | ||
173 | 171 | }; | }; |
174 | 172 | ||
175 | 173 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversionI.H changed (mode: 100644) (index 62291f8..1650b60) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/beta/betaEQMOM.C changed (mode: 100644) (index 7eb2e37..8fe4940) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/beta/betaEQMOM.H changed (mode: 100644) (index 6eef600..faea962) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/extendedMomentInversion/extendedMomentInversion.C changed (mode: 100644) (index 3283270..1734401) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/extendedMomentInversion/extendedMomentInversion.H changed (mode: 100644) (index ec63b7d..f9c5377) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class extendedMomentInversion | |
113 | 113 | univariateMomentSet& momentsStar | univariateMomentSet& momentsStar |
114 | 114 | ); | ); |
115 | 115 | ||
116 | //- Disallow default bitwise copy construct | ||
117 | extendedMomentInversion(const extendedMomentInversion&); | ||
118 | |||
119 | //- Disallow default bitwise assignment | ||
120 | void operator=(const extendedMomentInversion&); | ||
121 | |||
122 | 116 | ||
123 | 117 | protected: | protected: |
124 | 118 | ||
... | ... | public: | |
267 | 261 | const label nSecondaryNodes | const label nSecondaryNodes |
268 | 262 | ); | ); |
269 | 263 | ||
264 | //- Disallow default bitwise copy construct | ||
265 | extendedMomentInversion(const extendedMomentInversion&) = delete; | ||
266 | |||
270 | 267 | ||
271 | 268 | //- Destructor | //- Destructor |
272 | 269 | virtual ~extendedMomentInversion(); | virtual ~extendedMomentInversion(); |
... | ... | public: | |
338 | 335 | //- Return the sum of the kernel density functions at a field of points | //- Return the sum of the kernel density functions at a field of points |
339 | 336 | virtual tmp<scalarField> f(const scalarField& x) const = 0; | virtual tmp<scalarField> f(const scalarField& x) const = 0; |
340 | 337 | ||
338 | // Member Operators | ||
339 | |||
340 | //- Disallow default bitwise assignment | ||
341 | void operator=(const extendedMomentInversion&) = delete; | ||
342 | |||
341 | 343 | }; | }; |
342 | 344 | ||
343 | 345 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/extendedMomentInversion/newExtendedMomentInversion.C changed (mode: 100644) (index 8a0f1ec..2edfef2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/gamma/gammaEQMOM.C changed (mode: 100644) (index 9c52b47..971f5e1) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | void Foam::gammaEQMOM::recurrenceRelation | |
255 | 255 | a[ai] = (2.0*scalar(ai) + alpha + 1.0); | a[ai] = (2.0*scalar(ai) + alpha + 1.0); |
256 | 256 | } | } |
257 | 257 | ||
258 | b[0] = tgamma(1.0 + alpha); | ||
258 | b[0] = gamma(1.0 + alpha); | ||
259 | 259 | ||
260 | 260 | for (label bi = 1; bi < b.size(); bi++) | for (label bi = 1; bi < b.size(); bi++) |
261 | 261 | { | { |
... | ... | Foam::tmp<Foam::scalarField> Foam::gammaEQMOM::f(const scalarField& x) const | |
286 | 286 | ||
287 | 287 | y += | y += |
288 | 288 | pow(x, lambda - 1.0)*exp(-x/theta) | pow(x, lambda - 1.0)*exp(-x/theta) |
289 | /max(tgamma(lambda)*pow(theta, lambda), SMALL) | ||
289 | /max(gamma(lambda)*pow(theta, lambda), SMALL) | ||
290 | 290 | *primaryWeights_[pNodei]; | *primaryWeights_[pNodei]; |
291 | 291 | } | } |
292 | 292 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/gamma/gammaEQMOM.H changed (mode: 100644) (index 4445c06..95adbe6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/lognormal/lognormalEQMOM.C changed (mode: 100644) (index ae23928..3160f06) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/lognormal/lognormalEQMOM.H changed (mode: 100644) (index cdb5c2c..96d2d3a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/Make/options changed (mode: 100644) (index 00af817..99856d4) | |||
1 | 1 | EXE_INC = \ | EXE_INC = \ |
2 | 2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
3 | -I../../mappedList \ | ||
4 | -I../momentSets/lnInclude | ||
3 | -I../../mappedList | ||
5 | 4 | ||
6 | LIB_LIBS = \ | ||
7 | -lfiniteVolume \ | ||
8 | -L$(FOAM_USER_LIBBIN) | ||
5 | |||
6 | LIB_LIBS = |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/momentSet/momentSet.C changed (mode: 100644) (index 39a0750..9f12f20) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/momentSet/momentSet.H changed (mode: 100644) (index 0c4e7ee..a7b03d1) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
38 | 38 | ||
39 | 39 | #include "labelList.H" | #include "labelList.H" |
40 | 40 | #include "scalarList.H" | #include "scalarList.H" |
41 | #include "mappedList.H" | ||
41 | #include "mappedLists.H" | ||
42 | 42 | ||
43 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 44 |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/momentSet/momentSetI.H changed (mode: 100644) (index 02b848e..23b10e2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/multivariateMomentSet/multivariateMomentSet.C changed (mode: 100755) (index 0148ba2..30e0eac) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/multivariateMomentSet/multivariateMomentSet.H changed (mode: 100755) (index 1507dc6..23a608a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/multivariateMomentSet/multivariateMomentSetI.H changed (mode: 100755) (index 28deaba..8a8e145) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/univariateMomentSet/univariateMomentSet.C changed (mode: 100644) (index bc1e975..3c97eb2) | |||
... | ... | void Foam::univariateMomentSet::checkRealizability | |
463 | 463 | } | } |
464 | 464 | } | } |
465 | 465 | ||
466 | alpha_[zetai] = zRecurrence[zetai][zetai + 1]/zRecurrence[zetai][zetai] | ||
467 | - zRecurrence[zetai - 1][zetai] | ||
468 | /zRecurrence[zetai - 1][zetai - 1]; | ||
466 | alpha_[zetai] = | ||
467 | zRecurrence[zetai][zetai + 1] | ||
468 | /max(zRecurrence[zetai][zetai], small) | ||
469 | - zRecurrence[zetai - 1][zetai] | ||
470 | /zRecurrence[zetai - 1][zetai - 1]; | ||
469 | 471 | ||
470 | 472 | if (!(support_ == "R")) | if (!(support_ == "R")) |
471 | 473 | { | { |
... | ... | void Foam::univariateMomentSet::checkRealizability | |
509 | 511 | } | } |
510 | 512 | } | } |
511 | 513 | ||
512 | beta_[nD] = zRecurrence[nD][nD]/zRecurrence[nD - 1][nD - 1]; | ||
514 | beta_[nD] = zRecurrence[nD][nD]/max(zRecurrence[nD - 1][nD - 1], small); | ||
513 | 515 | ||
514 | 516 | if (support_ == "R") | if (support_ == "R") |
515 | 517 | { | { |
516 | alpha_[nD] = zRecurrence[nD][nD + 1]/zRecurrence[nD][nD] | ||
517 | - zRecurrence[nD - 1][nD]/zRecurrence[nD - 1][nD - 1]; | ||
518 | alpha_[nD] = zRecurrence[nD][nD + 1]/max(zRecurrence[nD][nD], small) | ||
519 | - zRecurrence[nD - 1][nD]/max(zRecurrence[nD - 1][nD - 1], | ||
520 | small); | ||
518 | 521 | ||
519 | 522 | if (beta_[nD] <= 0.0) | if (beta_[nD] <= 0.0) |
520 | 523 | { | { |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/univariateMomentSet/univariateMomentSet.H changed (mode: 100644) (index 9724ef5..67f8968) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/univariateMomentSet/univariateMomentSetI.H changed (mode: 100644) (index 3f69340..657654c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2014-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moment.C changed (mode: 100755) (index d0f10bf..ee517eb) | |||
... | ... | Foam::moment<fieldType, nodeType>::moment | |
83 | 83 | ( | ( |
84 | 84 | IOobject | IOobject |
85 | 85 | ( | ( |
86 | momentName(listToWord(cmptOrders), distributionName), | ||
86 | momentName("moment", listToWord(cmptOrders), distributionName), | ||
87 | 87 | mesh.time().timeName(), | mesh.time().timeName(), |
88 | 88 | mesh, | mesh, |
89 | 89 | IOobject::MUST_READ, | IOobject::MUST_READ, |
... | ... | Foam::moment<fieldType, nodeType>::moment | |
94 | 94 | distributionName_(distributionName), | distributionName_(distributionName), |
95 | 95 | nodes_(nodes), | nodes_(nodes), |
96 | 96 | cmptOrders_(cmptOrders), | cmptOrders_(cmptOrders), |
97 | name_(momentName(listToWord(cmptOrders_), distributionName_)), | ||
97 | name_(momentName("moment", listToWord(cmptOrders_), distributionName_)), | ||
98 | 98 | nDimensions_(cmptOrders_.size()), | nDimensions_(cmptOrders_.size()), |
99 | 99 | order_(sum(cmptOrders_)) | order_(sum(cmptOrders_)) |
100 | 100 | {} | {} |
... | ... | Foam::moment<fieldType, nodeType>::moment | |
105 | 105 | const word& distributionName, | const word& distributionName, |
106 | 106 | const labelList& cmptOrders, | const labelList& cmptOrders, |
107 | 107 | const autoPtr<mappedPtrList<nodeType>>& nodes, | const autoPtr<mappedPtrList<nodeType>>& nodes, |
108 | const fieldType& initMoment | ||
108 | const fieldType& initMoment, | ||
109 | const word momentSetName | ||
109 | 110 | ) | ) |
110 | 111 | : | : |
111 | fieldType(initMoment), | ||
112 | fieldType | ||
113 | ( | ||
114 | momentName | ||
115 | ( | ||
116 | "moment" + momentSetName, | ||
117 | listToWord(cmptOrders), | ||
118 | distributionName | ||
119 | ), | ||
120 | initMoment | ||
121 | ), | ||
112 | 122 | distributionName_(distributionName), | distributionName_(distributionName), |
113 | 123 | nodes_(nodes), | nodes_(nodes), |
114 | 124 | cmptOrders_(cmptOrders), | cmptOrders_(cmptOrders), |
115 | name_(momentName(listToWord(cmptOrders_), distributionName_)), | ||
125 | name_ | ||
126 | ( | ||
127 | momentName | ||
128 | ( | ||
129 | "moment" + momentSetName, | ||
130 | listToWord(cmptOrders), | ||
131 | distributionName | ||
132 | ) | ||
133 | ), | ||
116 | 134 | nDimensions_(cmptOrders_.size()), | nDimensions_(cmptOrders_.size()), |
117 | 135 | order_(sum(cmptOrders_)) | order_(sum(cmptOrders_)) |
118 | 136 | {} | {} |
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
143 | 161 | moment == dimensionedScalar("moment", (*this).dimensions(), 0); | moment == dimensionedScalar("moment", (*this).dimensions(), 0); |
144 | 162 | ||
145 | 163 | const mappedPtrList<nodeType>& nodes = nodes_(); | const mappedPtrList<nodeType>& nodes = nodes_(); |
164 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
165 | const labelList& velocityIndexes = nodes[0].velocityIndexes(); | ||
146 | 166 | ||
147 | 167 | // If nodes are not of extended type, only use primary quadrature. | // If nodes are not of extended type, only use primary quadrature. |
148 | 168 | if (!nodes[0].extended()) | if (!nodes[0].extended()) |
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
152 | 172 | const nodeType& node = nodes[pNodei]; | const nodeType& node = nodes[pNodei]; |
153 | 173 | fieldType m = node.primaryWeight(); | fieldType m = node.primaryWeight(); |
154 | 174 | ||
155 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
175 | for (label cmpt = 0; cmpt < scalarIndexes.size(); cmpt++) | ||
156 | 176 | { | { |
157 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
177 | label cmpti = scalarIndexes[cmpt]; | ||
178 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
179 | |||
180 | tmp<fieldType> abscissaCmpt = | ||
181 | node.primaryAbscissae()[cmpt]; | ||
182 | |||
183 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
184 | m.dimensions().reset(mPow().dimensions()); | ||
185 | |||
186 | m == mPow; | ||
187 | } | ||
188 | for (label cmpt = 0; cmpt < velocityIndexes.size(); cmpt++) | ||
189 | { | ||
190 | label cmpti = velocityIndexes[cmpt]; | ||
191 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
158 | 192 | ||
159 | 193 | tmp<fieldType> abscissaCmpt | tmp<fieldType> abscissaCmpt |
160 | = node.primaryAbscissa().component(cmpt); | ||
194 | = node.velocityAbscissae().component(cmpt); | ||
161 | 195 | ||
162 | 196 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); |
163 | 197 | m.dimensions().reset(mPow().dimensions()); | m.dimensions().reset(mPow().dimensions()); |
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
179 | 213 | ||
180 | 214 | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) |
181 | 215 | { | { |
182 | fieldType m(pW*node.secondaryWeights()[sNodei]); | ||
216 | fieldType m(pW); | ||
183 | 217 | ||
184 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
218 | for (label cmpt = 0; cmpt < scalarIndexes.size(); cmpt++) | ||
185 | 219 | { | { |
186 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
220 | label cmpti = scalarIndexes[cmpt]; | ||
221 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
187 | 222 | ||
188 | 223 | tmp<fieldType> abscissaCmpt | tmp<fieldType> abscissaCmpt |
189 | = node.secondaryAbscissae()[sNodei].component(cmpt); | ||
224 | = node.secondaryAbscissae()[cmpt][sNodei]; | ||
225 | |||
226 | tmp<fieldType> mPow = | ||
227 | m | ||
228 | *node.secondaryWeights()[cmpt][sNodei] | ||
229 | *pow(abscissaCmpt, cmptMomentOrder); | ||
190 | 230 | ||
191 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
192 | 231 | m.dimensions().reset(mPow().dimensions()); | m.dimensions().reset(mPow().dimensions()); |
193 | 232 | m == mPow; | m == mPow; |
194 | 233 | } | } |
234 | for (label cmpt = 0; cmpt < velocityIndexes.size(); cmpt++) | ||
235 | { | ||
236 | label cmpti = velocityIndexes[cmpt]; | ||
237 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
195 | 238 | ||
239 | tmp<fieldType> abscissaCmpt | ||
240 | = node.velocityAbscissae().component(cmpt); | ||
241 | |||
242 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
243 | m.dimensions().reset(mPow().dimensions()); | ||
244 | |||
245 | m == mPow; | ||
246 | } | ||
196 | 247 | moment == moment + m; | moment == moment + m; |
197 | 248 | } | } |
198 | 249 | } | } |
199 | 250 | } | } |
200 | 251 | ||
252 | template <class fieldType, class nodeType> | ||
253 | void Foam::moment<fieldType, nodeType>::updateBoundaries() | ||
254 | { | ||
255 | const mappedPtrList<nodeType>& nodes = nodes_(); | ||
256 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
257 | const labelList& velocityIndexes = nodes[0].velocityIndexes(); | ||
258 | |||
259 | // If nodes are not of extended type, only use primary quadrature. | ||
260 | if (!nodes[0].extended()) | ||
261 | { | ||
262 | forAll(this->boundaryField(), patchi) | ||
263 | { | ||
264 | this->boundaryFieldRef()[patchi] = 0.0; | ||
265 | forAll(nodes, pNodei) | ||
266 | { | ||
267 | const nodeType& node = nodes[pNodei]; | ||
268 | scalarField m(node.primaryWeight().boundaryField()[patchi]); | ||
269 | |||
270 | for (label cmpt = 0; cmpt < scalarIndexes.size(); cmpt++) | ||
271 | { | ||
272 | label cmpti = scalarIndexes[cmpt]; | ||
273 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
274 | |||
275 | const scalarField& abscissaCmpt = | ||
276 | node.primaryAbscissae()[cmpt].boundaryField()[patchi]; | ||
277 | |||
278 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
279 | |||
280 | } | ||
281 | for (label cmpt = 0; cmpt < velocityIndexes.size(); cmpt++) | ||
282 | { | ||
283 | label cmpti = velocityIndexes[cmpt]; | ||
284 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
285 | |||
286 | tmp<scalarField> abscissaCmpt | ||
287 | = node.velocityAbscissae().boundaryField()[patchi].component(cmpt); | ||
288 | |||
289 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
290 | } | ||
291 | |||
292 | this->boundaryFieldRef()[patchi] += m; | ||
293 | } | ||
294 | } | ||
295 | |||
296 | return; | ||
297 | } | ||
298 | |||
299 | // Extended quadrature case | ||
300 | forAll(this->boundaryField(), patchi) | ||
301 | { | ||
302 | this->boundaryFieldRef()[patchi] = 0.0; | ||
303 | forAll(nodes, pNodei) | ||
304 | { | ||
305 | const nodeType& node = nodes[pNodei]; | ||
306 | const scalarField& pW = node.primaryWeight().boundaryField()[patchi]; | ||
307 | |||
308 | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) | ||
309 | { | ||
310 | scalarField m(pW); | ||
311 | |||
312 | for (label cmpt = 0; cmpt < scalarIndexes.size(); cmpt++) | ||
313 | { | ||
314 | label cmpti = scalarIndexes[cmpt]; | ||
315 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
316 | |||
317 | const scalarField& abscissaCmpt = | ||
318 | node.secondaryAbscissae()[cmpt][sNodei].boundaryField()[patchi]; | ||
319 | |||
320 | m *= | ||
321 | node.secondaryWeights()[cmpt][sNodei].boundaryField()[patchi] | ||
322 | *pow(abscissaCmpt, cmptMomentOrder); | ||
323 | } | ||
324 | for (label cmpt = 0; cmpt < velocityIndexes.size(); cmpt++) | ||
325 | { | ||
326 | label cmpti = velocityIndexes[cmpt]; | ||
327 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
328 | |||
329 | tmp<scalarField> abscissaCmpt | ||
330 | = node.velocityAbscissae().boundaryField()[patchi].component(cmpt); | ||
331 | |||
332 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
333 | |||
334 | } | ||
335 | this->boundaryFieldRef()[patchi] += m; | ||
336 | } | ||
337 | } | ||
338 | } | ||
339 | } | ||
340 | |||
201 | 341 | template <class fieldType, class nodeType> | template <class fieldType, class nodeType> |
202 | 342 | void Foam::moment<fieldType, nodeType>::updateLocalMoment(label elemi) | void Foam::moment<fieldType, nodeType>::updateLocalMoment(label elemi) |
203 | 343 | { | { |
... | ... | void Foam::moment<fieldType, nodeType>::updateLocalMoment(label elemi) | |
205 | 345 | scalar moment = 0; | scalar moment = 0; |
206 | 346 | ||
207 | 347 | const mappedPtrList<nodeType>& nodes = nodes_(); | const mappedPtrList<nodeType>& nodes = nodes_(); |
348 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
349 | const labelList& velocityIndexes = nodes[0].velocityIndexes(); | ||
208 | 350 | ||
209 | 351 | // If nodes are not of extended type, only use primary quadrature. | // If nodes are not of extended type, only use primary quadrature. |
210 | 352 | if (!nodes[0].extended()) | if (!nodes[0].extended()) |
... | ... | void Foam::moment<fieldType, nodeType>::updateLocalMoment(label elemi) | |
214 | 356 | const nodeType& node = nodes[pNodei]; | const nodeType& node = nodes[pNodei]; |
215 | 357 | scalar m = node.primaryWeight()[elemi]; | scalar m = node.primaryWeight()[elemi]; |
216 | 358 | ||
217 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
359 | for (label cmpt = 0; cmpt < scalarIndexes.size(); cmpt++) | ||
360 | { | ||
361 | label cmpti = scalarIndexes[cmpt]; | ||
362 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
363 | |||
364 | const scalar abscissaCmpt = | ||
365 | node.primaryAbscissae()[cmpt][elemi]; | ||
366 | |||
367 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
368 | } | ||
369 | for (label cmpt = 0; cmpt < velocityIndexes.size(); cmpt++) | ||
218 | 370 | { | { |
219 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
371 | label cmpti = velocityIndexes[cmpt]; | ||
372 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
220 | 373 | ||
221 | 374 | const scalar abscissaCmpt = | const scalar abscissaCmpt = |
222 | component(node.primaryAbscissa()[elemi], cmpt); | ||
375 | component(node.velocityAbscissae()[elemi], cmpt); | ||
223 | 376 | ||
224 | 377 | m *= pow(abscissaCmpt, cmptMomentOrder); | m *= pow(abscissaCmpt, cmptMomentOrder); |
225 | 378 | } | } |
... | ... | void Foam::moment<fieldType, nodeType>::updateLocalMoment(label elemi) | |
240 | 393 | ||
241 | 394 | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) |
242 | 395 | { | { |
243 | scalar m = pW*node.secondaryWeights()[sNodei][elemi]; | ||
396 | scalar m = pW; | ||
244 | 397 | ||
245 | 398 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) |
246 | 399 | { | { |
247 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
400 | label cmpti = scalarIndexes[cmpt]; | ||
401 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
248 | 402 | ||
249 | 403 | const scalar abscissaCmpt = | const scalar abscissaCmpt = |
250 | component(node.secondaryAbscissae()[sNodei][elemi], cmpt); | ||
404 | node.secondaryAbscissae()[cmpt][sNodei][elemi]; | ||
251 | 405 | ||
252 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
406 | m *= | ||
407 | node.secondaryWeights()[cmpt][sNodei][elemi] | ||
408 | *pow(abscissaCmpt, cmptMomentOrder); | ||
253 | 409 | } | } |
410 | for (label cmpt = 0; cmpt < velocityIndexes.size(); cmpt++) | ||
411 | { | ||
412 | label cmpti = velocityIndexes[cmpt]; | ||
413 | const label cmptMomentOrder = cmptOrders()[cmpti]; | ||
414 | |||
415 | const scalar abscissaCmpt = | ||
416 | component(node.velocityAbscissae()[elemi], cmpt); | ||
254 | 417 | ||
418 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
419 | } | ||
255 | 420 | moment += m; | moment += m; |
256 | 421 | } | } |
257 | 422 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moment.H changed (mode: 100755) (index 5f0e091..537e30f) | |||
... | ... | public: | |
113 | 113 | const word& distributionName, | const word& distributionName, |
114 | 114 | const labelList& cmptOrders, | const labelList& cmptOrders, |
115 | 115 | const autoPtr<mappedPtrList<nodeType>>& nodes, | const autoPtr<mappedPtrList<nodeType>>& nodes, |
116 | const fieldType& initMoment | ||
116 | const fieldType& initMoment, | ||
117 | const word momentSetName = word::null | ||
117 | 118 | ); | ); |
118 | 119 | ||
119 | 120 | //- Return clone | //- Return clone |
... | ... | public: | |
168 | 169 | //- Creates the name of the moment | //- Creates the name of the moment |
169 | 170 | word momentName | word momentName |
170 | 171 | ( | ( |
172 | const word& momentSetName, | ||
171 | 173 | const word& order, | const word& order, |
172 | 174 | const word& distributionName | const word& distributionName |
173 | 175 | ) | ) |
174 | 176 | { | { |
175 | word tmpName = IOobject::groupName("moment", order); | ||
176 | |||
177 | word tmpName = IOobject::groupName(momentSetName, order); | ||
177 | 178 | return IOobject::groupName(tmpName, distributionName); | return IOobject::groupName(tmpName, distributionName); |
178 | 179 | } | } |
179 | 180 | ||
... | ... | public: | |
200 | 201 | //- Update the moment from the quadrature nodes | //- Update the moment from the quadrature nodes |
201 | 202 | void update(); | void update(); |
202 | 203 | ||
204 | //- Update the moment from the quadrature nodes | ||
205 | // on boundaries | ||
206 | void updateBoundaries(); | ||
207 | |||
203 | 208 | //- Update the moment from the quadrature nodes in a single element | //- Update the moment from the quadrature nodes in a single element |
204 | 209 | void updateLocalMoment(label elemi); | void updateLocalMoment(label elemi); |
205 | 210 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSet.C changed (mode: 100755) (index fd9032b..e95d154) | |||
... | ... | void Foam::momentFieldSet<momentType, nodeType>::update() | |
108 | 108 | } | } |
109 | 109 | } | } |
110 | 110 | ||
111 | template <class momentType, class nodeType> | ||
112 | void Foam::momentFieldSet<momentType, nodeType>::updateBoundaries() | ||
113 | { | ||
114 | forAll(*this, mI) | ||
115 | { | ||
116 | this->operator[](mI).updateBoundaries(); | ||
117 | } | ||
118 | } | ||
119 | |||
111 | 120 | template <class momentType, class nodeType> | template <class momentType, class nodeType> |
112 | 121 | void Foam::momentFieldSet<momentType, nodeType> | void Foam::momentFieldSet<momentType, nodeType> |
113 | 122 | ::updateLocalMoments(label elemi) | ::updateLocalMoments(label elemi) |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSet.H changed (mode: 100755) (index 2763922..3ca6674) | |||
... | ... | class momentFieldSet | |
99 | 99 | // 0 -> 100 | // 0 -> 100 |
100 | 100 | // 1 -> 10 | // 1 -> 10 |
101 | 101 | // 2 -> 1 | // 2 -> 1 |
102 | //inline label dimToCmptOrder(label dim) const; | ||
103 | |||
104 | //- Disallow default bitwise copy construct | ||
105 | momentFieldSet(const momentFieldSet&); | ||
106 | |||
107 | //- Disallow default bitwise assignment | ||
108 | void operator=(const momentFieldSet&); | ||
102 | //inline label dimToCmptOrder(label dim) const | ||
109 | 103 | ||
110 | 104 | ||
111 | 105 | public: | public: |
... | ... | public: | |
136 | 130 | ); | ); |
137 | 131 | ||
138 | 132 | ||
133 | //- Disallow default bitwise copy construct | ||
134 | momentFieldSet(const momentFieldSet&) = delete; | ||
135 | |||
136 | |||
139 | 137 | //- Destructor | //- Destructor |
140 | 138 | ~momentFieldSet(); | ~momentFieldSet(); |
141 | 139 | ||
... | ... | public: | |
153 | 151 | //- Recalculate the moments from the quadrature nodes | //- Recalculate the moments from the quadrature nodes |
154 | 152 | void update(); | void update(); |
155 | 153 | ||
154 | //- Recalculate the moments from the quadrature nodes | ||
155 | // on boundaries | ||
156 | void updateBoundaries(); | ||
157 | |||
156 | 158 | //- Recalculate the moments from the quadrature nodes in an element | //- Recalculate the moments from the quadrature nodes in an element |
157 | 159 | void updateLocalMoments(label elemi); | void updateLocalMoments(label elemi); |
160 | |||
161 | |||
162 | // Member Operators | ||
163 | |||
164 | //- Disallow default bitwise assignment | ||
165 | void operator=(const momentFieldSet&) = delete; | ||
158 | 166 | }; | }; |
159 | 167 | ||
160 | 168 |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSets.H changed (mode: 100644) (index 51e73b4..323d3fd) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
43 | 43 | namespace Foam | namespace Foam |
44 | 44 | { | { |
45 | 45 | ||
46 | typedef momentFieldSet<volUnivariateMoment, volScalarNode> | ||
47 | volUnivariateMomentFieldSet; | ||
46 | typedef momentFieldSet<volScalarMoment, volScalarNode> volScalarMomentFieldSet; | ||
47 | typedef momentFieldSet<surfaceScalarMoment, surfaceScalarNode> | ||
48 | surfaceScalarMomentFieldSet; | ||
48 | 49 | ||
49 | typedef momentFieldSet<surfaceUnivariateMoment, surfaceScalarNode> | ||
50 | surfaceUnivariateMomentFieldSet; | ||
50 | typedef momentFieldSet<volVelocityMoment, volVelocityNode> | ||
51 | volVelocityMomentFieldSet; | ||
51 | 52 | ||
52 | typedef momentFieldSet<volVectorMoment, volVectorNode> | ||
53 | volVectorMomentFieldSet; | ||
54 | |||
55 | typedef momentFieldSet<surfaceVectorMoment, surfaceVectorNode> | ||
56 | surfaceVectorMomentFieldSet; | ||
53 | typedef momentFieldSet<surfaceVelocityMoment, surfaceVelocityNode> | ||
54 | surfaceVelocityMomentFieldSet; | ||
57 | 55 | ||
58 | 56 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
59 | 57 |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moments.H changed (mode: 100644) (index 4559c79..ac93bf4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
42 | 42 | namespace Foam | namespace Foam |
43 | 43 | { | { |
44 | 44 | ||
45 | typedef moment<volScalarField, volScalarNode> volUnivariateMoment; | ||
45 | typedef moment<volScalarField, volScalarNode> volScalarMoment; | ||
46 | typedef moment<surfaceScalarField, surfaceScalarNode> surfaceScalarMoment; | ||
46 | 47 | ||
47 | typedef moment<surfaceScalarField, surfaceScalarNode> surfaceUnivariateMoment; | ||
48 | |||
49 | typedef moment<volScalarField, volVectorNode> volVectorMoment; | ||
50 | |||
51 | typedef moment<surfaceScalarField, surfaceVectorNode> surfaceVectorMoment; | ||
48 | typedef moment<volScalarField, volVelocityNode> volVelocityMoment; | ||
49 | typedef moment<surfaceScalarField, surfaceVelocityNode> surfaceVelocityMoment; | ||
52 | 50 | ||
53 | 51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
54 | 52 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/Make/files changed (mode: 100644) (index 4d50060..1790b18) | |||
... | ... | populationBalanceSubModels/aggregationKernels/buoyancyInduced/buoyancyInduced.C | |
13 | 13 | populationBalanceSubModels/aggregationKernels/buoyancyInducedSI/buoyancyInducedSI.C | populationBalanceSubModels/aggregationKernels/buoyancyInducedSI/buoyancyInducedSI.C |
14 | 14 | populationBalanceSubModels/aggregationKernels/Grimes/Grimes.C | populationBalanceSubModels/aggregationKernels/Grimes/Grimes.C |
15 | 15 | ||
16 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceKernel.C | ||
17 | |||
18 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/coalescenceEfficiencyKernel/coalescenceEfficiencyKernel.C | ||
19 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/coalescenceEfficiencyKernel/newCoalescenceEfficiencyKernel.C | ||
20 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/constant/constantEfficiency.C | ||
21 | |||
22 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/coalescenceFrequencyKernel/coalescenceFrequencyKernel.C | ||
23 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/coalescenceFrequencyKernel/newCoalescenceFrequencyKernel.C | ||
24 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/Luo/LuoFrequency.C | ||
25 | populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/shearRate/shearRateFrequency.C | ||
26 | |||
16 | 27 | populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C | populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C |
17 | 28 | populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C | populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C |
18 | 29 | populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C | populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C |
... | ... | populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion | |
38 | 49 | populationBalanceSubModels/growthModels/growthModel/growthModel.C | populationBalanceSubModels/growthModels/growthModel/growthModel.C |
39 | 50 | populationBalanceSubModels/growthModels/growthModel/newGrowthModel.C | populationBalanceSubModels/growthModels/growthModel/newGrowthModel.C |
40 | 51 | populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C | populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C |
52 | populationBalanceSubModels/growthModels/linearEvaporation/linearEvaporation.C | ||
53 | populationBalanceSubModels/growthModels/nonLinearEvaporation/nonLinearEvaporation.C | ||
41 | 54 | ||
42 | 55 | populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C | populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C |
43 | 56 | populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C | populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C |
... | ... | populationBalanceSubModels/environmentMixingModels/IEM/IEM.C | |
50 | 63 | ||
51 | 64 | populationBalanceSubModels/collisionKernels/collisionKernel/collisionKernel.C | populationBalanceSubModels/collisionKernels/collisionKernel/collisionKernel.C |
52 | 65 | populationBalanceSubModels/collisionKernels/collisionKernel/newCollisionKernel.C | populationBalanceSubModels/collisionKernels/collisionKernel/newCollisionKernel.C |
53 | populationBalanceSubModels/collisionKernels/BoltzmannCollision/BoltzmannCollision.C | ||
54 | 66 | populationBalanceSubModels/collisionKernels/BGKCollision/BGKCollision.C | populationBalanceSubModels/collisionKernels/BGKCollision/BGKCollision.C |
67 | populationBalanceSubModels/collisionKernels/BGKCollision/equilibriumMomentFunctions.C | ||
55 | 68 | populationBalanceSubModels/collisionKernels/esBGKCollision/esBGKCollision.C | populationBalanceSubModels/collisionKernels/esBGKCollision/esBGKCollision.C |
56 | 69 | populationBalanceSubModels/collisionKernels/noCollision/noCollision.C | populationBalanceSubModels/collisionKernels/noCollision/noCollision.C |
70 | populationBalanceSubModels/collisionKernels/BoltzmannCollision/BoltzmannCollision.C | ||
71 | populationBalanceSubModels/collisionKernels/BoltzmannCollision/ICoefficientFunctions.C | ||
72 | populationBalanceSubModels/collisionKernels/BoltzmannCollision/IxCoefficientFunctions.C | ||
73 | populationBalanceSubModels/collisionKernels/BoltzmannCollision/IyCoefficientFunctions.C | ||
74 | populationBalanceSubModels/collisionKernels/BoltzmannCollision/IzCoefficientFunctions.C | ||
57 | 75 | ||
58 | 76 | noPopulationBalance/noPopulationBalance.C | noPopulationBalance/noPopulationBalance.C |
59 | 77 | univariatePopulationBalance/univariatePopulationBalance.C | univariatePopulationBalance/univariatePopulationBalance.C |
60 | 78 | mixingPopulationBalance/mixingPopulationBalance.C | mixingPopulationBalance/mixingPopulationBalance.C |
61 | 79 | velocityPopulationBalance/velocityPopulationBalance.C | velocityPopulationBalance/velocityPopulationBalance.C |
80 | sizeVelocityPopulationBalance/sizeVelocityPopulationBalance.C | ||
62 | 81 | ||
63 | 82 | LIB = $(FOAM_USER_LIBBIN)/libpopulationBalance | LIB = $(FOAM_USER_LIBBIN)/libpopulationBalance |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/Make/options changed (mode: 100644) (index 3cdf449..5a7ab4f) | |||
... | ... | EXE_INC = \ | |
11 | 11 | -I../../eigenSolver/lnInclude \ | -I../../eigenSolver/lnInclude \ |
12 | 12 | -I../../mappedList \ | -I../../mappedList \ |
13 | 13 | -I../../mappedPtrList \ | -I../../mappedPtrList \ |
14 | -I../../Vandermonde \ | ||
14 | 15 | -I../momentSets/lnInclude \ | -I../momentSets/lnInclude \ |
15 | -I../quadratureNode \ | ||
16 | -I../quadratureNode/lnInclude \ | ||
16 | 17 | -I../moments \ | -I../moments \ |
17 | 18 | -I../momentInversion/lnInclude \ | -I../momentInversion/lnInclude \ |
18 | 19 | -I../fieldMomentInversion/lnInclude \ | -I../fieldMomentInversion/lnInclude \ |
19 | 20 | -I../quadratureApproximations/lnInclude \ | -I../quadratureApproximations/lnInclude \ |
20 | 21 | -I../momentAdvection/lnInclude \ | -I../momentAdvection/lnInclude \ |
21 | 22 | -I../PDFTransportModels/lnInclude \ | -I../PDFTransportModels/lnInclude \ |
22 | -I../mixingModels/lnInclude | ||
23 | -I../mixingModels/lnInclude \ | ||
24 | -I../realizableOdeSolver | ||
23 | 25 | ||
24 | 26 | LIB_LIBS = \ | LIB_LIBS = \ |
25 | 27 | -lincompressibleTransportModels \ | -lincompressibleTransportModels \ |
... | ... | LIB_LIBS = \ | |
33 | 35 | -lmeshTools \ | -lmeshTools \ |
34 | 36 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
35 | 37 | -leigenSolver \ | -leigenSolver \ |
38 | -lquadratureNode \ | ||
36 | 39 | -lmomentSets \ | -lmomentSets \ |
37 | 40 | -lmomentInversion \ | -lmomentInversion \ |
38 | 41 | -lfieldMomentInversion \ | -lfieldMomentInversion \ |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/mixingPopulationBalance/mixingPopulationBalance.C changed (mode: 100644) (index 0ce0c9c..ff1824b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
56 | 56 | ) | ) |
57 | 57 | : | : |
58 | 58 | populationBalanceModel(name, dict, phi), | populationBalanceModel(name, dict, phi), |
59 | ATol_(readScalar(dict.subDict("odeCoeffs").lookup("ATol"))), | ||
60 | RTol_(readScalar(dict.subDict("odeCoeffs").lookup("RTol"))), | ||
61 | fac_(readScalar(dict.subDict("odeCoeffs").lookup("fac"))), | ||
62 | facMin_(readScalar(dict.subDict("odeCoeffs").lookup("facMin"))), | ||
63 | facMax_(readScalar(dict.subDict("odeCoeffs").lookup("facMax"))), | ||
64 | minLocalDt_(readScalar(dict.subDict("odeCoeffs").lookup("minLocalDt"))), | ||
65 | name_(name), | ||
59 | odeType(phi.mesh(), dict), | ||
66 | 60 | mixingModel_ | mixingModel_ |
67 | 61 | ( | ( |
68 | 62 | new Foam::PDFTransportModels::mixingModels::turbulentMixing | new Foam::PDFTransportModels::mixingModels::turbulentMixing |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
86 | 80 | ), | ), |
87 | 81 | xi1_ | xi1_ |
88 | 82 | ( | ( |
89 | mixingModel_().quadrature().nodes()[0].primaryAbscissa() | ||
83 | mixingModel_().quadrature().nodes()[0].primaryAbscissae()[0] | ||
90 | 84 | ), | ), |
91 | 85 | p2_ | p2_ |
92 | 86 | ( | ( |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
94 | 88 | ), | ), |
95 | 89 | xi2_ | xi2_ |
96 | 90 | ( | ( |
97 | mixingModel_().quadrature().nodes()[1].primaryAbscissa() | ||
91 | mixingModel_().quadrature().nodes()[1].primaryAbscissae()[0] | ||
98 | 92 | ), | ), |
99 | 93 | meanXi_ | meanXi_ |
100 | 94 | ( | ( |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
165 | 159 | aggregation_(dict.lookup("aggregation")), | aggregation_(dict.lookup("aggregation")), |
166 | 160 | breakup_(dict.lookup("breakup")), | breakup_(dict.lookup("breakup")), |
167 | 161 | growth_(dict.lookup("growth")), | growth_(dict.lookup("growth")), |
162 | nucleation_(dict.lookup("nucleation")), | ||
168 | 163 | aggregationKernel_ | aggregationKernel_ |
169 | 164 | ( | ( |
170 | 165 | Foam::populationBalanceSubModels::aggregationKernel::New | Foam::populationBalanceSubModels::aggregationKernel::New |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
181 | 176 | phi_.mesh() | phi_.mesh() |
182 | 177 | ) | ) |
183 | 178 | ), | ), |
184 | daughterDistribution_ | ||
185 | ( | ||
186 | Foam::populationBalanceSubModels::daughterDistribution::New | ||
187 | ( | ||
188 | dict.subDict("daughterDistribution") | ||
189 | ) | ||
190 | ), | ||
191 | 179 | growthModel_ | growthModel_ |
192 | 180 | ( | ( |
193 | 181 | Foam::populationBalanceSubModels::growthModel::New | Foam::populationBalanceSubModels::growthModel::New |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
246 | 234 | ||
247 | 235 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
248 | 236 | ||
249 | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | ||
250 | ::explicitMomentSource | ||
251 | ( | ||
252 | univariateQuadratureApproximation& quadrature, | ||
253 | const label environment | ||
254 | ) | ||
255 | { | ||
256 | volUnivariateMomentFieldSet& moments(quadrature.moments()); | ||
257 | const mappedPtrList<volScalarNode>& nodes(quadrature.nodes()); | ||
258 | label nMoments = quadrature.nMoments(); | ||
259 | scalar globalDt = moments[0].mesh().time().deltaT().value(); | ||
260 | |||
261 | Info << "Solving source terms in realizable ODE solver." << endl; | ||
262 | |||
263 | forAll(moments[0], celli) | ||
264 | { | ||
265 | // Storing old moments to recover from failed step | ||
266 | scalarList oldMoments(nMoments, 0.0); | ||
267 | |||
268 | forAll(oldMoments, mi) | ||
269 | { | ||
270 | oldMoments[mi] = moments[mi][celli]; | ||
271 | } | ||
272 | |||
273 | //- Local time | ||
274 | scalar localT = 0.0; | ||
275 | |||
276 | // Initialize the local step | ||
277 | scalar localDt = globalDt/100.0; | ||
278 | |||
279 | // Initialize RK parameters | ||
280 | scalarList k1(nMoments, 0.0); | ||
281 | scalarList k2(nMoments, 0.0); | ||
282 | scalarList k3(nMoments, 0.0); | ||
283 | |||
284 | // Flag to indicate if the time step is complete | ||
285 | bool timeComplete = false; | ||
286 | |||
287 | // Check realizability of intermediate moment sets | ||
288 | bool realizableUpdate1 = false; | ||
289 | bool realizableUpdate2 = false; | ||
290 | bool realizableUpdate3 = false; | ||
291 | |||
292 | scalarList momentsSecondStep(nMoments, 0.0); | ||
293 | |||
294 | bool nullSource = false; | ||
295 | |||
296 | while (!timeComplete) | ||
297 | { | ||
298 | do | ||
299 | { | ||
300 | // First intermediate update | ||
301 | forAll(oldMoments, mi) | ||
302 | { | ||
303 | k1[mi] | ||
304 | = localDt*cellMomentSource | ||
305 | ( | ||
306 | mi, celli, nodes, environment | ||
307 | ); | ||
308 | |||
309 | moments[mi][celli] = oldMoments[mi] + k1[mi]; | ||
310 | |||
311 | nullSource = (mag(k1[mi]) < SMALL) || nullSource; | ||
312 | } | ||
313 | |||
314 | if (nullSource) | ||
315 | { | ||
316 | return; | ||
317 | } | ||
318 | |||
319 | realizableUpdate1 = | ||
320 | quadrature.updateLocalQuadrature(celli, false); | ||
321 | |||
322 | quadrature.updateLocalMoments(celli); | ||
323 | |||
324 | // Second moment update | ||
325 | forAll(oldMoments, mi) | ||
326 | { | ||
327 | k2[mi] | ||
328 | = localDt*cellMomentSource | ||
329 | ( | ||
330 | mi, celli, nodes, environment | ||
331 | ); | ||
332 | |||
333 | moments[mi][celli] = oldMoments[mi] + (k1[mi] + k2[mi])/4.0; | ||
334 | momentsSecondStep[mi] = moments[mi][celli]; | ||
335 | } | ||
336 | |||
337 | realizableUpdate2 = | ||
338 | quadrature.updateLocalQuadrature(celli, false); | ||
339 | |||
340 | quadrature.updateLocalMoments(celli); | ||
341 | |||
342 | // Third moment update | ||
343 | forAll(oldMoments, mi) | ||
344 | { | ||
345 | k3[mi] | ||
346 | = localDt*cellMomentSource | ||
347 | ( | ||
348 | mi, celli, nodes, environment | ||
349 | ); | ||
350 | |||
351 | moments[mi][celli] = | ||
352 | oldMoments[mi] + (k1[mi] + k2[mi] + 4.0*k3[mi])/6.0; | ||
353 | } | ||
354 | |||
355 | realizableUpdate3 = | ||
356 | quadrature.updateLocalQuadrature(celli, false); | ||
357 | |||
358 | quadrature.updateLocalMoments(celli); | ||
359 | |||
360 | if | ||
361 | ( | ||
362 | !realizableUpdate1 | ||
363 | || !realizableUpdate2 | ||
364 | || !realizableUpdate3 | ||
365 | ) | ||
366 | { | ||
367 | localDt /= 2.0; | ||
368 | |||
369 | if (localDt < minLocalDt_) | ||
370 | { | ||
371 | FatalErrorInFunction | ||
372 | << "Reached minimum local step in realizable ODE" | ||
373 | << nl | ||
374 | << " solver. Cannot ensure realizability." << nl | ||
375 | << " Local time step = " << localDt << nl | ||
376 | << " Min local time step = " << minLocalDt_ << nl | ||
377 | << " Last valid moments in cell: " | ||
378 | << oldMoments << nl | ||
379 | << abort(FatalError); | ||
380 | } | ||
381 | |||
382 | forAll(oldMoments, mi) | ||
383 | { | ||
384 | moments[mi][celli] = oldMoments[mi]; | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | while | ||
389 | ( | ||
390 | !realizableUpdate1 | ||
391 | || !realizableUpdate2 | ||
392 | || !realizableUpdate3 | ||
393 | ); | ||
394 | |||
395 | scalar error = 0.0; | ||
396 | |||
397 | for (label mi = 0; mi < nMoments; mi++) | ||
398 | { | ||
399 | scalar scalei = | ||
400 | ATol_ | ||
401 | + max | ||
402 | ( | ||
403 | mag(momentsSecondStep[mi]), mag(oldMoments[mi]) | ||
404 | )*RTol_; | ||
405 | |||
406 | error += | ||
407 | sqr | ||
408 | ( | ||
409 | (momentsSecondStep[mi] - moments[mi][celli])/scalei | ||
410 | ); | ||
411 | } | ||
412 | |||
413 | error = sqrt(error/nMoments); | ||
414 | |||
415 | if (error < SMALL) | ||
416 | { | ||
417 | return; | ||
418 | } | ||
419 | |||
420 | if (error < 1) | ||
421 | { | ||
422 | localDt *= min(facMax_, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
423 | |||
424 | scalar maxLocalDt = max(globalDt - localT, 0.0); | ||
425 | localDt = min(maxLocalDt, localDt); | ||
426 | |||
427 | forAll(oldMoments, mi) | ||
428 | { | ||
429 | oldMoments[mi] = moments[mi][celli]; | ||
430 | } | ||
431 | |||
432 | if (localDt == 0.0) | ||
433 | { | ||
434 | timeComplete = true; | ||
435 | localT = 0.0; | ||
436 | break; | ||
437 | } | ||
438 | |||
439 | localT += localDt; | ||
440 | } | ||
441 | else | ||
442 | { | ||
443 | localDt *= min(1.0, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
444 | |||
445 | forAll(oldMoments, mi) | ||
446 | { | ||
447 | moments[mi][celli] = oldMoments[mi]; | ||
448 | } | ||
449 | } | ||
450 | } | ||
451 | } | ||
452 | } | ||
453 | |||
454 | |||
455 | 237 | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance |
456 | 238 | ::calcEnvironmentMoments() | ::calcEnvironmentMoments() |
457 | 239 | { | { |
458 | const volUnivariateMomentFieldSet& mXi | ||
240 | const volScalarMomentFieldSet& mXi | ||
459 | 241 | ( | ( |
460 | 242 | mixingModel_().quadrature().moments() | mixingModel_().quadrature().moments() |
461 | 243 | ); | ); |
462 | 244 | ||
463 | const volUnivariateMoment& xiMean_ = mXi[1]; | ||
464 | const volUnivariateMoment& xiMTwo_ = mXi[2]; | ||
245 | const volScalarMoment& xiMean_ = mXi[1]; | ||
246 | const volScalarMoment& xiMTwo_ = mXi[2]; | ||
465 | 247 | ||
466 | 248 | // Compute variance of the mixture fraction | // Compute variance of the mixture fraction |
467 | 249 | const volScalarField xiVariance(xiMTwo_ - sqr(xiMean_)); | const volScalarField xiVariance(xiMTwo_ - sqr(xiMean_)); |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
524 | 306 | } | } |
525 | 307 | } | } |
526 | 308 | ||
309 | |||
527 | 310 | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance |
528 | 311 | ::calcMixedMoments() | ::calcMixedMoments() |
529 | 312 | { | { |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
531 | 314 | { | { |
532 | 315 | meanMoments_[mi] == p1_*mEnvOne_[mi] + p2_*mEnvTwo_[mi]; | meanMoments_[mi] == p1_*mEnvOne_[mi] + p2_*mEnvTwo_[mi]; |
533 | 316 | ||
534 | meanMomentsVariance_[mi] | ||
535 | == p1_*xi1_*mEnvOne_[mi] + p2_*xi2_*mEnvTwo_[mi]; | ||
317 | meanMomentsVariance_[mi] == | ||
318 | p1_*xi1_*mEnvOne_[mi] + p2_*xi2_*mEnvTwo_[mi]; | ||
536 | 319 | } | } |
537 | 320 | } | } |
538 | 321 | ||
539 | Foam::scalar | ||
540 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | ||
541 | ::aggregationSource | ||
542 | ( | ||
543 | const label momentOrder, | ||
544 | const label celli, | ||
545 | const mappedPtrList<volScalarNode>& nodes, | ||
546 | const label environment | ||
547 | ) | ||
548 | { | ||
549 | scalar aSource = 0.0; | ||
550 | |||
551 | if (!aggregation_) | ||
552 | { | ||
553 | return aSource; | ||
554 | } | ||
555 | |||
556 | if (!nodes[0].extended()) // Non-extended quadrature case | ||
557 | { | ||
558 | forAll(nodes, pNode1i) | ||
559 | { | ||
560 | const volScalarNode& node1 = nodes[pNode1i]; | ||
561 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
562 | const volScalarField& pAbscissa1 = node1.primaryAbscissa(); | ||
563 | |||
564 | forAll(nodes, pNode2i) | ||
565 | { | ||
566 | const volScalarNode& node2 = nodes[pNode2i]; | ||
567 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
568 | const volScalarField& pAbscissa2 = node2.primaryAbscissa(); | ||
569 | |||
570 | aSource += | ||
571 | pWeight1[celli]* | ||
572 | ( | ||
573 | pWeight2[celli]* | ||
574 | ( | ||
575 | 0.5*pow // Birth | ||
576 | ( | ||
577 | pow3(pAbscissa1[celli]) | ||
578 | + pow3(pAbscissa2[celli]), | ||
579 | momentOrder/3.0 | ||
580 | ) | ||
581 | - pow(pAbscissa1[celli], momentOrder) | ||
582 | )*aggregationKernel_->Ka | ||
583 | ( | ||
584 | pAbscissa1[celli], | ||
585 | pAbscissa2[celli], | ||
586 | celli, | ||
587 | environment | ||
588 | ) | ||
589 | ); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | return aSource; | ||
594 | } | ||
595 | 322 | ||
596 | forAll(nodes, pNode1i) // Extended quadrature case | ||
597 | { | ||
598 | const volScalarNode& node1 = nodes[pNode1i]; | ||
599 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
600 | |||
601 | forAll(node1.secondaryWeights(), sNode1i) | ||
602 | { | ||
603 | const volScalarField& sWeight1 = node1.secondaryWeights()[sNode1i]; | ||
604 | |||
605 | const volScalarField& sAbscissa1 | ||
606 | = node1.secondaryAbscissae()[sNode1i]; | ||
607 | |||
608 | forAll(nodes, pNode2i) | ||
609 | { | ||
610 | const volScalarNode& node2 = nodes[pNode2i]; | ||
611 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
612 | |||
613 | forAll(node2.secondaryWeights(), sNode2i) | ||
614 | { | ||
615 | const volScalarField& sWeight2 | ||
616 | = node2.secondaryWeights()[sNode2i]; | ||
617 | |||
618 | const volScalarField& sAbscissa2 | ||
619 | = node2.secondaryAbscissae()[sNode2i]; | ||
620 | |||
621 | aSource += | ||
622 | pWeight1[celli]*sWeight1[celli]* | ||
623 | ( | ||
624 | pWeight2[celli]*sWeight2[celli]* | ||
625 | ( | ||
626 | 0.5*pow // Birth | ||
627 | ( | ||
628 | pow3(sAbscissa1[celli]) | ||
629 | + pow3(sAbscissa2[celli]), | ||
630 | momentOrder/3.0 | ||
631 | ) | ||
632 | - pow(sAbscissa1[celli], momentOrder) | ||
633 | )*aggregationKernel_->Ka | ||
634 | ( | ||
635 | sAbscissa1[celli], | ||
636 | sAbscissa2[celli], | ||
637 | celli, | ||
638 | environment | ||
639 | ) | ||
640 | ); | ||
641 | } | ||
642 | } | ||
643 | } | ||
644 | } | ||
323 | void | ||
324 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | ||
325 | ::updateCellMomentSource(const label) | ||
326 | {} | ||
645 | 327 | ||
646 | return aSource; | ||
647 | } | ||
648 | 328 | ||
649 | 329 | Foam::scalar | Foam::scalar |
650 | 330 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance |
651 | ::breakupSource | ||
331 | ::cellMomentSource | ||
652 | 332 | ( | ( |
653 | const label momentOrder, | ||
333 | const labelList& momentOrder, | ||
654 | 334 | const label celli, | const label celli, |
655 | const mappedPtrList<volScalarNode>& nodes, | ||
335 | const scalarQuadratureApproximation& quadrature, | ||
656 | 336 | const label environment | const label environment |
657 | 337 | ) | ) |
658 | 338 | { | { |
659 | scalar bSource = 0.0; | ||
660 | |||
661 | if (!breakup_) | ||
662 | { | ||
663 | return bSource; | ||
664 | } | ||
665 | |||
666 | if (!nodes[0].extended()) | ||
667 | { | ||
668 | forAll(nodes, pNodeI) | ||
669 | { | ||
670 | const volScalarNode& node = nodes[pNodeI]; | ||
671 | |||
672 | bSource += node.primaryWeight()[celli] | ||
673 | *breakupKernel_->Kb(node.primaryAbscissa()[celli], celli) | ||
674 | *( | ||
675 | daughterDistribution_->mD //Birth | ||
676 | ( | ||
677 | momentOrder, | ||
678 | node.primaryAbscissa()[celli] | ||
679 | ) | ||
680 | - pow(node.primaryAbscissa()[celli], momentOrder) //Death | ||
681 | ); | ||
682 | } | ||
683 | |||
684 | return bSource; | ||
685 | } | ||
686 | |||
687 | forAll(nodes, pNodeI) | ||
339 | scalar source = 0.0; | ||
340 | if (aggregation_) | ||
688 | 341 | { | { |
689 | const volScalarNode& node = nodes[pNodeI]; | ||
690 | |||
691 | forAll(node.secondaryWeights(), sNodei) | ||
692 | { | ||
693 | bSource += node.primaryWeight()[celli] | ||
694 | *node.secondaryWeights()[sNodei][celli] | ||
695 | *breakupKernel_->Kb | ||
696 | ( | ||
697 | node.secondaryAbscissae()[sNodei][celli], celli | ||
698 | ) | ||
699 | *( | ||
700 | daughterDistribution_->mD //Birth | ||
701 | ( | ||
702 | momentOrder, | ||
703 | node.secondaryAbscissae()[sNodei][celli] | ||
704 | ) //Death | ||
705 | - pow(node.secondaryAbscissae()[sNodei][celli], momentOrder) | ||
706 | ); | ||
707 | } | ||
342 | source += | ||
343 | aggregationKernel_->aggregationSource | ||
344 | ( | ||
345 | momentOrder, | ||
346 | celli, | ||
347 | quadrature, | ||
348 | environment | ||
349 | ); | ||
708 | 350 | } | } |
709 | |||
710 | return bSource; | ||
711 | } | ||
712 | |||
713 | Foam::tmp<fvScalarMatrix> Foam::PDFTransportModels::populationBalanceModels | ||
714 | ::mixingPopulationBalance::momentDiffusion | ||
715 | ( | ||
716 | const volUnivariateMoment& moment | ||
717 | ) | ||
718 | { | ||
719 | return diffusionModel_->momentDiff(moment); | ||
720 | } | ||
721 | |||
722 | Foam::scalar | ||
723 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | ||
724 | ::phaseSpaceConvection | ||
725 | ( | ||
726 | const label momentOrder, | ||
727 | const label celli, | ||
728 | const mappedPtrList<volScalarNode>& nodes, | ||
729 | const label environment | ||
730 | ) | ||
731 | { | ||
732 | scalar gSource = 0.0; | ||
733 | |||
734 | if (!growth_ || momentOrder < 1) | ||
351 | if (breakup_) | ||
735 | 352 | { | { |
736 | return gSource; | ||
353 | source += | ||
354 | breakupKernel_->breakupSource | ||
355 | ( | ||
356 | momentOrder, | ||
357 | celli, | ||
358 | quadrature | ||
359 | ); | ||
737 | 360 | } | } |
738 | |||
739 | if (!nodes[0].extended()) | ||
361 | if (growth_) | ||
740 | 362 | { | { |
741 | forAll(nodes, pNodeI) | ||
742 | { | ||
743 | const volScalarNode& node = nodes[pNodeI]; | ||
744 | |||
745 | gSource += node.primaryWeight()[celli] | ||
746 | *growthModel_->Kg(node.primaryAbscissa()[celli]) | ||
747 | *momentOrder*pow | ||
748 | ( | ||
749 | node.primaryAbscissa()[celli], momentOrder - 1 | ||
750 | ); | ||
751 | } | ||
752 | |||
753 | return gSource; | ||
363 | source += | ||
364 | growthModel_->phaseSpaceConvection | ||
365 | ( | ||
366 | momentOrder, | ||
367 | celli, | ||
368 | quadrature | ||
369 | ); | ||
754 | 370 | } | } |
755 | |||
756 | forAll(nodes, pNodeI) | ||
371 | if (nucleation_) | ||
757 | 372 | { | { |
758 | const volScalarNode& node = nodes[pNodeI]; | ||
759 | |||
760 | forAll(node.secondaryWeights(), sNodei) | ||
761 | { | ||
762 | gSource += node.primaryWeight()[celli] | ||
763 | *node.secondaryWeights()[sNodei][celli] | ||
764 | *growthModel_->Kg(node.secondaryAbscissae()[sNodei][celli]) | ||
765 | *momentOrder*pow | ||
766 | ( | ||
767 | node.secondaryAbscissae()[sNodei][celli], | ||
768 | momentOrder - 1 | ||
769 | ); | ||
770 | } | ||
373 | source += nucleationModel_->nucleationSource(momentOrder[0], celli); | ||
771 | 374 | } | } |
772 | 375 | ||
773 | return gSource; | ||
774 | } | ||
775 | |||
776 | Foam::scalar | ||
777 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | ||
778 | ::cellMomentSource | ||
779 | ( | ||
780 | label momentOrder, | ||
781 | label celli, | ||
782 | const mappedPtrList<volScalarNode>& nodes, | ||
783 | const label environment | ||
784 | ) | ||
785 | { | ||
786 | return aggregationSource(momentOrder, celli, nodes, environment) | ||
787 | + breakupSource(momentOrder, celli, nodes, environment) | ||
788 | + nucleationModel_->nucleationSource(momentOrder, celli) | ||
789 | + phaseSpaceConvection(momentOrder, celli, nodes, environment); | ||
376 | return source; | ||
790 | 377 | } | } |
791 | 378 | ||
792 | Foam::scalar | ||
379 | Foam::scalar | ||
793 | 380 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance |
794 | 381 | ::realizableCo() const | ::realizableCo() const |
795 | 382 | { | { |
... | ... | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
801 | 388 | ); | ); |
802 | 389 | } | } |
803 | 390 | ||
804 | Foam::scalar | ||
391 | |||
392 | Foam::scalar | ||
805 | 393 | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance |
806 | 394 | ::CoNum() const | ::CoNum() const |
807 | 395 | { | { |
808 | 396 | return 0.0; | return 0.0; |
809 | 397 | } | } |
810 | 398 | ||
399 | |||
811 | 400 | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance |
812 | 401 | ::solve() | ::solve() |
813 | 402 | { | { |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
837 | 426 | // Solve moment transport equations | // Solve moment transport equations |
838 | 427 | forAll(meanMomentsQuadrature_.moments(), momenti) | forAll(meanMomentsQuadrature_.moments(), momenti) |
839 | 428 | { | { |
840 | volUnivariateMoment& meanM | ||
429 | volScalarMoment& meanM | ||
841 | 430 | ( | ( |
842 | 431 | meanMomentsQuadrature_.moments()[momenti] | meanMomentsQuadrature_.moments()[momenti] |
843 | 432 | ); | ); |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
849 | 438 | ( | ( |
850 | 439 | fvm::ddt(meanM) | fvm::ddt(meanM) |
851 | 440 | + meanMomentsAdvection_().divMoments()[momenti] | + meanMomentsAdvection_().divMoments()[momenti] |
852 | - momentDiffusion(meanM) | ||
441 | - diffusionModel_->momentDiff(meanM) | ||
853 | 442 | ) | ) |
854 | 443 | ); | ); |
855 | 444 | ||
856 | volUnivariateMoment& varM | ||
445 | volScalarMoment& varM | ||
857 | 446 | ( | ( |
858 | 447 | meanMomentsVarianceQuadrature_.moments()[momenti] | meanMomentsVarianceQuadrature_.moments()[momenti] |
859 | 448 | ); | ); |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
865 | 454 | ( | ( |
866 | 455 | fvm::ddt(varM) | fvm::ddt(varM) |
867 | 456 | + meanMomentsVarianceAdvection_().divMoments()[momenti] | + meanMomentsVarianceAdvection_().divMoments()[momenti] |
868 | - momentDiffusion(varM) | ||
457 | - diffusionModel_->momentDiff(varM) | ||
869 | 458 | == | == |
870 | 459 | envMixingModel_->K | envMixingModel_->K |
871 | 460 | ( | ( |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
881 | 470 | calcEnvironmentMoments(); | calcEnvironmentMoments(); |
882 | 471 | ||
883 | 472 | // Solve source terms | // Solve source terms |
884 | explicitMomentSource(envOneQuadrature_, 1); | ||
885 | explicitMomentSource(envTwoQuadrature_, 2); | ||
473 | odeType::solve(envOneQuadrature_, 1); | ||
474 | odeType::solve(envTwoQuadrature_, 2); | ||
886 | 475 | ||
887 | 476 | // Update mixed moments | // Update mixed moments |
888 | 477 | calcMixedMoments(); | calcMixedMoments(); |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
890 | 479 | // Finish solving for moments | // Finish solving for moments |
891 | 480 | forAll (meanMomentEqns, mEqni) | forAll (meanMomentEqns, mEqni) |
892 | 481 | { | { |
893 | const volUnivariateMoment& meanM | ||
482 | const volScalarMoment& meanM | ||
894 | 483 | ( | ( |
895 | 484 | meanMomentsQuadrature_.moments()[mEqni] | meanMomentsQuadrature_.moments()[mEqni] |
896 | 485 | ); | ); |
897 | 486 | ||
898 | const volUnivariateMoment& varM | ||
487 | const volScalarMoment& varM | ||
899 | 488 | ( | ( |
900 | 489 | meanMomentsVarianceQuadrature_.moments()[mEqni] | meanMomentsVarianceQuadrature_.moments()[mEqni] |
901 | 490 | ); | ); |
... | ... | void Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | |
907 | 496 | meanMomentVarianceEqns[mEqni].solve(); | meanMomentVarianceEqns[mEqni].solve(); |
908 | 497 | ||
909 | 498 | meanMomentEqns[mEqni].relax(); | meanMomentEqns[mEqni].relax(); |
910 | meanMomentEqns[mEqni].solve(); | ||
499 | meanMomentEqns[mEqni].solve(); | ||
911 | 500 | } | } |
912 | 501 | ||
913 | 502 | meanMomentsQuadrature_.updateQuadrature(); | meanMomentsQuadrature_.updateQuadrature(); |
914 | 503 | meanMomentsVarianceQuadrature_.updateQuadrature(); | meanMomentsVarianceQuadrature_.updateQuadrature(); |
915 | 504 | } | } |
916 | 505 | ||
506 | |||
507 | bool Foam::PDFTransportModels::populationBalanceModels::mixingPopulationBalance | ||
508 | ::readIfModified() | ||
509 | { | ||
510 | if (populationBalanceProperties_.modified()) | ||
511 | { | ||
512 | odeType::read | ||
513 | ( | ||
514 | populationBalanceProperties_.subDict(type() + "Coeffs") | ||
515 | ); | ||
516 | return true; | ||
517 | } | ||
518 | |||
519 | return false; | ||
520 | } | ||
521 | |||
917 | 522 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/mixingPopulationBalance/mixingPopulationBalance.H changed (mode: 100644) (index 0966a53..f329dbb) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
46 | 46 | #include "diffusionModel.H" | #include "diffusionModel.H" |
47 | 47 | #include "nucleationModel.H" | #include "nucleationModel.H" |
48 | 48 | #include "environmentMixingModel.H" | #include "environmentMixingModel.H" |
49 | #include "realizableOdeSolver.H" | ||
49 | 50 | ||
50 | 51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
51 | 52 | ||
... | ... | namespace populationBalanceModels | |
62 | 63 | ||
63 | 64 | class mixingPopulationBalance | class mixingPopulationBalance |
64 | 65 | : | : |
65 | public populationBalanceModel | ||
66 | public populationBalanceModel, | ||
67 | private realizableOdeSolver<volScalarMoment, volScalarNode> | ||
66 | 68 | { | { |
67 | // Private data | ||
68 | |||
69 | //- Absolute tolerance for realizable ODE solver | ||
70 | scalar ATol_; | ||
71 | |||
72 | //- Relative tolerance for realizable ODE solver | ||
73 | scalar RTol_; | ||
74 | |||
75 | //- Time-step change factor | ||
76 | scalar fac_; | ||
69 | typedef realizableOdeSolver<volScalarMoment, volScalarNode> odeType; | ||
77 | 70 | ||
78 | //- Minimum time-step change factor | ||
79 | scalar facMin_; | ||
80 | |||
81 | //- Maximum time-step change factor | ||
82 | scalar facMax_; | ||
83 | |||
84 | //- Minimum local step in realizable ODE solver | ||
85 | scalar minLocalDt_; | ||
86 | |||
87 | //- Name of the mixingPopulationBalance | ||
88 | const word name_; | ||
71 | // Private data | ||
89 | 72 | ||
90 | 73 | //- Turbulent mixing model | //- Turbulent mixing model |
91 | 74 | autoPtr | autoPtr |
... | ... | class mixingPopulationBalance | |
115 | 98 | const volScalarField& meanXi_; | const volScalarField& meanXi_; |
116 | 99 | ||
117 | 100 | //- Quadrature for the mean moments | //- Quadrature for the mean moments |
118 | univariateQuadratureApproximation meanMomentsQuadrature_; | ||
101 | scalarQuadratureApproximation meanMomentsQuadrature_; | ||
119 | 102 | ||
120 | 103 | //- Quadrature for the mean moment variance | //- Quadrature for the mean moment variance |
121 | univariateQuadratureApproximation meanMomentsVarianceQuadrature_; | ||
104 | scalarQuadratureApproximation meanMomentsVarianceQuadrature_; | ||
122 | 105 | ||
123 | 106 | //- Moment advection for mean moments | //- Moment advection for mean moments |
124 | 107 | autoPtr<univariateMomentAdvection> meanMomentsAdvection_; | autoPtr<univariateMomentAdvection> meanMomentsAdvection_; |
... | ... | class mixingPopulationBalance | |
127 | 110 | autoPtr<univariateMomentAdvection> meanMomentsVarianceAdvection_; | autoPtr<univariateMomentAdvection> meanMomentsVarianceAdvection_; |
128 | 111 | ||
129 | 112 | //- Mean moments | //- Mean moments |
130 | volUnivariateMomentFieldSet& meanMoments_; | ||
113 | volScalarMomentFieldSet& meanMoments_; | ||
131 | 114 | ||
132 | 115 | //- Variance of mean moments | //- Variance of mean moments |
133 | volUnivariateMomentFieldSet& meanMomentsVariance_; | ||
116 | volScalarMomentFieldSet& meanMomentsVariance_; | ||
134 | 117 | ||
135 | 118 | //- Quadrature approximation of the PBE in the first environment | //- Quadrature approximation of the PBE in the first environment |
136 | univariateQuadratureApproximation envOneQuadrature_; | ||
119 | scalarQuadratureApproximation envOneQuadrature_; | ||
137 | 120 | ||
138 | 121 | //- Quadrature approximation of the PBE in the second environment | //- Quadrature approximation of the PBE in the second environment |
139 | univariateQuadratureApproximation envTwoQuadrature_; | ||
122 | scalarQuadratureApproximation envTwoQuadrature_; | ||
140 | 123 | ||
141 | 124 | //- Reference to moments in environment one | //- Reference to moments in environment one |
142 | volUnivariateMomentFieldSet& mEnvOne_; | ||
125 | volScalarMomentFieldSet& mEnvOne_; | ||
143 | 126 | ||
144 | 127 | //- Reference to moments in environment two | //- Reference to moments in environment two |
145 | volUnivariateMomentFieldSet& mEnvTwo_; | ||
128 | volScalarMomentFieldSet& mEnvTwo_; | ||
146 | 129 | ||
147 | 130 | //- Switch indicating the status of the aggregation model | //- Switch indicating the status of the aggregation model |
148 | 131 | Switch aggregation_; | Switch aggregation_; |
... | ... | class mixingPopulationBalance | |
153 | 136 | //- Switch indicating the status of the growth model | //- Switch indicating the status of the growth model |
154 | 137 | Switch growth_; | Switch growth_; |
155 | 138 | ||
139 | //- Switch indicating the status of the nucleation model | ||
140 | Switch nucleation_; | ||
141 | |||
156 | 142 | //- Aggregation kernel model | //- Aggregation kernel model |
157 | 143 | autoPtr | autoPtr |
158 | 144 | < | < |
... | ... | class mixingPopulationBalance | |
165 | 151 | Foam::populationBalanceSubModels::breakupKernel | Foam::populationBalanceSubModels::breakupKernel |
166 | 152 | > breakupKernel_; | > breakupKernel_; |
167 | 153 | ||
168 | //- Daughter distribution function | ||
169 | autoPtr | ||
170 | < | ||
171 | Foam::populationBalanceSubModels::daughterDistribution | ||
172 | > daughterDistribution_; | ||
173 | |||
174 | 154 | //- Growth model function | //- Growth model function |
175 | 155 | autoPtr | autoPtr |
176 | 156 | < | < |
... | ... | class mixingPopulationBalance | |
198 | 178 | ||
199 | 179 | // Private member functions | // Private member functions |
200 | 180 | ||
201 | //- Calculate explicit source terms with realizable ODE solver | ||
202 | void explicitMomentSource | ||
203 | ( | ||
204 | univariateQuadratureApproximation& quadrature, | ||
205 | const label environment | ||
206 | ); | ||
207 | |||
208 | 181 | //- Calculate moments of the PBE in each environment | //- Calculate moments of the PBE in each environment |
209 | 182 | void calcEnvironmentMoments(); | void calcEnvironmentMoments(); |
210 | 183 | ||
211 | 184 | //- Calculated mixed moments | //- Calculated mixed moments |
212 | 185 | void calcMixedMoments(); | void calcMixedMoments(); |
213 | 186 | ||
214 | //- Calculate aggregation source terms | ||
215 | scalar aggregationSource | ||
216 | ( | ||
217 | const label momentOrder, | ||
218 | const label celli, | ||
219 | const Foam::mappedPtrList<volScalarNode>& nodes, | ||
220 | const label environment | ||
221 | ); | ||
222 | |||
223 | //- Calculate Breakup source term | ||
224 | scalar breakupSource | ||
225 | ( | ||
226 | const label momentOrder, | ||
227 | const label celli, | ||
228 | const Foam::mappedPtrList<volScalarNode>& nodes, | ||
229 | const label environment | ||
230 | ); | ||
231 | |||
232 | //- Diffusion term | ||
233 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
234 | ( | ||
235 | const volUnivariateMoment& moment | ||
236 | ); | ||
237 | |||
238 | //- Convect moments in phase space | ||
239 | virtual scalar phaseSpaceConvection | ||
240 | ( | ||
241 | const label momentOrder, | ||
242 | const label celli, | ||
243 | const Foam::mappedPtrList<volScalarNode>& nodes, | ||
244 | const label environment | ||
245 | ); | ||
187 | //- Update explicit collison source terms | ||
188 | virtual void updateCellMomentSource(const label celli); | ||
246 | 189 | ||
247 | 190 | //- Calculate source term for moment equation in the specified cell | //- Calculate source term for moment equation in the specified cell |
248 | scalar cellMomentSource | ||
191 | virtual scalar cellMomentSource | ||
249 | 192 | ( | ( |
250 | label momentOrder, | ||
251 | label celli, | ||
252 | const Foam::mappedPtrList<volScalarNode>& nodes, | ||
253 | const label environment | ||
193 | const labelList& momentOrder, | ||
194 | const label celli, | ||
195 | const scalarQuadratureApproximation& nodes, | ||
196 | const label enviroment | ||
254 | 197 | ); | ); |
255 | 198 | ||
256 | 199 | ||
... | ... | public: | |
284 | 227 | ||
285 | 228 | //- Solve population balance equation | //- Solve population balance equation |
286 | 229 | void solve(); | void solve(); |
230 | |||
231 | //- Read | ||
232 | virtual bool readIfModified(); | ||
287 | 233 | }; | }; |
288 | 234 | ||
289 | 235 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.C changed (mode: 100644) (index ddd5fa8..5432a8d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.H changed (mode: 100644) (index 86b83d5..afeb7fa) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/newPopulationBalanceModel.C changed (mode: 100644) (index f80efb8..a15b5d4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/populationBalanceModel.C changed (mode: 100644) (index 43124a9..4311c3b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceModel::populationBalanceModel | |
43 | 43 | const surfaceScalarField& phi | const surfaceScalarField& phi |
44 | 44 | ) | ) |
45 | 45 | : | : |
46 | regIOobject | ||
47 | ( | ||
48 | IOobject | ||
49 | ( | ||
50 | IOobject::groupName("populationBalance", name), | ||
51 | phi.mesh().time().constant(), | ||
52 | phi.mesh(), | ||
53 | IOobject::MUST_READ_IF_MODIFIED, | ||
54 | IOobject::NO_WRITE, | ||
55 | true | ||
56 | ) | ||
57 | ), | ||
46 | 58 | name_(name), | name_(name), |
59 | populationBalanceProperties_ | ||
60 | ( | ||
61 | phi.mesh().lookupObjectRef<IOdictionary>(IOobject::groupName("populationBalanceProperties", name.substr(name.find('.') + 1))) | ||
62 | ), | ||
47 | 63 | phi_(phi) | phi_(phi) |
48 | 64 | {} | {} |
49 | 65 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/populationBalanceModel.H changed (mode: 100644) (index 74a7609..ea0e73b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
35 | 35 | #ifndef populationBalanceModel_H | #ifndef populationBalanceModel_H |
36 | 36 | #define populationBalanceModel_H | #define populationBalanceModel_H |
37 | 37 | ||
38 | #include "dictionary.H" | ||
38 | #include "IOdictionary.H" | ||
39 | #include "fvCFD.H" | ||
39 | 40 | #include "volFields.H" | #include "volFields.H" |
40 | 41 | #include "dimensionedTypes.H" | #include "dimensionedTypes.H" |
41 | 42 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
... | ... | namespace Foam | |
50 | 51 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
51 | 52 | ||
52 | 53 | class populationBalanceModel | class populationBalanceModel |
54 | : | ||
55 | public regIOobject | ||
53 | 56 | { | { |
54 | 57 | // Private data | // Private data |
55 | 58 | ||
56 | 59 | //- Name of the populationBalanceModel | //- Name of the populationBalanceModel |
57 | 60 | const word name_; | const word name_; |
58 | 61 | ||
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 | 62 | ||
68 | 63 | protected: | protected: |
69 | 64 | ||
70 | 65 | // Protected data | // Protected data |
71 | 66 | ||
67 | //- Reference to populationBalanceProperties | ||
68 | // Non-const so ode solver can read on modification | ||
69 | IOdictionary& populationBalanceProperties_; | ||
70 | |||
72 | 71 | //- Fluid-phase face-normal velocity | //- Fluid-phase face-normal velocity |
73 | 72 | const surfaceScalarField& phi_; | const surfaceScalarField& phi_; |
74 | 73 | ||
... | ... | public: | |
103 | 102 | const surfaceScalarField& phi | const surfaceScalarField& phi |
104 | 103 | ); | ); |
105 | 104 | ||
105 | //- Disallow default bitwise copy construct | ||
106 | populationBalanceModel(const populationBalanceModel&) = delete; | ||
107 | |||
106 | 108 | ||
107 | 109 | // Selectors | // Selectors |
108 | 110 | ||
... | ... | public: | |
130 | 132 | //- Solve population balance equation | //- Solve population balance equation |
131 | 133 | virtual void solve() = 0; | virtual void solve() = 0; |
132 | 134 | ||
135 | |||
136 | // regIOobject functions | ||
137 | |||
138 | //- Read | ||
139 | virtual bool readIfModified() | ||
140 | { | ||
141 | return true; | ||
142 | } | ||
143 | |||
144 | //- Read | ||
145 | virtual bool writeData(Ostream&) const | ||
146 | { | ||
147 | return true; | ||
148 | } | ||
149 | |||
150 | |||
151 | // Member Operators | ||
152 | |||
153 | //- Disallow default bitwise assignment | ||
154 | void operator=(const populationBalanceModel&) = delete; | ||
133 | 155 | }; | }; |
134 | 156 | ||
135 | 157 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C changed (mode: 100644) (index 97d7411..c45871f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Brownian | |
58 | 58 | ) | ) |
59 | 59 | : | : |
60 | 60 | aggregationKernel(dict, mesh), | aggregationKernel(dict, mesh), |
61 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
61 | continuousPhase_(dict.lookupOrDefault("continuousPhase", word::null)), | ||
62 | flThermo_ | ||
63 | ( | ||
64 | mesh_.lookupObject<fluidThermo> | ||
65 | ( | ||
66 | IOobject::groupName(basicThermo::dictName, continuousPhase_) | ||
67 | ) | ||
68 | ), | ||
62 | 69 | T_(flThermo_.T()), | T_(flThermo_.T()), |
63 | 70 | mu_(flThermo_.mu()) | mu_(flThermo_.mu()) |
64 | 71 | {} | {} |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Brownian | |
76 | 83 | Foam::scalar | Foam::scalar |
77 | 84 | Foam::populationBalanceSubModels::aggregationKernels::Brownian::Ka | Foam::populationBalanceSubModels::aggregationKernels::Brownian::Ka |
78 | 85 | ( | ( |
79 | const scalar& abscissa1, | ||
80 | const scalar& abscissa2, | ||
86 | const scalar& d1, | ||
87 | const scalar& d2, | ||
88 | const vector& Ur, | ||
81 | 89 | const label celli, | const label celli, |
82 | 90 | const label environment | const label environment |
83 | 91 | ) const | ) const |
84 | 92 | { | { |
85 | 93 | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] |
86 | *sqr(abscissa1 + abscissa2)/(3.0*mu_[celli] | ||
87 | *max(abscissa1*abscissa2, SMALL)); | ||
94 | *sqr(d1 + d2)/(3.0*mu_[celli] | ||
95 | *max(d1*d2, small)); | ||
88 | 96 | } | } |
89 | 97 | ||
90 | 98 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.H changed (mode: 100644) (index ee4b8c1..d57069a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class Brownian | |
80 | 80 | { | { |
81 | 81 | //- Private data | //- Private data |
82 | 82 | ||
83 | //- Continuous phase name | ||
84 | const word continuousPhase_; | ||
85 | |||
83 | 86 | //- Thermo model | //- Thermo model |
84 | 87 | const fluidThermo& flThermo_; | const fluidThermo& flThermo_; |
85 | 88 | ||
... | ... | public: | |
115 | 118 | //- Aggregation kernel | //- Aggregation kernel |
116 | 119 | virtual scalar Ka | virtual scalar Ka |
117 | 120 | ( | ( |
118 | const scalar& abscissa1, | ||
119 | const scalar& abscissa2, | ||
121 | const scalar& d1, | ||
122 | const scalar& d2, | ||
123 | const vector& Ur, | ||
120 | 124 | const label celli, | const label celli, |
121 | 125 | const label environment = 0 | const label environment = 0 |
122 | 126 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Grimes/Grimes.C changed (mode: 100644) (index 01424c6..328cbf0) | |||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Grimes | |
59 | 59 | thisPhaseName_(dict.lookup("thisPhaseName")), | thisPhaseName_(dict.lookup("thisPhaseName")), |
60 | 60 | contPhaseName_(dict.lookup("contPhaseName")), | contPhaseName_(dict.lookup("contPhaseName")), |
61 | 61 | //thisPhase_(thisPhaseName_, phaseDict_, mesh), | //thisPhase_(thisPhaseName_, phaseDict_, mesh), |
62 | thisPhaseDict_(mesh_.lookupObject<IOdictionary>("transportProperties").subDict(thisPhaseName_)), | ||
63 | contPhaseDict_(mesh_.lookupObject<IOdictionary>("transportProperties").subDict(contPhaseName_)), | ||
62 | thisPhaseDict_(mesh_.lookupObject<IOdictionary>("transportProperties").subDict("phases").subDict(thisPhaseName_)), | ||
63 | contPhaseDict_(mesh_.lookupObject<IOdictionary>("transportProperties").subDict("phases").subDict(contPhaseName_)), | ||
64 | 64 | Kcr_(dict.lookupOrDefault<scalar>("Kcr", 1.0)), | Kcr_(dict.lookupOrDefault<scalar>("Kcr", 1.0)), |
65 | 65 | Ksv_(dict.lookupOrDefault<scalar>("Ksv", 5.0)), | Ksv_(dict.lookupOrDefault<scalar>("Ksv", 5.0)), |
66 | 66 | Kce_(dict.lookupOrDefault<scalar>("Kce", 0.5)), | Kce_(dict.lookupOrDefault<scalar>("Kce", 0.5)), |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Grimes | |
80 | 80 | ) | ) |
81 | 81 | ), | ), |
82 | 82 | nuC_(readScalar(contPhaseDict_.lookup("nu"))), | nuC_(readScalar(contPhaseDict_.lookup("nu"))), |
83 | gamma_(readScalar(thisPhaseDict_.lookup("gamma"))) | ||
83 | gamma_(readScalar(thisPhaseDict_.lookup("gamma"))), | ||
84 | ifPorous_ | ||
85 | ( | ||
86 | mesh_.lookupObject<volScalarField>("ifPorous") | ||
87 | ) | ||
84 | 88 | {} | {} |
85 | 89 | ||
86 | 90 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Grimes | |
96 | 100 | Foam::scalar | Foam::scalar |
97 | 101 | Foam::populationBalanceSubModels::aggregationKernels::Grimes::Ka | Foam::populationBalanceSubModels::aggregationKernels::Grimes::Ka |
98 | 102 | ( | ( |
99 | const scalar& abscissa1, | ||
100 | const scalar& abscissa2, | ||
103 | const scalar& d1, | ||
104 | const scalar& d2, | ||
105 | const vector& Ur, | ||
101 | 106 | const label celli, | const label celli, |
102 | 107 | const label environment | const label environment |
103 | 108 | ) const | ) const |
104 | 109 | { | { |
105 | 110 | //- Evaluate volumes of colliding droplets | //- Evaluate volumes of colliding droplets |
106 | scalar v1_(Foam::constant::mathematical::pi*pow(abscissa1,3.0)/6.0); | ||
107 | scalar v2_(Foam::constant::mathematical::pi*pow(abscissa2,3.0)/6.0); | ||
111 | scalar v1_(Foam::constant::mathematical::pi*pow(d1,3.0)/6.0); | ||
112 | scalar v2_(Foam::constant::mathematical::pi*pow(d2,3.0)/6.0); | ||
108 | 113 | ||
109 | 114 | //- Evaluate useful expressions | //- Evaluate useful expressions |
110 | 115 | scalar vSum_ = pow(v1_,1.0/3.0) + pow(v2_,1.0/3.0); | scalar vSum_ = pow(v1_,1.0/3.0) + pow(v2_,1.0/3.0); |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Grimes::Ka | |
138 | 143 | //if (std::fabs(Urelative_ - 0.00025) > SMALL) | //if (std::fabs(Urelative_ - 0.00025) > SMALL) |
139 | 144 | // Urelative_ = 0.00025; | // Urelative_ = 0.00025; |
140 | 145 | ||
141 | return Ca_.value() | ||
142 | *omega_ | ||
143 | *exp(-t_bc/Kce_); | ||
146 | scalar aggregationK | ||
147 | = max | ||
148 | ( | ||
149 | (Ca_.value() | ||
150 | *omega_ | ||
151 | *(ifPorous_[celli]*1.0 + (1.0 - ifPorous_[celli])*exp(-t_bc/Kce_)) | ||
152 | ) | ||
153 | , | ||
154 | 0.0 | ||
155 | ); | ||
156 | |||
157 | return aggregationK; | ||
144 | 158 | } | } |
145 | 159 | ||
146 | 160 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Grimes/Grimes.H changed (mode: 100644) (index 8d2c493..84283c2) | |||
... | ... | private: | |
121 | 121 | scalar nuC_; | scalar nuC_; |
122 | 122 | ||
123 | 123 | //- Surface tension of the phase pair | //- Surface tension of the phase pair |
124 | scalar gamma_; | ||
124 | scalar gamma_; | ||
125 | |||
126 | //- Porosity field | ||
127 | const volScalarField& ifPorous_; | ||
125 | 128 | ||
126 | 129 | ||
127 | 130 | public: | public: |
... | ... | public: | |
149 | 152 | //- Coalescence kernel | //- Coalescence kernel |
150 | 153 | virtual scalar Ka | virtual scalar Ka |
151 | 154 | ( | ( |
152 | const scalar& abscissa1, | ||
153 | const scalar& abscissa2, | ||
155 | const scalar& d1, | ||
156 | const scalar& d2, | ||
157 | const vector& Ur, | ||
154 | 158 | const label celli, | const label celli, |
155 | 159 | const label environment = 0 | const label environment = 0 |
156 | 160 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C changed (mode: 100644) (index 1f61bcb..982420b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::aggregationKernel::~aggregationKernel() | |
65 | 65 | {} | {} |
66 | 66 | ||
67 | 67 | ||
68 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
69 | |||
70 | Foam::scalar | ||
71 | Foam::populationBalanceSubModels::aggregationKernel::nodeSource | ||
72 | ( | ||
73 | const scalar& abscissa1, | ||
74 | const scalar& abscissa2, | ||
75 | const label momentOrder | ||
76 | ) const | ||
77 | { | ||
78 | return | ||
79 | 0.5 | ||
80 | *pow // Birth | ||
81 | ( | ||
82 | pow3(abscissa1) + pow3(abscissa2), | ||
83 | momentOrder/3.0 | ||
84 | ) | ||
85 | - pow(abscissa1, momentOrder); | ||
86 | } | ||
87 | |||
88 | |||
89 | Foam::scalar | ||
90 | Foam::populationBalanceSubModels::aggregationKernel::massNodeSource | ||
91 | ( | ||
92 | const scalar& abscissa1, | ||
93 | const scalar& abscissa2, | ||
94 | const label momentOrder | ||
95 | ) const | ||
96 | { | ||
97 | return | ||
98 | 0.5 | ||
99 | *pow // Birth | ||
100 | ( | ||
101 | abscissa1 + abscissa2, | ||
102 | momentOrder | ||
103 | ) | ||
104 | - pow(abscissa1, momentOrder); | ||
105 | } | ||
106 | |||
107 | |||
108 | Foam::scalar | ||
109 | Foam::populationBalanceSubModels::aggregationKernel::aggregationSource | ||
110 | ( | ||
111 | const labelList& momentOrder, | ||
112 | const label celli, | ||
113 | const scalarQuadratureApproximation& quadrature, | ||
114 | const label enviroment | ||
115 | ) | ||
116 | { | ||
117 | scalar aSource = 0.0; | ||
118 | |||
119 | const PtrList<volScalarNode>& nodes = quadrature.nodes(); | ||
120 | bool lengthBased = nodes[0].lengthBased(); | ||
121 | label sizeIndex = nodes[0].sizeIndex(); | ||
122 | |||
123 | if (sizeIndex == -1) | ||
124 | { | ||
125 | return aSource; | ||
126 | } | ||
127 | |||
128 | label sizeOrder = momentOrder[sizeIndex]; | ||
129 | bool volumeFraction = nodes[0].useVolumeFraction(); | ||
130 | if (volumeFraction) | ||
131 | { | ||
132 | if (lengthBased) | ||
133 | { | ||
134 | sizeOrder += 3; | ||
135 | } | ||
136 | else | ||
137 | { | ||
138 | sizeOrder += 1; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
143 | |||
144 | if (!nodes[0].extended()) // Non-extended quadrature case | ||
145 | { | ||
146 | forAll(nodes, pNode1i) | ||
147 | { | ||
148 | const volScalarNode& node1 = nodes[pNode1i]; | ||
149 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
150 | const PtrList<volScalarField>& pAbscissae1 = node1.primaryAbscissae(); | ||
151 | scalar bAbscissa1 = | ||
152 | max(node1.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
153 | scalar d1 = node1.d(celli, bAbscissa1); | ||
154 | scalar n1 = node1.n(celli, pWeight1[celli], bAbscissa1); | ||
155 | |||
156 | scalar aSourcei = 0.0; | ||
157 | |||
158 | forAll(nodes, pNode2i) | ||
159 | { | ||
160 | const volScalarNode& node2 = nodes[pNode2i]; | ||
161 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
162 | // Remove small negative values in abscissae | ||
163 | scalar bAbscissa2 = | ||
164 | max(node2.primaryAbscissae()[sizeIndex][celli],0.0); | ||
165 | scalar d2 = node2.d(celli, bAbscissa2); | ||
166 | scalar n2 = node2.n(celli, pWeight2[celli], bAbscissa2); | ||
167 | |||
168 | |||
169 | scalar aSrc = 0.0; | ||
170 | if (lengthBased) | ||
171 | { | ||
172 | aSrc = nodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
173 | } | ||
174 | else | ||
175 | { | ||
176 | aSrc = massNodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
177 | } | ||
178 | |||
179 | aSrc *= n1*n2*Ka(d1, d2, Zero, celli, enviroment); | ||
180 | |||
181 | aSourcei += aSrc; | ||
182 | } | ||
183 | |||
184 | forAll(scalarIndexes, cmpt) | ||
185 | { | ||
186 | if (scalarIndexes[cmpt] != sizeIndex) | ||
187 | { | ||
188 | aSourcei *= | ||
189 | pow | ||
190 | ( | ||
191 | pAbscissae1[cmpt][celli], | ||
192 | momentOrder[scalarIndexes[cmpt]] | ||
193 | ); | ||
194 | } | ||
195 | } | ||
196 | aSource += aSourcei; | ||
197 | } | ||
198 | |||
199 | return aSource; | ||
200 | } | ||
201 | |||
202 | forAll(nodes, pNode1i) // Extended quadrature case | ||
203 | { | ||
204 | const volScalarNode& node1 = nodes[pNode1i]; | ||
205 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
206 | |||
207 | forAll(node1.secondaryWeights()[0], sNode1i) | ||
208 | { | ||
209 | const scalar bAbscissa1 = | ||
210 | max(node1.secondaryAbscissae()[sizeIndex][sNode1i][celli], 0.0); | ||
211 | scalar d1 = node1.d(celli, bAbscissa1); | ||
212 | scalar n1 = | ||
213 | node1.n(celli, pWeight1[celli], bAbscissa1) | ||
214 | *node1.secondaryWeights()[sizeIndex][sNode1i][celli]; | ||
215 | |||
216 | scalar aSourcei = 0.0; | ||
217 | |||
218 | forAll(nodes, pNode2i) | ||
219 | { | ||
220 | const volScalarNode& node2 = nodes[pNode2i]; | ||
221 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
222 | |||
223 | forAll(node2.secondaryWeights()[0], sNode2i) | ||
224 | { | ||
225 | scalar bAbscissa2 = | ||
226 | max | ||
227 | ( | ||
228 | node2.secondaryAbscissae()[sizeIndex][sNode2i][celli], 0.0 | ||
229 | ); | ||
230 | scalar d2 = node2.d(celli, bAbscissa2); | ||
231 | scalar n2 = | ||
232 | node2.n(celli, pWeight2[celli], bAbscissa2) | ||
233 | *node2.secondaryWeights()[sizeIndex][sNode2i][celli]; | ||
234 | |||
235 | scalar aSrc = 0.0; | ||
236 | if (lengthBased) | ||
237 | { | ||
238 | aSrc = | ||
239 | nodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | aSrc = | ||
244 | massNodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
245 | } | ||
246 | |||
247 | aSrc *= n1*n2*Ka(d1, d2, Zero, celli, enviroment); | ||
248 | aSourcei += aSrc; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | forAll(scalarIndexes, cmpt) | ||
253 | { | ||
254 | if (scalarIndexes[cmpt] != sizeIndex) | ||
255 | { | ||
256 | aSourcei *= | ||
257 | node1.secondaryWeights()[cmpt][sNode1i][celli] | ||
258 | *pow | ||
259 | ( | ||
260 | node1.secondaryAbscissae()[cmpt][sNode1i][celli], | ||
261 | momentOrder[scalarIndexes[cmpt]] | ||
262 | ); | ||
263 | } | ||
264 | } | ||
265 | aSource += aSourcei; | ||
266 | } | ||
267 | } | ||
268 | |||
269 | return aSource; | ||
270 | } | ||
271 | |||
272 | Foam::scalar | ||
273 | Foam::populationBalanceSubModels::aggregationKernel::aggregationSource | ||
274 | ( | ||
275 | const labelList& momentOrder, | ||
276 | const label celli, | ||
277 | const velocityQuadratureApproximation& quadrature, | ||
278 | const label enviroment | ||
279 | ) | ||
280 | { | ||
281 | scalar aSource = 0.0; | ||
282 | |||
283 | const mappedPtrList<volVelocityNode>& nodes = quadrature.nodes(); | ||
284 | bool lengthBased = nodes[0].lengthBased(); | ||
285 | label sizeIndex = nodes[0].sizeIndex(); | ||
286 | |||
287 | if (sizeIndex == -1) | ||
288 | { | ||
289 | return aSource; | ||
290 | } | ||
291 | |||
292 | label sizeOrder = momentOrder[sizeIndex]; | ||
293 | bool volumeFraction = nodes[0].useVolumeFraction(); | ||
294 | if (volumeFraction) | ||
295 | { | ||
296 | if (lengthBased) | ||
297 | { | ||
298 | sizeOrder += 3; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | sizeOrder += 1; | ||
303 | } | ||
304 | } | ||
305 | |||
306 | label nSizes = quadrature.nNodes()[sizeIndex]; | ||
307 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
308 | const labelList& velocityIndexes = nodes[0].velocityIndexes(); | ||
309 | |||
310 | if (!pureSize()) // Ka is not only a function of size | ||
311 | { | ||
312 | forAll(nodes, pNode1i) | ||
313 | { | ||
314 | const volVelocityNode& node1 = nodes[pNode1i]; | ||
315 | scalar pWeight1 = node1.primaryWeight()[celli]; | ||
316 | scalar bAbscissa1 = | ||
317 | max(node1.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
318 | scalar d1 = node1.d(celli, bAbscissa1); | ||
319 | scalar n1 = node1.n(celli, pWeight1, bAbscissa1); | ||
320 | vector U1 = node1.velocityAbscissae()[celli]; | ||
321 | |||
322 | scalar aSourcei = 0.0; | ||
323 | |||
324 | forAll(nodes, pNode2i) | ||
325 | { | ||
326 | const volVelocityNode& node2 = nodes[pNode2i]; | ||
327 | scalar pWeight2 = node2.primaryWeight()[celli]; | ||
328 | scalar bAbscissa2 = | ||
329 | max(node2.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
330 | scalar d2 = node2.d(celli, bAbscissa2); | ||
331 | scalar n2 = node2.n(celli, pWeight2, bAbscissa2); | ||
332 | vector U2 = node2.velocityAbscissae()[celli]; | ||
333 | |||
334 | scalar aSrc = 0.0; | ||
335 | if (lengthBased) | ||
336 | { | ||
337 | aSrc = nodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
338 | } | ||
339 | else | ||
340 | { | ||
341 | aSrc = massNodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
342 | } | ||
343 | |||
344 | aSrc *= n1*n2*Ka(d1, d2, U1 - U2, celli, enviroment); | ||
345 | aSourcei += aSrc; | ||
346 | |||
347 | } | ||
348 | forAll(scalarIndexes, cmpt) | ||
349 | { | ||
350 | if (scalarIndexes[cmpt] != sizeIndex) | ||
351 | { | ||
352 | aSourcei *= | ||
353 | pow | ||
354 | ( | ||
355 | node1.primaryAbscissae()[cmpt][celli], | ||
356 | momentOrder[scalarIndexes[cmpt]] | ||
357 | ); | ||
358 | } | ||
359 | } | ||
360 | forAll(velocityIndexes, cmpt) | ||
361 | { | ||
362 | aSourcei *= | ||
363 | pow | ||
364 | ( | ||
365 | node1.velocityAbscissae()[celli][cmpt], | ||
366 | momentOrder[velocityIndexes[cmpt]] | ||
367 | ); | ||
368 | } | ||
369 | aSource += aSourcei; | ||
370 | } | ||
371 | |||
372 | return aSource; | ||
373 | } | ||
374 | |||
375 | if (!nodes[0].extended()) // Non-extended quadrature case | ||
376 | { | ||
377 | scalarListList aSources(nSizes, scalarList(nSizes, 0.0)); | ||
378 | for (label sizei = 0; sizei < nSizes; sizei++) | ||
379 | { | ||
380 | const volVelocityNode& node1 = nodes(sizei); | ||
381 | scalar bAbscissa1 = | ||
382 | max(node1.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
383 | scalar d1 = node1.d(celli, bAbscissa1); | ||
384 | |||
385 | for (label sizej = 0; sizej < nSizes; sizej++) | ||
386 | { | ||
387 | const volVelocityNode& node2 = nodes(sizej); | ||
388 | scalar bAbscissa2 = | ||
389 | max(node2.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
390 | scalar d2 = node2.d(celli, bAbscissa2); | ||
391 | |||
392 | if (lengthBased) | ||
393 | { | ||
394 | aSources[sizei][sizej] = | ||
395 | nodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
396 | } | ||
397 | else | ||
398 | { | ||
399 | aSources[sizei][sizej] = | ||
400 | massNodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
401 | } | ||
402 | |||
403 | aSources[sizei][sizej] *= | ||
404 | Ka(d1, d2, Zero, celli, enviroment); | ||
405 | |||
406 | if (volumeFraction) | ||
407 | { | ||
408 | if (lengthBased) | ||
409 | { | ||
410 | aSources[sizei][sizej] /= | ||
411 | pow3(max(bAbscissa1, small)) | ||
412 | *pow3(max(bAbscissa2, small)); | ||
413 | } | ||
414 | else | ||
415 | { | ||
416 | aSources[sizei][sizej] /= | ||
417 | max(bAbscissa1, small) | ||
418 | *max(bAbscissa2, small) ; | ||
419 | } | ||
420 | } | ||
421 | } | ||
422 | } | ||
423 | |||
424 | forAll(nodes, pNode1i) | ||
425 | { | ||
426 | const volVelocityNode& node1 = nodes[pNode1i]; | ||
427 | label sizei = quadrature.nodeIndexes()[pNode1i][sizeIndex]; | ||
428 | scalar aSourcei = 0.0; | ||
429 | |||
430 | forAll(nodes, pNode2i) | ||
431 | { | ||
432 | const volVelocityNode& node2 = nodes[pNode2i]; | ||
433 | label sizej = quadrature.nodeIndexes()[pNode2i][sizeIndex]; | ||
434 | |||
435 | aSourcei += | ||
436 | node1.primaryWeight()[celli] | ||
437 | *node2.primaryWeight()[celli] | ||
438 | *aSources[sizei][sizej]; | ||
439 | |||
440 | } | ||
441 | forAll(scalarIndexes, cmpt) | ||
442 | { | ||
443 | if (scalarIndexes[cmpt] != sizeIndex) | ||
444 | { | ||
445 | aSourcei *= | ||
446 | pow | ||
447 | ( | ||
448 | node1.primaryAbscissae()[cmpt][celli], | ||
449 | momentOrder[scalarIndexes[cmpt]] | ||
450 | ); | ||
451 | } | ||
452 | } | ||
453 | forAll(velocityIndexes, cmpt) | ||
454 | { | ||
455 | aSourcei *= | ||
456 | pow | ||
457 | ( | ||
458 | node1.velocityAbscissae()[celli][cmpt], | ||
459 | momentOrder[velocityIndexes[cmpt]] | ||
460 | ); | ||
461 | } | ||
462 | aSource += aSourcei; | ||
463 | } | ||
464 | |||
465 | return aSource; | ||
466 | } | ||
467 | |||
468 | // Extended quadrature case | ||
469 | label nSecondaryNodes(nodes[0].secondaryWeights().size()); | ||
470 | List<List<scalarListList>> aSources | ||
471 | ( | ||
472 | nSizes, | ||
473 | List<scalarListList> | ||
474 | ( | ||
475 | nSecondaryNodes, | ||
476 | scalarListList(nSizes, scalarList(nSecondaryNodes, 0.0)) | ||
477 | ) | ||
478 | ); | ||
479 | for (label pNode1i = 0; pNode1i < nSizes; pNode1i++) | ||
480 | { | ||
481 | const volVelocityNode& node1 = nodes(pNode1i); | ||
482 | for (label sNode1i = 0; sNode1i < nSecondaryNodes; sNode1i++) | ||
483 | { | ||
484 | scalar bAbscissa1 = | ||
485 | max(node1.secondaryAbscissae()[sizeIndex][sNode1i][celli], 0.0); | ||
486 | scalar d1 = node1.d(celli, bAbscissa1); | ||
487 | |||
488 | for (label pNode2i = 0; pNode2i < nSizes; pNode2i++) | ||
489 | { | ||
490 | const volVelocityNode& node2 = nodes(pNode2i); | ||
491 | for (label sNode2i = 0; sNode2i < nSecondaryNodes; sNode2i++) | ||
492 | { | ||
493 | scalar bAbscissa2 = | ||
494 | max(node2.secondaryAbscissae()[sizeIndex][sNode2i][celli], 0.0); | ||
495 | scalar d2 = node2.d(celli, bAbscissa2); | ||
496 | |||
497 | if (lengthBased) | ||
498 | { | ||
499 | aSources[pNode1i][sNode1i][pNode2i][sNode2i] = | ||
500 | nodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
501 | } | ||
502 | else | ||
503 | { | ||
504 | aSources[pNode1i][sNode1i][pNode2i][sNode2i] = | ||
505 | massNodeSource(bAbscissa1, bAbscissa2, sizeOrder); | ||
506 | } | ||
507 | |||
508 | aSources[pNode1i][sNode1i][pNode2i][sNode2i] *= | ||
509 | Ka(d1, d2, Zero, celli, enviroment); | ||
510 | |||
511 | if (volumeFraction) | ||
512 | { | ||
513 | if (lengthBased) | ||
514 | { | ||
515 | aSources[pNode1i][sNode1i][pNode2i][sNode2i] /= | ||
516 | pow3(max(bAbscissa1, small)) | ||
517 | *pow3(max(bAbscissa2, small)); | ||
518 | } | ||
519 | else | ||
520 | { | ||
521 | aSources[pNode1i][sNode1i][pNode2i][sNode2i] /= | ||
522 | max(bAbscissa1, small) | ||
523 | *max(bAbscissa2, small); | ||
524 | } | ||
525 | } | ||
526 | } | ||
527 | } | ||
528 | } | ||
529 | } | ||
530 | |||
531 | forAll(nodes, pNode1i) | ||
532 | { | ||
533 | const volVelocityNode& node1 = nodes[pNode1i]; | ||
534 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
535 | label sizei = quadrature.nodeIndexes()[pNode1i][sizeIndex]; | ||
536 | |||
537 | scalar aSourcei = 0.0; | ||
538 | forAll(node1.secondaryWeights()[0], sNode1i) | ||
539 | { | ||
540 | forAll(nodes, pNode2i) | ||
541 | { | ||
542 | const volVelocityNode& node2 = nodes[pNode2i]; | ||
543 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
544 | label sizej = quadrature.nodeIndexes()[pNode2i][sizeIndex]; | ||
545 | |||
546 | forAll(node2.secondaryWeights()[0], sNode2i) | ||
547 | { | ||
548 | aSourcei += | ||
549 | pWeight1[celli] | ||
550 | *node1.secondaryWeights()[sizeIndex][sNode1i][celli] | ||
551 | *pWeight2[celli] | ||
552 | *node2.secondaryWeights()[sizeIndex][sNode2i][celli] | ||
553 | *aSources[sizei][sNode1i][sizej][sNode2i]; | ||
554 | } | ||
555 | } | ||
556 | } | ||
557 | forAll(scalarIndexes, cmpt) | ||
558 | { | ||
559 | if (scalarIndexes[cmpt] != sizeIndex) | ||
560 | { | ||
561 | aSourcei *= | ||
562 | pow | ||
563 | ( | ||
564 | node1.primaryAbscissae()[cmpt][celli], | ||
565 | momentOrder[scalarIndexes[cmpt]] | ||
566 | ); | ||
567 | } | ||
568 | } | ||
569 | forAll(velocityIndexes, cmpt) | ||
570 | { | ||
571 | aSourcei *= | ||
572 | pow | ||
573 | ( | ||
574 | node1.velocityAbscissae()[celli][cmpt], | ||
575 | momentOrder[velocityIndexes[cmpt]] | ||
576 | ); | ||
577 | } | ||
578 | aSource += aSourcei; | ||
579 | } | ||
580 | |||
581 | return aSource; | ||
582 | } | ||
583 | |||
68 | 584 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.H changed (mode: 100644) (index 71211c5..0661d56) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
39 | 39 | #include "volFields.H" | #include "volFields.H" |
40 | 40 | #include "dimensionedTypes.H" | #include "dimensionedTypes.H" |
41 | 41 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
42 | #include "quadratureApproximations.H" | ||
42 | 43 | ||
43 | 44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 45 | ||
... | ... | namespace populationBalanceSubModels | |
53 | 54 | ||
54 | 55 | class aggregationKernel | class aggregationKernel |
55 | 56 | { | { |
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 | 57 | protected: | protected: |
66 | 58 | ||
67 | 59 | // Protected data | // Protected data |
... | ... | protected: | |
76 | 68 | const dimensionedScalar Ca_; | const dimensionedScalar Ca_; |
77 | 69 | ||
78 | 70 | ||
71 | // Protected functions | ||
72 | |||
73 | //- Return true if source is only depenent on size | ||
74 | virtual bool pureSize() const | ||
75 | { | ||
76 | return true; | ||
77 | } | ||
78 | |||
79 | //- Length based aggregation source given two abscissae and an order | ||
80 | scalar nodeSource | ||
81 | ( | ||
82 | const scalar& abscissa1, | ||
83 | const scalar& abscissa2, | ||
84 | const label momentOrder | ||
85 | ) const; | ||
86 | |||
87 | //- Mass based aggregation source given two abscissae and an order | ||
88 | scalar massNodeSource | ||
89 | ( | ||
90 | const scalar& abscissa1, | ||
91 | const scalar& abscissa2, | ||
92 | const label momentOrder | ||
93 | ) const; | ||
94 | |||
95 | |||
79 | 96 | public: | public: |
80 | 97 | ||
81 | 98 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
104 | 121 | const fvMesh& mesh | const fvMesh& mesh |
105 | 122 | ); | ); |
106 | 123 | ||
124 | //- Disallow default bitwise copy construct | ||
125 | aggregationKernel(const aggregationKernel&) = delete; | ||
126 | |||
107 | 127 | ||
108 | 128 | // Selectors | // Selectors |
109 | 129 | ||
... | ... | public: | |
120 | 140 | ||
121 | 141 | // Member Functions | // Member Functions |
122 | 142 | ||
143 | //- Update fields before ode solve | ||
144 | virtual void preUpdate() | ||
145 | { | ||
146 | return; | ||
147 | } | ||
148 | |||
123 | 149 | //- Aggregation kernel | //- Aggregation kernel |
124 | 150 | virtual scalar Ka | virtual scalar Ka |
125 | 151 | ( | ( |
126 | const scalar& abscissa1, | ||
127 | const scalar& abscissa2, | ||
152 | const scalar& d1, | ||
153 | const scalar& d2, | ||
154 | const vector& Ur, | ||
128 | 155 | const label celli, | const label celli, |
129 | 156 | const label environment = 0 | const label environment = 0 |
130 | 157 | ) const = 0; | ) const = 0; |
158 | |||
159 | //- Return aggregation source terms | ||
160 | scalar aggregationSource | ||
161 | ( | ||
162 | const labelList& momentOrder, | ||
163 | const label celli, | ||
164 | const scalarQuadratureApproximation& quadrature, | ||
165 | const label enviroment | ||
166 | ); | ||
167 | |||
168 | //- Return aggregation source terms | ||
169 | scalar aggregationSource | ||
170 | ( | ||
171 | const labelList& momentOrder, | ||
172 | const label celli, | ||
173 | const velocityQuadratureApproximation& quadrature, | ||
174 | const label enviroment | ||
175 | ); | ||
176 | |||
177 | |||
178 | // Member Operators | ||
179 | |||
180 | //- Disallow default bitwise assignment | ||
181 | void operator=(const aggregationKernel&) = delete; | ||
131 | 182 | }; | }; |
132 | 183 | ||
133 | 184 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/newAggregationKernel.C changed (mode: 100644) (index 295a7e0..14e559f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/buoyancyInduced/buoyancyInduced.C changed (mode: 100644) (index fe92385..3d28803) | |||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced | |
56 | 56 | ) | ) |
57 | 57 | : | : |
58 | 58 | aggregationKernel(dict, mesh), | aggregationKernel(dict, mesh), |
59 | Ucrit_(dict.lookup("Ucrit")), | ||
59 | Ucrit_(dict.lookup("Ucrit")) | ||
60 | /* | ||
60 | 61 | thisPhaseName_(dict.lookup("thisPhaseName")), | thisPhaseName_(dict.lookup("thisPhaseName")), |
61 | 62 | contPhaseName_(dict.lookup("contPhaseName")), | contPhaseName_(dict.lookup("contPhaseName")), |
62 | 63 | Udisp_ | Udisp_ |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced | |
87 | 88 | IOobject::groupName("moment.3.populationBalance", thisPhaseName_) | IOobject::groupName("moment.3.populationBalance", thisPhaseName_) |
88 | 89 | ) | ) |
89 | 90 | ) | ) |
91 | */ | ||
90 | 92 | {} | {} |
91 | 93 | ||
92 | 94 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced | |
102 | 104 | Foam::scalar | Foam::scalar |
103 | 105 | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced::Ka | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced::Ka |
104 | 106 | ( | ( |
105 | const scalar& abscissa1, | ||
106 | const scalar& abscissa2, | ||
107 | const scalar& d1, | ||
108 | const scalar& d2, | ||
109 | const vector& Ur, | ||
107 | 110 | const label celli, | const label celli, |
108 | 111 | const label environment | const label environment |
109 | 112 | ) const | ) const |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced::Ka | |
122 | 125 | //- Read velocity of the continuous phase | //- Read velocity of the continuous phase |
123 | 126 | ||
124 | 127 | //- Evaluate relative velocity | //- Evaluate relative velocity |
128 | /* | ||
125 | 129 | dimensionedScalar Uslip_ | dimensionedScalar Uslip_ |
126 | 130 | ( | ( |
127 | 131 | "Uslip_", | "Uslip_", |
128 | 132 | dimensionSet(0, 1, -1, 0, 0), | dimensionSet(0, 1, -1, 0, 0), |
129 | 133 | mag(Udisp_[celli] - Ucont_[celli]) | mag(Udisp_[celli] - Ucont_[celli]) |
130 | 134 | ); | ); |
131 | |||
135 | */ | ||
132 | 136 | // Read sauter diameter | // Read sauter diameter |
133 | 137 | //dimensionedScalar diaMin_("diaMin_", dimensionSet(0, 1, 0, 0, 0), 1.0e-06); | //dimensionedScalar diaMin_("diaMin_", dimensionSet(0, 1, 0, 0, 0), 1.0e-06); |
134 | 138 | //dimensionedScalar diaMax_("diaMax_", dimensionSet(0, 1, 0, 0, 0), 1.0e-01); | //dimensionedScalar diaMax_("diaMax_", dimensionSet(0, 1, 0, 0, 0), 1.0e-01); |
135 | 139 | //dimensionedScalar smallMoment2("smallMoment2", dimensionSet(0, -1, 0, 0, 0), 1.0e-06); | //dimensionedScalar smallMoment2("smallMoment2", dimensionSet(0, -1, 0, 0, 0), 1.0e-06); |
136 | 140 | ||
141 | /* | ||
137 | 142 | scalar diaMin_(1.0e-06); | scalar diaMin_(1.0e-06); |
138 | 143 | scalar diaMax_(1.0e-01); | scalar diaMax_(1.0e-01); |
139 | 144 | scalar smallMoment2(1.0e-06); | scalar smallMoment2(1.0e-06); |
145 | */ | ||
140 | 146 | ||
147 | /* | ||
141 | 148 | dimensionedScalar dSauter_ | dimensionedScalar dSauter_ |
142 | 149 | ( | ( |
143 | 150 | "dSauter_", | "dSauter_", |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced::Ka | |
151 | 158 | diaMax_ | diaMax_ |
152 | 159 | ) | ) |
153 | 160 | ); | ); |
154 | |||
161 | */ | ||
162 | /* | ||
155 | 163 | //- Evaluate relative velocity of different drops | //- Evaluate relative velocity of different drops |
156 | 164 | scalar Urelative_ | scalar Urelative_ |
157 | 165 | ( | ( |
158 | 166 | mag(Uslip_.value()*(abscissa2-abscissa1)/dSauter_.value()) | mag(Uslip_.value()*(abscissa2-abscissa1)/dSauter_.value()) |
159 | 167 | ); | ); |
160 | |||
168 | */ | ||
169 | |||
161 | 170 | //if (std::fabs(Urelative_ - 0.00025) > SMALL) | //if (std::fabs(Urelative_ - 0.00025) > SMALL) |
162 | 171 | // Urelative_ = 0.00025; | // Urelative_ = 0.00025; |
163 | 172 | ||
164 | 173 | //- Evaluate efficiency term | //- Evaluate efficiency term |
165 | scalar lambda_(Foam::exp(-(Urelative_/Ucrit_.value()))); | ||
166 | lambda_ = min(max(lambda_, 1e-10),1.0); | ||
174 | scalar lambda_(Foam::exp(-(mag(Ur)/Ucrit_.value()))); | ||
175 | lambda_ = min(max(lambda_, 1e-06), 1.0); | ||
167 | 176 | ||
168 | 177 | /* | /* |
169 | 178 | if (min(lambda_) < smallAbs) | if (min(lambda_) < smallAbs) |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInduced::Ka | |
173 | 182 | */ | */ |
174 | 183 | ||
175 | 184 | scalar aggregationK | scalar aggregationK |
176 | = Ca_.value() | ||
185 | = max | ||
186 | ( | ||
187 | (Ca_.value() | ||
177 | 188 | *(0.25*Foam::constant::mathematical::pi) | *(0.25*Foam::constant::mathematical::pi) |
178 | *sqr(abscissa1 + abscissa2)*Urelative_ | ||
179 | *lambda_; | ||
189 | *sqr(d1 + d2)*mag(Ur) | ||
190 | *lambda_ | ||
191 | ) | ||
192 | , | ||
193 | 0.0 | ||
194 | ); | ||
180 | 195 | ||
181 | 196 | //aggregationK.ref().dimensions().reset(pow3(abscissa1.dimensions())/dimTime); | //aggregationK.ref().dimensions().reset(pow3(abscissa1.dimensions())/dimTime); |
182 | 197 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/buoyancyInduced/buoyancyInduced.H changed (mode: 100644) (index c125ce0..de06f6e) | |||
... | ... | private: | |
76 | 76 | dimensionedScalar Ucrit_; | dimensionedScalar Ucrit_; |
77 | 77 | ||
78 | 78 | //- This phase name | //- This phase name |
79 | word thisPhaseName_; | ||
79 | //word thisPhaseName_; | ||
80 | 80 | ||
81 | 81 | //- continuous phase name | //- continuous phase name |
82 | word contPhaseName_; | ||
82 | //word contPhaseName_; | ||
83 | 83 | ||
84 | 84 | //- Velocity field of the phase | //- Velocity field of the phase |
85 | const volVectorField& Udisp_; | ||
85 | //const volVectorField& Udisp_; | ||
86 | 86 | ||
87 | 87 | //- Velocity field of the continuous phase | //- Velocity field of the continuous phase |
88 | const volVectorField& Ucont_; | ||
88 | //const volVectorField& Ucont_; | ||
89 | 89 | ||
90 | 90 | //- Second moment of the distribution | //- Second moment of the distribution |
91 | const volScalarField& moment2_; | ||
91 | //const volScalarField& moment2_; | ||
92 | 92 | ||
93 | 93 | //- Third moment of the distribution | //- Third moment of the distribution |
94 | const volScalarField& moment3_; | ||
94 | //const volScalarField& moment3_; | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | public: | public: |
... | ... | public: | |
119 | 119 | //- Coalescence kernel | //- Coalescence kernel |
120 | 120 | virtual scalar Ka | virtual scalar Ka |
121 | 121 | ( | ( |
122 | const scalar& abscissa1, | ||
123 | const scalar& abscissa2, | ||
122 | const scalar& d1, | ||
123 | const scalar& d2, | ||
124 | const vector& Ur, | ||
124 | 125 | const label celli, | const label celli, |
125 | 126 | const label environment = 0 | const label environment = 0 |
126 | 127 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/buoyancyInducedSI/buoyancyInducedSI.C changed (mode: 100644) (index e844e2b..a5d7fc4) | |||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI | |
57 | 57 | : | : |
58 | 58 | aggregationKernel(dict, mesh), | aggregationKernel(dict, mesh), |
59 | 59 | Ucrit_(dict.lookup("Ucrit")), | Ucrit_(dict.lookup("Ucrit")), |
60 | ifPorous_ | ||
61 | ( | ||
62 | mesh_.lookupObject<volScalarField>("ifPorous") | ||
63 | ) | ||
64 | /* | ||
60 | 65 | thisPhaseName_(dict.lookup("thisPhaseName")), | thisPhaseName_(dict.lookup("thisPhaseName")), |
61 | 66 | contPhaseName_(dict.lookup("contPhaseName")), | contPhaseName_(dict.lookup("contPhaseName")), |
62 | 67 | //Udisp_(mesh_.lookupObject<volVectorField>("U")), | //Udisp_(mesh_.lookupObject<volVectorField>("U")), |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI | |
87 | 92 | ( | ( |
88 | 93 | IOobject::groupName("moment.3.populationBalance", thisPhaseName_) | IOobject::groupName("moment.3.populationBalance", thisPhaseName_) |
89 | 94 | ) | ) |
90 | ), | ||
91 | ifPorous_ | ||
92 | ( | ||
93 | mesh_.lookupObject<volScalarField>("ifPorous") | ||
94 | 95 | ) | ) |
96 | */ | ||
95 | 97 | {} | {} |
96 | 98 | ||
97 | 99 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI | |
107 | 109 | Foam::scalar | Foam::scalar |
108 | 110 | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI::Ka | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI::Ka |
109 | 111 | ( | ( |
110 | const scalar& abscissa1, | ||
111 | const scalar& abscissa2, | ||
112 | const scalar& d1, | ||
113 | const scalar& d2, | ||
114 | const vector& Ur, | ||
112 | 115 | const label celli, | const label celli, |
113 | 116 | const label environment | const label environment |
114 | 117 | ) const | ) const |
115 | 118 | { | { |
116 | scalar aggregationK = 0; | ||
119 | /* | ||
117 | 120 | if (abscissa1 != abscissa2) | if (abscissa1 != abscissa2) |
118 | 121 | { | { |
119 | 122 | if (Udisp_[celli]!=Ucont_[celli]) | if (Udisp_[celli]!=Ucont_[celli]) |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI::Ka | |
152 | 155 | ||
153 | 156 | //- Evaluate efficiency term | //- Evaluate efficiency term |
154 | 157 | scalar lambda_(Foam::exp(-(Urelative_/Ucrit_.value()))); | scalar lambda_(Foam::exp(-(Urelative_/Ucrit_.value()))); |
155 | lambda_ = min(max(lambda_, 1e-10),1.0); | ||
158 | lambda_ = max(lambda_, 1e-10); | ||
156 | 159 | ||
157 | 160 | aggregationK | aggregationK |
158 | 161 | = Ca_.value() | = Ca_.value() |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::buoyancyInducedSI::Ka | |
161 | 164 | *(ifPorous_[celli]*1.0 + (1.0 - ifPorous_[celli])*lambda_); | *(ifPorous_[celli]*1.0 + (1.0 - ifPorous_[celli])*lambda_); |
162 | 165 | } | } |
163 | 166 | } | } |
167 | */ | ||
168 | |||
169 | //- Evaluate efficiency term | ||
170 | scalar lambda_(Foam::exp(-(mag(Ur)/Ucrit_.value()))); | ||
171 | lambda_ = min(max(lambda_, 1e-06), 1.0); | ||
172 | |||
173 | scalar aggregationK | ||
174 | = max | ||
175 | ( | ||
176 | (Ca_.value() | ||
177 | *(0.25*Foam::constant::mathematical::pi) | ||
178 | *sqr(d1 + d2)*mag(Ur) | ||
179 | *(ifPorous_[celli]*1.0 + (1.0 - ifPorous_[celli])*lambda_) | ||
180 | ) | ||
181 | , | ||
182 | 0.0 | ||
183 | ); | ||
164 | 184 | ||
165 | 185 | return aggregationK; | return aggregationK; |
166 | 186 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/buoyancyInducedSI/buoyancyInducedSI.H changed (mode: 100644) (index 60156cd..5bbf9a4) | |||
... | ... | private: | |
76 | 76 | dimensionedScalar Ucrit_; | dimensionedScalar Ucrit_; |
77 | 77 | ||
78 | 78 | //- This phase name | //- This phase name |
79 | word thisPhaseName_; | ||
79 | //word thisPhaseName_; | ||
80 | 80 | ||
81 | 81 | //- continuous phase name | //- continuous phase name |
82 | word contPhaseName_; | ||
82 | //word contPhaseName_; | ||
83 | 83 | ||
84 | 84 | //- Velocity field of the phase | //- Velocity field of the phase |
85 | const volVectorField& Udisp_; | ||
85 | //const volVectorField& Udisp_; | ||
86 | 86 | ||
87 | 87 | //- Velocity field of the continuous phase | //- Velocity field of the continuous phase |
88 | const volVectorField& Ucont_; | ||
88 | //const volVectorField& Ucont_; | ||
89 | 89 | ||
90 | 90 | //- Second moment of the distribution | //- Second moment of the distribution |
91 | const volScalarField& moment2_; | ||
91 | //const volScalarField& moment2_; | ||
92 | 92 | ||
93 | 93 | //- Third moment of the distribution | //- Third moment of the distribution |
94 | const volScalarField& moment3_; | ||
94 | //const volScalarField& moment3_; | ||
95 | 95 | ||
96 | 96 | //- Porosity field | //- Porosity field |
97 | 97 | const volScalarField& ifPorous_; | const volScalarField& ifPorous_; |
... | ... | public: | |
122 | 122 | //- Coalescence kernel | //- Coalescence kernel |
123 | 123 | virtual scalar Ka | virtual scalar Ka |
124 | 124 | ( | ( |
125 | const scalar& abscissa1, | ||
126 | const scalar& abscissa2, | ||
125 | const scalar& d1, | ||
126 | const scalar& d2, | ||
127 | const vector& Ur, | ||
127 | 128 | const label celli, | const label celli, |
128 | 129 | const label environment = 0 | const label environment = 0 |
129 | 130 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/coalescenceEfficiencyKernel/coalescenceEfficiencyKernel.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C (similarity 73%) (mode: 100644) (index 38f9456..63a4676) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "nucleationModel.H" | ||
26 | #include "coalescenceEfficiencyKernel.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
29 | 29 | ||
... | ... | namespace Foam | |
31 | 31 | { | { |
32 | 32 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
33 | 33 | { | { |
34 | defineTypeNameAndDebug(nucleationModel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(nucleationModel, dictionary); | ||
34 | namespace aggregationKernels | ||
35 | { | ||
36 | defineTypeNameAndDebug(coalescenceEfficiencyKernel, 0); | ||
37 | defineRunTimeSelectionTable(coalescenceEfficiencyKernel, dictionary); | ||
38 | } | ||
37 | 39 | } | } |
38 | 40 | } | } |
39 | 41 | ||
40 | 42 | ||
41 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
42 | 44 | ||
43 | Foam::populationBalanceSubModels::nucleationModel::nucleationModel | ||
45 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
46 | coalescenceEfficiencyKernel::coalescenceEfficiencyKernel | ||
44 | 47 | ( | ( |
45 | 48 | const dictionary& dict, | const dictionary& dict, |
46 | const fvMesh& mesh | ||
49 | const fvMesh& mesh, | ||
50 | const word& continuousPhase | ||
47 | 51 | ) | ) |
48 | 52 | : | : |
49 | 53 | dict_(dict), | dict_(dict), |
... | ... | Foam::populationBalanceSubModels::nucleationModel::nucleationModel | |
53 | 57 | ||
54 | 58 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
55 | 59 | ||
56 | Foam::populationBalanceSubModels::nucleationModel::~nucleationModel() | ||
60 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
61 | coalescenceEfficiencyKernel::~coalescenceEfficiencyKernel() | ||
57 | 62 | {} | {} |
58 | 63 | ||
59 | 64 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/coalescenceEfficiencyKernel/coalescenceEfficiencyKernel.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.H (similarity 63%) (mode: 100644) (index 71211c5..bf1ca3c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::aggregationKernel | ||
25 | Foam::populationBalanceSubModels::coalescenceEfficiencyKernel | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Abstract class for aggregation kernels. | ||
28 | Abstract class for coalescence effeciency kernels. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | aggregationKernel.C | ||
31 | coalescenceEfficiencyKernel.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef aggregationKernel_H | ||
36 | #define aggregationKernel_H | ||
35 | #ifndef coalescenceEfficiencyKernel_H | ||
36 | #define coalescenceEfficiencyKernel_H | ||
37 | 37 | ||
38 | #include "turbulentFluidThermoModel.H" | ||
38 | 39 | #include "dictionary.H" | #include "dictionary.H" |
39 | 40 | #include "volFields.H" | #include "volFields.H" |
40 | 41 | #include "dimensionedTypes.H" | #include "dimensionedTypes.H" |
41 | 42 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
43 | #include "fvc.H" | ||
42 | 44 | ||
43 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 46 | ||
... | ... | namespace Foam | |
46 | 48 | { | { |
47 | 49 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
48 | 50 | { | { |
51 | namespace aggregationKernels | ||
52 | { | ||
49 | 53 | ||
50 | 54 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
51 | Class aggregationKernel Declaration | ||
55 | Class coalescenceEfficiencyKernel Declaration | ||
52 | 56 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 57 | ||
54 | class aggregationKernel | ||
58 | class coalescenceEfficiencyKernel | ||
55 | 59 | { | { |
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 | 60 | protected: | protected: |
66 | 61 | ||
67 | 62 | // Protected data | // Protected data |
... | ... | protected: | |
72 | 67 | //- Mesh | //- Mesh |
73 | 68 | const fvMesh& mesh_; | const fvMesh& mesh_; |
74 | 69 | ||
75 | //- Coefficient of aggregation kernel | ||
76 | const dimensionedScalar Ca_; | ||
77 | |||
78 | 70 | ||
79 | 71 | public: | public: |
80 | 72 | ||
81 | 73 | //- Runtime type information | //- Runtime type information |
82 | TypeName("aggregationKernel"); | ||
74 | TypeName("coalescenceEfficiencyKernel"); | ||
83 | 75 | ||
84 | 76 | // Declare runtime constructor selection table | // Declare runtime constructor selection table |
85 | 77 | declareRunTimeSelectionTable | declareRunTimeSelectionTable |
86 | 78 | ( | ( |
87 | 79 | autoPtr, | autoPtr, |
88 | aggregationKernel, | ||
80 | coalescenceEfficiencyKernel, | ||
89 | 81 | dictionary, | dictionary, |
90 | 82 | ( | ( |
91 | 83 | const dictionary& dict, | const dictionary& dict, |
92 | const fvMesh& mesh | ||
84 | const fvMesh& mesh, | ||
85 | const word& continuousPhase | ||
93 | 86 | ), | ), |
94 | (dict, mesh) | ||
87 | (dict, mesh, continuousPhase) | ||
95 | 88 | ); | ); |
96 | 89 | ||
97 | 90 | ||
98 | 91 | // Constructors | // Constructors |
99 | 92 | ||
100 | 93 | //- Construct from components | //- Construct from components |
101 | aggregationKernel | ||
94 | coalescenceEfficiencyKernel | ||
102 | 95 | ( | ( |
103 | 96 | const dictionary& dict, | const dictionary& dict, |
104 | const fvMesh& mesh | ||
97 | const fvMesh& mesh, | ||
98 | const word& continuousPhase | ||
105 | 99 | ); | ); |
106 | 100 | ||
101 | //- Disallow default bitwise copy construct | ||
102 | coalescenceEfficiencyKernel | ||
103 | ( | ||
104 | const coalescenceEfficiencyKernel& | ||
105 | ) = delete; | ||
106 | |||
107 | 107 | ||
108 | 108 | // Selectors | // Selectors |
109 | 109 | ||
110 | static autoPtr<aggregationKernel> New | ||
110 | static autoPtr<coalescenceEfficiencyKernel> New | ||
111 | 111 | ( | ( |
112 | 112 | const dictionary& dict, | const dictionary& dict, |
113 | const fvMesh& mesh | ||
113 | const fvMesh& mesh, | ||
114 | const word& continuousPhase | ||
114 | 115 | ); | ); |
115 | 116 | ||
116 | 117 | ||
117 | 118 | //- Destructor | //- Destructor |
118 | virtual ~aggregationKernel(); | ||
119 | virtual ~coalescenceEfficiencyKernel(); | ||
119 | 120 | ||
120 | 121 | ||
121 | 122 | // Member Functions | // Member Functions |
122 | 123 | ||
124 | //- Update fields | ||
125 | virtual void update | ||
126 | ( | ||
127 | const fluidThermo& thermo, | ||
128 | const turbulenceModel& turb | ||
129 | ) | ||
130 | {} | ||
131 | |||
123 | 132 | //- Aggregation kernel | //- Aggregation kernel |
124 | virtual scalar Ka | ||
133 | virtual scalar Pc | ||
125 | 134 | ( | ( |
126 | const scalar& abscissa1, | ||
127 | const scalar& abscissa2, | ||
128 | const label celli, | ||
129 | const label environment = 0 | ||
135 | const scalar& d1, | ||
136 | const scalar& d2, | ||
137 | const vector& Ur, | ||
138 | const label celli | ||
130 | 139 | ) const = 0; | ) const = 0; |
140 | |||
141 | // Member Operators | ||
142 | |||
143 | //- Disallow default bitwise assignment | ||
144 | void operator=(const coalescenceEfficiencyKernel&) = delete; | ||
131 | 145 | }; | }; |
132 | 146 | ||
133 | 147 | ||
134 | 148 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
135 | 149 | ||
150 | } // End namespace aggregationKernels | ||
136 | 151 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
137 | 152 | } // End namespace Foam | } // End namespace Foam |
138 | 153 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/coalescenceEfficiencyKernel/newCoalescenceEfficiencyKernel.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/collisionKernel/newCollisionKernel.C (similarity 63%) (mode: 100644) (index 46e5163..2eb57ca) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "collisionKernel.H" | ||
26 | #include "coalescenceEfficiencyKernel.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // |
29 | 29 | ||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::collisionKernel> | ||
31 | Foam::populationBalanceSubModels::collisionKernel::New | ||
30 | Foam::autoPtr | ||
31 | < | ||
32 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
33 | coalescenceEfficiencyKernel | ||
34 | > | ||
35 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
36 | coalescenceEfficiencyKernel::New | ||
32 | 37 | ( | ( |
33 | 38 | const dictionary& dict, | const dictionary& dict, |
34 | 39 | const fvMesh& mesh, | const fvMesh& mesh, |
35 | const velocityQuadratureApproximation& quadrature, | ||
36 | const bool ode | ||
40 | const word& continuousPhase | ||
37 | 41 | ) | ) |
38 | 42 | { | { |
39 | word collisionKernelType(dict.lookup("collisionKernel")); | ||
43 | word coalescenceEfficiencyKernelType | ||
44 | ( | ||
45 | dict.lookup("efficiency") | ||
46 | ); | ||
40 | 47 | ||
41 | Info<< "Selecting collisionKernel: " | ||
42 | << collisionKernelType << endl; | ||
48 | Info<< "Selecting coalescence Efficiency Kernel " | ||
49 | << coalescenceEfficiencyKernelType << endl; | ||
43 | 50 | ||
44 | 51 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
45 | dictionaryConstructorTablePtr_->find(collisionKernelType); | ||
52 | dictionaryConstructorTablePtr_->find(coalescenceEfficiencyKernelType); | ||
46 | 53 | ||
47 | 54 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
48 | 55 | { | { |
49 | 56 | FatalErrorInFunction | FatalErrorInFunction |
50 | << "Unknown collisionKernelType type " | ||
51 | << collisionKernelType << endl << endl | ||
52 | << "Valid collisionKernelType types are :" << endl | ||
57 | << "Unknown coalescence efficiency type " | ||
58 | << coalescenceEfficiencyKernelType << endl << endl | ||
59 | << "Valid coalescence efficiency types are :" << endl | ||
53 | 60 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
54 | 61 | << abort(FatalError); | << abort(FatalError); |
55 | 62 | } | } |
56 | 63 | ||
57 | return autoPtr<collisionKernel> | ||
64 | return autoPtr<coalescenceEfficiencyKernel> | ||
58 | 65 | ( | ( |
59 | cstrIter() | ||
60 | ( | ||
61 | dict, | ||
62 | mesh, | ||
63 | quadrature, | ||
64 | ode | ||
65 | ) | ||
66 | cstrIter()(dict, mesh, continuousPhase) | ||
66 | 67 | ); | ); |
67 | 68 | } | } |
68 | 69 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/constant/constantEfficiency.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.C (similarity 71%) (mode: 100644) (index 63973a3..d6f8ac1) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "differentialForceAggregation.H" | ||
26 | #include "constantEfficiency.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "fundamentalConstants.H" | ||
28 | 29 | ||
29 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 31 | ||
... | ... | namespace populationBalanceSubModels | |
34 | 35 | { | { |
35 | 36 | namespace aggregationKernels | namespace aggregationKernels |
36 | 37 | { | { |
37 | defineTypeNameAndDebug(differentialForceAggregation, 0); | ||
38 | namespace coalescenceEfficiencyKernels | ||
39 | { | ||
40 | defineTypeNameAndDebug(constant, 0); | ||
38 | 41 | ||
39 | 42 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
40 | 43 | ( | ( |
41 | aggregationKernel, | ||
42 | differentialForceAggregation, | ||
44 | coalescenceEfficiencyKernel, | ||
45 | constant, | ||
43 | 46 | dictionary | dictionary |
44 | 47 | ); | ); |
45 | 48 | } | } |
46 | 49 | } | } |
47 | 50 | } | } |
51 | } | ||
48 | 52 | ||
49 | 53 | ||
50 | 54 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
51 | 55 | ||
52 | 56 | Foam::populationBalanceSubModels::aggregationKernels | Foam::populationBalanceSubModels::aggregationKernels |
53 | ::differentialForceAggregation::differentialForceAggregation | ||
57 | ::coalescenceEfficiencyKernels::constant::constant | ||
54 | 58 | ( | ( |
55 | 59 | const dictionary& dict, | const dictionary& dict, |
56 | const fvMesh& mesh | ||
60 | const fvMesh& mesh, | ||
61 | const word& continuousPhase | ||
57 | 62 | ) | ) |
58 | 63 | : | : |
59 | aggregationKernel(dict, mesh) | ||
64 | coalescenceEfficiencyKernel(dict, mesh, continuousPhase), | ||
65 | Ceff_("Ceff", inv(dimTime), dict) | ||
60 | 66 | {} | {} |
61 | 67 | ||
62 | 68 | ||
63 | 69 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
64 | 70 | ||
65 | Foam::populationBalanceSubModels::aggregationKernels | ||
66 | ::differentialForceAggregation::~differentialForceAggregation() | ||
71 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
72 | coalescenceEfficiencyKernels::constant::~constant() | ||
67 | 73 | {} | {} |
68 | 74 | ||
69 | 75 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels | |
71 | 77 | ||
72 | 78 | Foam::scalar | Foam::scalar |
73 | 79 | Foam::populationBalanceSubModels::aggregationKernels:: | Foam::populationBalanceSubModels::aggregationKernels:: |
74 | differentialForceAggregation::Ka | ||
80 | coalescenceEfficiencyKernels::constant::Pc | ||
75 | 81 | ( | ( |
76 | const scalar& abscissa1, | ||
77 | const scalar& abscissa2, | ||
78 | const label celli, | ||
79 | const label environment | ||
82 | const scalar& d1, | ||
83 | const scalar& d2, | ||
84 | const vector& Ur, | ||
85 | const label celli | ||
80 | 86 | ) const | ) const |
81 | 87 | { | { |
82 | return Ca_.value()*sqr(abscissa1 + abscissa2) | ||
83 | *mag(sqr(abscissa1) - sqr(abscissa2)); | ||
88 | return Ceff_.value(); | ||
84 | 89 | } | } |
85 | 90 | ||
86 | 91 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceEfficiencyKernels/constant/constantEfficiency.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.H (similarity 71%) (mode: 100644) (index f93fb4b..eba3722) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
25 | Foam::populationBalanceSubModels::coalescenceEfficiencyKernels:: | ||
26 | constant | ||
26 | 27 | ||
27 | 28 | Description | Description |
28 | Constant aggregation kernel. The value of the kernel is read from dictionary | ||
29 | or assumed equal to 1. | ||
30 | |||
31 | \f[ | ||
32 | K_a = C_a | ||
33 | \f] | ||
34 | |||
35 | where | ||
36 | |||
37 | \vartable | ||
38 | C_a | Aggregation coefficient [1/s] | ||
39 | \endvartable | ||
29 | Constant coalescence efficiency | ||
40 | 30 | ||
41 | 31 | SourceFiles | SourceFiles |
42 | constantAggregation.C | ||
32 | constantEfficiency.C | ||
43 | 33 | ||
44 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
45 | 35 | ||
46 | #ifndef constantAggregation_H | ||
47 | #define constantAggregation_H | ||
36 | #ifndef constantEfficiency_H | ||
37 | #define constantEfficiency_H | ||
48 | 38 | ||
49 | #include "aggregationKernel.H" | ||
39 | #include "coalescenceEfficiencyKernel.H" | ||
50 | 40 | ||
51 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
52 | 42 | ||
... | ... | namespace populationBalanceSubModels | |
56 | 46 | { | { |
57 | 47 | namespace aggregationKernels | namespace aggregationKernels |
58 | 48 | { | { |
49 | namespace coalescenceEfficiencyKernels | ||
50 | { | ||
59 | 51 | ||
60 | 52 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
61 | Class constantAggregation Declaration | ||
53 | Class constant Declaration | ||
62 | 54 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
63 | 55 | ||
64 | class constantAggregation | ||
56 | class constant | ||
65 | 57 | : | : |
66 | public aggregationKernel | ||
58 | public coalescenceEfficiencyKernel | ||
67 | 59 | { | { |
60 | // Private data | ||
61 | |||
62 | //- Efficiency coefficient | ||
63 | dimensionedScalar Ceff_; | ||
64 | |||
65 | |||
68 | 66 | public: | public: |
69 | 67 | ||
70 | 68 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
74 | 72 | // Constructors | // Constructors |
75 | 73 | ||
76 | 74 | //- Construct from components | //- Construct from components |
77 | constantAggregation | ||
75 | constant | ||
78 | 76 | ( | ( |
79 | 77 | const dictionary& dict, | const dictionary& dict, |
80 | const fvMesh& mesh | ||
78 | const fvMesh& mesh, | ||
79 | const word& continuousPhase | ||
81 | 80 | ); | ); |
82 | 81 | ||
83 | 82 | ||
84 | 83 | //- Destructor | //- Destructor |
85 | virtual ~constantAggregation(); | ||
84 | virtual ~constant(); | ||
86 | 85 | ||
87 | 86 | ||
88 | 87 | // Member Functions | // Member Functions |
89 | 88 | ||
90 | 89 | //- Aggregation kernel | //- Aggregation kernel |
91 | virtual scalar Ka | ||
90 | virtual scalar Pc | ||
92 | 91 | ( | ( |
93 | const scalar& abscissa1, | ||
94 | const scalar& abscissa2, | ||
95 | const label celli, | ||
96 | const label environment = 0 | ||
92 | const scalar& d1, | ||
93 | const scalar& d2, | ||
94 | const vector& Ur, | ||
95 | const label celli | ||
97 | 96 | ) const; | ) const; |
98 | 97 | ||
99 | 98 | }; | }; |
... | ... | public: | |
101 | 100 | ||
102 | 101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
103 | 102 | ||
103 | } // End namespace coalescenceEfficiencyKernels | ||
104 | 104 | } // End namespace aggregationKernels | } // End namespace aggregationKernels |
105 | 105 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
106 | 106 | } // End namespace Foam | } // End namespace Foam |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/Luo/LuoFrequency.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/noCollision/noCollision.C (similarity 58%) (mode: 100644) (index 3295fc1..1972740) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noCollision.H" | ||
26 | #include "LuoFrequency.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | 28 | #include "fundamentalConstants.H" | #include "fundamentalConstants.H" |
29 | #include "fvc.H" | ||
29 | 30 | ||
30 | 31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
31 | 32 | ||
... | ... | namespace Foam | |
33 | 34 | { | { |
34 | 35 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
35 | 36 | { | { |
36 | namespace collisionKernels | ||
37 | namespace aggregationKernels | ||
37 | 38 | { | { |
38 | defineTypeNameAndDebug(noCollision, 0); | ||
39 | namespace coalescenceFrequencyKernels | ||
40 | { | ||
41 | defineTypeNameAndDebug(Luo, 0); | ||
39 | 42 | ||
40 | 43 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
41 | 44 | ( | ( |
42 | collisionKernel, | ||
43 | noCollision, | ||
45 | coalescenceFrequencyKernel, | ||
46 | Luo, | ||
44 | 47 | dictionary | dictionary |
45 | 48 | ); | ); |
46 | 49 | } | } |
47 | 50 | } | } |
48 | 51 | } | } |
52 | } | ||
49 | 53 | ||
50 | 54 | ||
51 | 55 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
52 | 56 | ||
53 | Foam::populationBalanceSubModels::collisionKernels::noCollision::noCollision | ||
57 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
58 | coalescenceFrequencyKernels::Luo::Luo | ||
54 | 59 | ( | ( |
55 | 60 | const dictionary& dict, | const dictionary& dict, |
56 | 61 | const fvMesh& mesh, | const fvMesh& mesh, |
57 | const velocityQuadratureApproximation& quadrature, | ||
58 | const bool ode | ||
62 | const word& continuousPhase | ||
59 | 63 | ) | ) |
60 | 64 | : | : |
61 | collisionKernel(dict, mesh, quadrature, ode) | ||
65 | coalescenceFrequencyKernel(dict, mesh, continuousPhase), | ||
66 | epsilonf_ | ||
67 | ( | ||
68 | IOobject | ||
69 | ( | ||
70 | "Luo:epsilonf", | ||
71 | mesh.time().timeName(), | ||
72 | mesh | ||
73 | ), | ||
74 | mesh, | ||
75 | dimensionedScalar("zero", sqr(dimVelocity)/dimTime, 0.0) | ||
76 | ) | ||
62 | 77 | {} | {} |
63 | 78 | ||
64 | 79 | ||
65 | 80 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
66 | 81 | ||
67 | Foam::populationBalanceSubModels::collisionKernels::noCollision::~noCollision() | ||
82 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
83 | coalescenceFrequencyKernels::Luo::~Luo() | ||
68 | 84 | {} | {} |
69 | 85 | ||
70 | 86 | ||
71 | 87 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 88 | ||
73 | void Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
74 | ::updateCells(const label celli) | ||
75 | {} | ||
76 | |||
77 | 89 | void | void |
78 | Foam::populationBalanceSubModels::collisionKernels::noCollision::updateFields() | ||
79 | {} | ||
80 | |||
81 | Foam::scalar | ||
82 | Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
83 | ::explicitCollisionSource(const label mi, const label celli) const | ||
90 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
91 | coalescenceFrequencyKernels::Luo::update | ||
92 | ( | ||
93 | const fluidThermo& thermo, | ||
94 | const turbulenceModel& turb | ||
95 | ) | ||
84 | 96 | { | { |
85 | return 0.0; | ||
97 | epsilonf_ = turb.epsilon(); | ||
98 | epsilonf_.max(SMALL); | ||
86 | 99 | } | } |
87 | 100 | ||
88 | Foam::tmp<Foam::fvScalarMatrix> | ||
89 | Foam::populationBalanceSubModels::collisionKernels::noCollision | ||
90 | ::implicitCollisionSource(const volVectorMoment& m) const | ||
101 | |||
102 | Foam::scalar | ||
103 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
104 | coalescenceFrequencyKernels::Luo::omega | ||
105 | ( | ||
106 | const scalar& d1, | ||
107 | const scalar& d2, | ||
108 | const vector& Ur, | ||
109 | const label celli | ||
110 | ) const | ||
91 | 111 | { | { |
92 | return tmp<fvScalarMatrix> | ||
93 | ( | ||
94 | new fvScalarMatrix(m, m.dimensions()*dimVol/dimTime) | ||
95 | ); | ||
96 | } | ||
112 | scalar uRel = | ||
113 | 2.0*cbrt(epsilonf_[celli]) | ||
114 | *sqrt(pow(d1, 2.0/3.0) + pow(d2, 2.0/3.0)); | ||
97 | 115 | ||
116 | return constant::mathematical::pi/4.0*sqr(d1 + d2)*uRel; | ||
117 | } | ||
98 | 118 | ||
99 | 119 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/Luo/LuoFrequency.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.H (similarity 59%) (mode: 100644) (index ee4b8c1..8563bb9) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2017-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::Luo | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Brownian aggregation kernel. | ||
28 | Coalesence frequency kernel based on turbulence, buoyancy, and | ||
29 | laminar shear. | ||
29 | 30 | ||
30 | 31 | \f[ | \f[ |
31 | K_a = \frac{2 \kappa T}{3 \mu} \frac{(\xi_i + \xi_j)^2}{\xi_i \xi_j} | ||
32 | \omega = \frac{\pi}{4}(d_i + d_j)^2 u_{rel} | ||
33 | |||
34 | u_{rel} = 2 \epsilon_f^{1/3}(d_i^{2/3} + d_j^{2/3})^{1/2} | ||
32 | 35 | \f] | \f] |
33 | 36 | ||
34 | 37 | where | where |
35 | 38 | ||
36 | 39 | \vartable | \vartable |
37 | T | Absolute Temperature [K] | ||
38 | \kappa | Boltzmann's constant [J/K] | ||
39 | \mu | Molecular Viscosity [Pa s] | ||
40 | \xi_i | Abscissa of particle i [m] | ||
41 | \xi_j | Abscissa of particle j [m] | ||
40 | \epsilon_f | Turbulent dissipation rate of liquid phase [m2/s3] | ||
41 | \d_i | Diameter of bubble i [m] | ||
42 | \d_j | Diameter of bubble j [m] | ||
42 | 43 | \endvartable | \endvartable |
43 | 44 | ||
44 | Reference | ||
45 | References | ||
45 | 46 | \verbatim | \verbatim |
46 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
47 | Losunger" | ||
48 | M X Smoluchowski | ||
49 | Zeitschrift fur Physikalische Chemie | ||
50 | Volume 92, Pages 129-142, 1917 | ||
47 | "Coalescence, breakup and liquid circulation in bubble column reactors" | ||
48 | Luo, H., | ||
49 | PhD Theses, | ||
50 | The Norwegian Institute of Technology, 1993 | ||
51 | 51 | \endverbatim | \endverbatim |
52 | 52 | ||
53 | 53 | SourceFiles | SourceFiles |
54 | Brownian.C | ||
54 | LuoFrequecy.C | ||
55 | 55 | ||
56 | 56 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
57 | 57 | ||
58 | #ifndef Brownian_H | ||
59 | #define Brownian_H | ||
58 | #ifndef LuoFrequency_H | ||
59 | #define LuoFrequency_H | ||
60 | 60 | ||
61 | #include "aggregationKernel.H" | ||
62 | #include "turbulentFluidThermoModel.H" | ||
61 | #include "coalescenceFrequencyKernel.H" | ||
63 | 62 | ||
64 | 63 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
65 | 64 | ||
... | ... | namespace populationBalanceSubModels | |
69 | 68 | { | { |
70 | 69 | namespace aggregationKernels | namespace aggregationKernels |
71 | 70 | { | { |
71 | namespace coalescenceFrequencyKernels | ||
72 | { | ||
72 | 73 | ||
73 | 74 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
74 | Class Brownian Declaration | ||
75 | Class Luo Declaration | ||
75 | 76 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
76 | 77 | ||
77 | class Brownian | ||
78 | class Luo | ||
78 | 79 | : | : |
79 | public aggregationKernel | ||
80 | public coalescenceFrequencyKernel | ||
80 | 81 | { | { |
81 | //- Private data | ||
82 | |||
83 | //- Thermo model | ||
84 | const fluidThermo& flThermo_; | ||
85 | |||
86 | //- Temperature field | ||
87 | const volScalarField& T_; | ||
82 | // Private data | ||
88 | 83 | ||
89 | //- Viscosity field | ||
90 | const volScalarField& mu_; | ||
84 | //- Turbulent dissipation | ||
85 | volScalarField epsilonf_; | ||
91 | 86 | ||
92 | 87 | ||
93 | 88 | public: | public: |
94 | 89 | ||
95 | 90 | //- Runtime type information | //- Runtime type information |
96 | TypeName("Brownian"); | ||
91 | TypeName("Luo"); | ||
97 | 92 | ||
98 | 93 | ||
99 | 94 | // Constructors | // Constructors |
100 | 95 | ||
101 | 96 | //- Construct from components | //- Construct from components |
102 | Brownian | ||
97 | Luo | ||
103 | 98 | ( | ( |
104 | 99 | const dictionary& dict, | const dictionary& dict, |
105 | const fvMesh& mesh | ||
100 | const fvMesh& mesh, | ||
101 | const word& continuousPhase | ||
106 | 102 | ); | ); |
107 | 103 | ||
108 | 104 | ||
109 | 105 | //- Destructor | //- Destructor |
110 | virtual ~Brownian(); | ||
106 | virtual ~Luo(); | ||
111 | 107 | ||
112 | 108 | ||
113 | 109 | // Member Functions | // Member Functions |
114 | 110 | ||
111 | //- Update fields | ||
112 | virtual void update | ||
113 | ( | ||
114 | const fluidThermo& thermo, | ||
115 | const turbulenceModel& turb | ||
116 | ); | ||
117 | |||
115 | 118 | //- Aggregation kernel | //- Aggregation kernel |
116 | virtual scalar Ka | ||
119 | virtual scalar omega | ||
117 | 120 | ( | ( |
118 | const scalar& abscissa1, | ||
119 | const scalar& abscissa2, | ||
120 | const label celli, | ||
121 | const label environment = 0 | ||
121 | const scalar& d1, | ||
122 | const scalar& d2, | ||
123 | const vector& Ur, | ||
124 | const label celli | ||
122 | 125 | ) const; | ) const; |
123 | 126 | ||
124 | 127 | }; | }; |
... | ... | public: | |
126 | 129 | ||
127 | 130 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
128 | 131 | ||
132 | } // End namespace coalescenceFrequencyKernels | ||
129 | 133 | } // End namespace aggregationKernels | } // End namespace aggregationKernels |
130 | 134 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
131 | 135 | } // End namespace Foam | } // End namespace Foam |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/coalescenceFrequencyKernel/coalescenceFrequencyKernel.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C (similarity 73%) (mode: 100644) (index 1e4bf64..802b3de) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "breakupKernel.H" | ||
26 | #include "coalescenceFrequencyKernel.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
29 | 29 | ||
... | ... | namespace Foam | |
31 | 31 | { | { |
32 | 32 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
33 | 33 | { | { |
34 | defineTypeNameAndDebug(breakupKernel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(breakupKernel, dictionary); | ||
34 | namespace aggregationKernels | ||
35 | { | ||
36 | defineTypeNameAndDebug(coalescenceFrequencyKernel, 0); | ||
37 | defineRunTimeSelectionTable(coalescenceFrequencyKernel, dictionary); | ||
38 | } | ||
37 | 39 | } | } |
38 | 40 | } | } |
39 | 41 | ||
40 | 42 | ||
41 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
42 | 44 | ||
43 | Foam::populationBalanceSubModels::breakupKernel::breakupKernel | ||
45 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
46 | coalescenceFrequencyKernel::coalescenceFrequencyKernel | ||
44 | 47 | ( | ( |
45 | 48 | const dictionary& dict, | const dictionary& dict, |
46 | const fvMesh& mesh | ||
49 | const fvMesh& mesh, | ||
50 | const word& continuousPhase | ||
47 | 51 | ) | ) |
48 | : | ||
49 | dict_(dict), | ||
50 | mesh_(mesh), | ||
51 | Cb_ | ||
52 | ( | ||
53 | dict.lookupOrDefault | ||
54 | ( | ||
55 | "Cb", | ||
56 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
57 | ) | ||
58 | ) | ||
59 | 52 | {} | {} |
60 | 53 | ||
61 | 54 | ||
62 | 55 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
63 | 56 | ||
64 | Foam::populationBalanceSubModels::breakupKernel::~breakupKernel() | ||
57 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
58 | coalescenceFrequencyKernel::~coalescenceFrequencyKernel() | ||
65 | 59 | {} | {} |
66 | 60 | ||
67 | 61 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/coalescenceFrequencyKernel/coalescenceFrequencyKernel.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.H (similarity 63%) (mode: 100644) (index 71211c5..6a69da2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::aggregationKernel | ||
25 | Foam::populationBalanceSubModels::coalescenceFrequencyKernel | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Abstract class for aggregation kernels. | ||
28 | Abstract class for coalescence effeciency kernels. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | aggregationKernel.C | ||
31 | coalescenceFrequencyKernel.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef aggregationKernel_H | ||
36 | #define aggregationKernel_H | ||
35 | #ifndef coalescenceFrequencyKernel_H | ||
36 | #define coalescenceFrequencyKernel_H | ||
37 | 37 | ||
38 | #include "turbulentFluidThermoModel.H" | ||
38 | 39 | #include "dictionary.H" | #include "dictionary.H" |
39 | 40 | #include "volFields.H" | #include "volFields.H" |
40 | 41 | #include "dimensionedTypes.H" | #include "dimensionedTypes.H" |
41 | 42 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
43 | #include "fvc.H" | ||
42 | 44 | ||
43 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 46 | ||
... | ... | namespace Foam | |
46 | 48 | { | { |
47 | 49 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
48 | 50 | { | { |
51 | namespace aggregationKernels | ||
52 | { | ||
49 | 53 | ||
50 | 54 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
51 | Class aggregationKernel Declaration | ||
55 | Class coalescenceFrequencyKernel Declaration | ||
52 | 56 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 57 | ||
54 | class aggregationKernel | ||
58 | class coalescenceFrequencyKernel | ||
55 | 59 | { | { |
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 | //- Dictionary | ||
70 | const dictionary& dict_; | ||
71 | |||
72 | //- Mesh | ||
73 | const fvMesh& mesh_; | ||
74 | |||
75 | //- Coefficient of aggregation kernel | ||
76 | const dimensionedScalar Ca_; | ||
77 | |||
78 | |||
79 | 60 | public: | public: |
80 | 61 | ||
81 | 62 | //- Runtime type information | //- Runtime type information |
82 | TypeName("aggregationKernel"); | ||
63 | TypeName("coalescenceFrequencyKernel"); | ||
83 | 64 | ||
84 | 65 | // Declare runtime constructor selection table | // Declare runtime constructor selection table |
85 | 66 | declareRunTimeSelectionTable | declareRunTimeSelectionTable |
86 | 67 | ( | ( |
87 | 68 | autoPtr, | autoPtr, |
88 | aggregationKernel, | ||
69 | coalescenceFrequencyKernel, | ||
89 | 70 | dictionary, | dictionary, |
90 | 71 | ( | ( |
91 | 72 | const dictionary& dict, | const dictionary& dict, |
92 | const fvMesh& mesh | ||
73 | const fvMesh& mesh, | ||
74 | const word& continuousPhase | ||
93 | 75 | ), | ), |
94 | (dict, mesh) | ||
76 | (dict, mesh, continuousPhase) | ||
95 | 77 | ); | ); |
96 | 78 | ||
97 | 79 | ||
98 | 80 | // Constructors | // Constructors |
99 | 81 | ||
100 | 82 | //- Construct from components | //- Construct from components |
101 | aggregationKernel | ||
83 | coalescenceFrequencyKernel | ||
102 | 84 | ( | ( |
103 | 85 | const dictionary& dict, | const dictionary& dict, |
104 | const fvMesh& mesh | ||
86 | const fvMesh& mesh, | ||
87 | const word& continuousPhase | ||
105 | 88 | ); | ); |
106 | 89 | ||
90 | //- Disallow default bitwise copy construct | ||
91 | coalescenceFrequencyKernel(const coalescenceFrequencyKernel&) = delete; | ||
92 | |||
107 | 93 | ||
108 | 94 | // Selectors | // Selectors |
109 | 95 | ||
110 | static autoPtr<aggregationKernel> New | ||
96 | static autoPtr<coalescenceFrequencyKernel> New | ||
111 | 97 | ( | ( |
112 | 98 | const dictionary& dict, | const dictionary& dict, |
113 | const fvMesh& mesh | ||
99 | const fvMesh& mesh, | ||
100 | const word& continuousPhase | ||
114 | 101 | ); | ); |
115 | 102 | ||
116 | 103 | ||
117 | 104 | //- Destructor | //- Destructor |
118 | virtual ~aggregationKernel(); | ||
105 | virtual ~coalescenceFrequencyKernel(); | ||
119 | 106 | ||
120 | 107 | ||
121 | 108 | // Member Functions | // Member Functions |
122 | 109 | ||
110 | //- Update fields | ||
111 | virtual void update | ||
112 | ( | ||
113 | const fluidThermo& thermo, | ||
114 | const turbulenceModel& turb | ||
115 | ) | ||
116 | {} | ||
117 | |||
123 | 118 | //- Aggregation kernel | //- Aggregation kernel |
124 | virtual scalar Ka | ||
119 | virtual scalar omega | ||
125 | 120 | ( | ( |
126 | const scalar& abscissa1, | ||
127 | const scalar& abscissa2, | ||
128 | const label celli, | ||
129 | const label environment = 0 | ||
121 | const scalar& d1, | ||
122 | const scalar& d2, | ||
123 | const vector& Ur, | ||
124 | const label celli | ||
130 | 125 | ) const = 0; | ) const = 0; |
126 | |||
127 | |||
128 | // Member Operators | ||
129 | |||
130 | //- Disallow default bitwise assignment | ||
131 | void operator=(const coalescenceFrequencyKernel&) = delete; | ||
131 | 132 | }; | }; |
132 | 133 | ||
133 | 134 | ||
134 | 135 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
135 | 136 | ||
137 | } // End namespace aggregationKernels | ||
136 | 138 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
137 | 139 | } // End namespace Foam | } // End namespace Foam |
138 | 140 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/coalescenceFrequencyKernel/newCoalescenceFrequencyKernel.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/collisionKernel/newCollisionKernel.C (similarity 64%) (mode: 100644) (index 46e5163..e54ff7e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "collisionKernel.H" | ||
26 | #include "coalescenceFrequencyKernel.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // |
29 | 29 | ||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::collisionKernel> | ||
31 | Foam::populationBalanceSubModels::collisionKernel::New | ||
30 | Foam::autoPtr | ||
31 | < | ||
32 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
33 | coalescenceFrequencyKernel | ||
34 | > | ||
35 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
36 | coalescenceFrequencyKernel::New | ||
32 | 37 | ( | ( |
33 | 38 | const dictionary& dict, | const dictionary& dict, |
34 | 39 | const fvMesh& mesh, | const fvMesh& mesh, |
35 | const velocityQuadratureApproximation& quadrature, | ||
36 | const bool ode | ||
40 | const word& continuousPhase | ||
37 | 41 | ) | ) |
38 | 42 | { | { |
39 | word collisionKernelType(dict.lookup("collisionKernel")); | ||
43 | word coalescenceFrequencyKernelType | ||
44 | ( | ||
45 | dict.lookup("frequency") | ||
46 | ); | ||
40 | 47 | ||
41 | Info<< "Selecting collisionKernel: " | ||
42 | << collisionKernelType << endl; | ||
48 | Info<< "Selecting coalescence frequency type " | ||
49 | << coalescenceFrequencyKernelType << endl; | ||
43 | 50 | ||
44 | 51 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
45 | dictionaryConstructorTablePtr_->find(collisionKernelType); | ||
52 | dictionaryConstructorTablePtr_->find(coalescenceFrequencyKernelType); | ||
46 | 53 | ||
47 | 54 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
48 | 55 | { | { |
49 | 56 | FatalErrorInFunction | FatalErrorInFunction |
50 | << "Unknown collisionKernelType type " | ||
51 | << collisionKernelType << endl << endl | ||
52 | << "Valid collisionKernelType types are :" << endl | ||
57 | << "Unknown coalescence frequency type " | ||
58 | << coalescenceFrequencyKernelType << endl << endl | ||
59 | << "Valid coalescence frequency types are :" << endl | ||
53 | 60 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
54 | 61 | << abort(FatalError); | << abort(FatalError); |
55 | 62 | } | } |
56 | 63 | ||
57 | return autoPtr<collisionKernel> | ||
64 | return autoPtr<coalescenceFrequencyKernel> | ||
58 | 65 | ( | ( |
59 | cstrIter() | ||
60 | ( | ||
61 | dict, | ||
62 | mesh, | ||
63 | quadrature, | ||
64 | ode | ||
65 | ) | ||
66 | cstrIter()(dict, mesh, continuousPhase) | ||
66 | 67 | ); | ); |
67 | 68 | } | } |
68 | 69 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/shearRate/shearRateFrequency.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.C (similarity 69%) (mode: 100644) (index 63973a3..f1aa8d5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "differentialForceAggregation.H" | ||
26 | #include "shearRateFrequency.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "fundamentalConstants.H" | ||
28 | 29 | ||
29 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 31 | ||
... | ... | namespace populationBalanceSubModels | |
34 | 35 | { | { |
35 | 36 | namespace aggregationKernels | namespace aggregationKernels |
36 | 37 | { | { |
37 | defineTypeNameAndDebug(differentialForceAggregation, 0); | ||
38 | namespace coalescenceFrequencyKernels | ||
39 | { | ||
40 | defineTypeNameAndDebug(shearRate, 0); | ||
38 | 41 | ||
39 | 42 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
40 | 43 | ( | ( |
41 | aggregationKernel, | ||
42 | differentialForceAggregation, | ||
44 | coalescenceFrequencyKernel, | ||
45 | shearRate, | ||
43 | 46 | dictionary | dictionary |
44 | 47 | ); | ); |
45 | 48 | } | } |
46 | 49 | } | } |
47 | 50 | } | } |
51 | } | ||
48 | 52 | ||
49 | 53 | ||
50 | 54 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
51 | 55 | ||
52 | Foam::populationBalanceSubModels::aggregationKernels | ||
53 | ::differentialForceAggregation::differentialForceAggregation | ||
56 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
57 | coalescenceFrequencyKernels::shearRate::shearRate | ||
54 | 58 | ( | ( |
55 | 59 | const dictionary& dict, | const dictionary& dict, |
56 | const fvMesh& mesh | ||
60 | const fvMesh& mesh, | ||
61 | const word& continuousPhase | ||
57 | 62 | ) | ) |
58 | 63 | : | : |
59 | aggregationKernel(dict, mesh) | ||
64 | coalescenceFrequencyKernel(dict, mesh, continuousPhase) | ||
60 | 65 | {} | {} |
61 | 66 | ||
62 | 67 | ||
63 | 68 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
64 | 69 | ||
65 | Foam::populationBalanceSubModels::aggregationKernels | ||
66 | ::differentialForceAggregation::~differentialForceAggregation() | ||
70 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
71 | coalescenceFrequencyKernels::shearRate::~shearRate() | ||
67 | 72 | {} | {} |
68 | 73 | ||
69 | 74 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels | |
71 | 76 | ||
72 | 77 | Foam::scalar | Foam::scalar |
73 | 78 | Foam::populationBalanceSubModels::aggregationKernels:: | Foam::populationBalanceSubModels::aggregationKernels:: |
74 | differentialForceAggregation::Ka | ||
79 | coalescenceFrequencyKernels::shearRate::omega | ||
75 | 80 | ( | ( |
76 | const scalar& abscissa1, | ||
77 | const scalar& abscissa2, | ||
78 | const label celli, | ||
79 | const label environment | ||
81 | const scalar& d1, | ||
82 | const scalar& d2, | ||
83 | const vector& Ur, | ||
84 | const label celli | ||
80 | 85 | ) const | ) const |
81 | 86 | { | { |
82 | return Ca_.value()*sqr(abscissa1 + abscissa2) | ||
83 | *mag(sqr(abscissa1) - sqr(abscissa2)); | ||
87 | return Foam::constant::mathematical::pi*sqr(d1 + d2)*mag(Ur); | ||
84 | 88 | } | } |
85 | 89 | ||
86 | 90 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceFrequencyKernels/shearRate/shearRateFrequency.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.H (similarity 68%) (mode: 100644) (index 034f42e..a4e958e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::aggregationKernels::differentialForceAggregation | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::shearRate | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Differential force aggregation kernel with user defined coefficient | ||
29 | (default Cagg = 1). | ||
28 | Coalescence model for droplets of O'Rourke | ||
30 | 29 | ||
31 | 30 | \f[ | \f[ |
32 | K_a = C_a (\xi_i + \xi_j)^2 |\xi_i^2 - \xi_j^2| | ||
31 | \omega = \pi \left( d_i + d_j \right)^2 |U_i - U_j| | ||
33 | 32 | \f] | \f] |
34 | 33 | ||
35 | 34 | where | where |
36 | 35 | ||
37 | 36 | \vartable | \vartable |
38 | C_a | Aggregation coefficient [1/s] | ||
39 | \xi_i | Abscissa of particle i [m] | ||
40 | \xi_j | Abscissa of particle j [m] | ||
37 | d_i | Diameter of bubble i [m] | ||
38 | d_j | Diameter of bubble j [m] | ||
39 | U_i | Velocity of bubble i [m] | ||
40 | U_j | Velocity of bubble j [m] | ||
41 | 41 | \endvartable | \endvartable |
42 | 42 | ||
43 | References | ||
44 | \verbatim | ||
45 | |||
46 | \endverbatim | ||
47 | |||
43 | 48 | SourceFiles | SourceFiles |
44 | differentialForceAggregation.C | ||
49 | shearRateFrequency.C | ||
45 | 50 | ||
46 | 51 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
47 | 52 | ||
48 | #ifndef differentialForceAggregation_H | ||
49 | #define differentialForceAggregation_H | ||
53 | #ifndef shearRateFrequency_H | ||
54 | #define shearRateFrequency_H | ||
50 | 55 | ||
51 | #include "aggregationKernel.H" | ||
56 | #include "coalescenceFrequencyKernel.H" | ||
52 | 57 | ||
53 | 58 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
54 | 59 | ||
... | ... | namespace populationBalanceSubModels | |
58 | 63 | { | { |
59 | 64 | namespace aggregationKernels | namespace aggregationKernels |
60 | 65 | { | { |
66 | namespace coalescenceFrequencyKernels | ||
67 | { | ||
61 | 68 | ||
62 | 69 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
63 | Class differentialForceAggregation Declaration | ||
70 | Class shearRate Declaration | ||
64 | 71 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
65 | 72 | ||
66 | class differentialForceAggregation | ||
73 | class shearRate | ||
67 | 74 | : | : |
68 | public aggregationKernel | ||
75 | public coalescenceFrequencyKernel | ||
69 | 76 | { | { |
70 | 77 | public: | public: |
71 | 78 | ||
72 | 79 | //- Runtime type information | //- Runtime type information |
73 | TypeName("differentialForce"); | ||
80 | TypeName("shearRate"); | ||
74 | 81 | ||
75 | 82 | ||
76 | 83 | // Constructors | // Constructors |
77 | 84 | ||
78 | 85 | //- Construct from components | //- Construct from components |
79 | differentialForceAggregation | ||
86 | shearRate | ||
80 | 87 | ( | ( |
81 | 88 | const dictionary& dict, | const dictionary& dict, |
82 | const fvMesh& mesh | ||
89 | const fvMesh& mesh, | ||
90 | const word& continuousPhase | ||
83 | 91 | ); | ); |
84 | 92 | ||
85 | 93 | ||
86 | 94 | //- Destructor | //- Destructor |
87 | virtual ~differentialForceAggregation(); | ||
95 | virtual ~shearRate(); | ||
88 | 96 | ||
89 | 97 | ||
90 | 98 | // Member Functions | // Member Functions |
91 | 99 | ||
92 | 100 | //- Aggregation kernel | //- Aggregation kernel |
93 | virtual scalar Ka | ||
101 | virtual scalar omega | ||
94 | 102 | ( | ( |
95 | 103 | const scalar& abscissa1, | const scalar& abscissa1, |
96 | 104 | const scalar& abscissa2, | const scalar& abscissa2, |
97 | const label celli, | ||
98 | const label environment = 0 | ||
105 | const vector& Ur, | ||
106 | const label celli | ||
99 | 107 | ) const; | ) const; |
100 | 108 | ||
101 | 109 | }; | }; |
... | ... | public: | |
103 | 111 | ||
104 | 112 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
105 | 113 | ||
114 | } // End namespace coalescenceFrequencyKernels | ||
106 | 115 | } // End namespace aggregationKernels | } // End namespace aggregationKernels |
107 | 116 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
108 | 117 | } // End namespace Foam | } // End namespace Foam |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceKernel.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C (similarity 55%) (mode: 100644) (index 8c8da75..582dec2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2017-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "turbulentBrownian.H" | ||
26 | #include "coalescenceKernel.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "fundamentalConstants.H" | ||
29 | 28 | ||
30 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
31 | 30 | ||
... | ... | namespace populationBalanceSubModels | |
35 | 34 | { | { |
36 | 35 | namespace aggregationKernels | namespace aggregationKernels |
37 | 36 | { | { |
38 | defineTypeNameAndDebug(turbulentBrownian, 0); | ||
37 | defineTypeNameAndDebug(coalescence, 0); | ||
39 | 38 | ||
40 | 39 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
41 | 40 | ( | ( |
42 | 41 | aggregationKernel, | aggregationKernel, |
43 | turbulentBrownian, | ||
42 | coalescence, | ||
44 | 43 | dictionary | dictionary |
45 | 44 | ); | ); |
46 | 45 | } | } |
47 | 46 | } | } |
48 | 47 | } | } |
49 | |||
50 | |||
51 | 48 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
52 | 49 | ||
53 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | ||
54 | ::turbulentBrownian | ||
50 | Foam::populationBalanceSubModels::aggregationKernels::coalescence:: | ||
51 | coalescence | ||
55 | 52 | ( | ( |
56 | 53 | const dictionary& dict, | const dictionary& dict, |
57 | 54 | const fvMesh& mesh | const fvMesh& mesh |
58 | 55 | ) | ) |
59 | 56 | : | : |
60 | 57 | aggregationKernel(dict, mesh), | aggregationKernel(dict, mesh), |
61 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
62 | flTurb_ | ||
58 | continuousPhase_(dict.lookup("continuousPhase")), | ||
59 | frequency_ | ||
63 | 60 | ( | ( |
64 | mesh_.lookupObject<compressible::turbulenceModel> | ||
65 | ( | ||
66 | turbulenceModel::propertiesName | ||
67 | ) | ||
61 | coalescenceFrequencyKernel::New(dict, mesh, continuousPhase_) | ||
68 | 62 | ), | ), |
69 | T_(flThermo_.T()), | ||
70 | rho_(flThermo_.rho()), | ||
71 | mu_(flThermo_.mu()), | ||
72 | epsilon_(flTurb_.epsilon()) | ||
63 | efficiency_ | ||
64 | ( | ||
65 | coalescenceEfficiencyKernel::New(dict, mesh, continuousPhase_) | ||
66 | ) | ||
73 | 67 | {} | {} |
74 | 68 | ||
75 | 69 | ||
76 | 70 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
77 | 71 | ||
78 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | ||
79 | ::~turbulentBrownian() | ||
72 | Foam::populationBalanceSubModels::aggregationKernels::coalescence:: | ||
73 | ~coalescence() | ||
80 | 74 | {} | {} |
81 | 75 | ||
82 | 76 | ||
83 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
77 | // * * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * * // | ||
78 | |||
79 | void Foam::populationBalanceSubModels::aggregationKernels::coalescence:: | ||
80 | preUpdate() | ||
81 | { | ||
82 | const fluidThermo& thermo = | ||
83 | mesh_.lookupObject<fluidThermo> | ||
84 | ( | ||
85 | IOobject::groupName | ||
86 | ( | ||
87 | basicThermo::dictName, | ||
88 | continuousPhase_ | ||
89 | ) | ||
90 | ); | ||
91 | |||
92 | const turbulenceModel& turb = | ||
93 | mesh_.lookupObject<turbulenceModel> | ||
94 | ( | ||
95 | IOobject::groupName | ||
96 | ( | ||
97 | turbulenceModel::propertiesName, | ||
98 | continuousPhase_ | ||
99 | ) | ||
100 | ); | ||
101 | |||
102 | frequency_->update(thermo, turb); | ||
103 | efficiency_->update(thermo, turb); | ||
104 | } | ||
84 | 105 | ||
85 | 106 | Foam::scalar | Foam::scalar |
86 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian::Ka | ||
107 | Foam::populationBalanceSubModels::aggregationKernels::coalescence::Ka | ||
87 | 108 | ( | ( |
88 | const scalar& abscissa1, | ||
89 | const scalar& abscissa2, | ||
109 | const scalar& d1, | ||
110 | const scalar& d2, | ||
111 | const vector& Ur, | ||
90 | 112 | const label celli, | const label celli, |
91 | 113 | const label environment | const label environment |
92 | 114 | ) const | ) const |
93 | 115 | { | { |
94 | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] | ||
95 | *sqr(abscissa1 + abscissa2)/(3.0*mu_[celli] | ||
96 | *max(abscissa1*abscissa2, SMALL)) + 4.0/3.0*pow3(abscissa1 + abscissa2) | ||
97 | *sqrt(3.0*Foam::constant::mathematical::pi*epsilon_[celli] | ||
98 | /(10.0*mu_[celli]/rho_[celli])); | ||
116 | return | ||
117 | Ca_.value()*frequency_->omega(d1, d2, Ur, celli) | ||
118 | *efficiency_->Pc(d1, d2, Ur, celli); | ||
99 | 119 | } | } |
100 | 120 | ||
121 | |||
101 | 122 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/coalescenceKernels/coalescenceKernel.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.H (similarity 61%) (mode: 100644) (index 034f42e..b489057) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2017-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::aggregationKernels::differentialForceAggregation | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::coalescence | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Differential force aggregation kernel with user defined coefficient | ||
29 | (default Cagg = 1). | ||
30 | |||
31 | \f[ | ||
32 | K_a = C_a (\xi_i + \xi_j)^2 |\xi_i^2 - \xi_j^2| | ||
33 | \f] | ||
34 | |||
35 | where | ||
36 | |||
37 | \vartable | ||
38 | C_a | Aggregation coefficient [1/s] | ||
39 | \xi_i | Abscissa of particle i [m] | ||
40 | \xi_j | Abscissa of particle j [m] | ||
41 | \endvartable | ||
28 | Class to calculate the coalescence rate for bubbles based on coalescence | ||
29 | frequency and efficiency. | ||
42 | 30 | ||
43 | 31 | SourceFiles | SourceFiles |
44 | differentialForceAggregation.C | ||
32 | coalescenceKernel.C | ||
45 | 33 | ||
46 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
47 | 35 | ||
48 | #ifndef differentialForceAggregation_H | ||
49 | #define differentialForceAggregation_H | ||
36 | #ifndef coalescenceKernel_H | ||
37 | #define coalescenceKernel_H | ||
50 | 38 | ||
51 | 39 | #include "aggregationKernel.H" | #include "aggregationKernel.H" |
40 | #include "dictionary.H" | ||
41 | #include "volFields.H" | ||
42 | #include "dimensionedTypes.H" | ||
43 | #include "turbulentFluidThermoModel.H" | ||
44 | #include "coalescenceFrequencyKernel.H" | ||
45 | #include "coalescenceEfficiencyKernel.H" | ||
52 | 46 | ||
53 | 47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
54 | 48 | ||
... | ... | namespace aggregationKernels | |
60 | 54 | { | { |
61 | 55 | ||
62 | 56 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
63 | Class differentialForceAggregation Declaration | ||
57 | Class coalescenceKernel Declaration | ||
64 | 58 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
65 | 59 | ||
66 | class differentialForceAggregation | ||
60 | class coalescence | ||
67 | 61 | : | : |
68 | 62 | public aggregationKernel | public aggregationKernel |
69 | 63 | { | { |
70 | public: | ||
64 | // Private data | ||
71 | 65 | ||
72 | //- Runtime type information | ||
73 | TypeName("differentialForce"); | ||
66 | //- continuous phase name | ||
67 | const word continuousPhase_; | ||
74 | 68 | ||
69 | //- Coalescence frequency model | ||
70 | autoPtr<coalescenceFrequencyKernel> frequency_; | ||
75 | 71 | ||
76 | // Constructors | ||
72 | //- Coalescence effeciency model | ||
73 | autoPtr<coalescenceEfficiencyKernel> efficiency_; | ||
77 | 74 | ||
78 | //- Construct from components | ||
79 | differentialForceAggregation | ||
80 | ( | ||
81 | const dictionary& dict, | ||
82 | const fvMesh& mesh | ||
83 | ); | ||
84 | 75 | ||
76 | public: | ||
85 | 77 | ||
86 | //- Destructor | ||
87 | virtual ~differentialForceAggregation(); | ||
78 | //- Runtime type information | ||
79 | TypeName("coalescence"); | ||
80 | |||
81 | // Constructor | ||
82 | coalescence | ||
83 | ( | ||
84 | const dictionary& dict, | ||
85 | const fvMesh& mesh | ||
86 | ); | ||
88 | 87 | ||
89 | 88 | ||
89 | //- Destructor | ||
90 | virtual ~coalescence(); | ||
91 | |||
90 | 92 | // Member Functions | // Member Functions |
91 | 93 | ||
92 | //- Aggregation kernel | ||
93 | virtual scalar Ka | ||
94 | //- Return true if source is only depenent on size | ||
95 | virtual bool pureSize() const | ||
96 | { | ||
97 | return false; | ||
98 | } | ||
99 | |||
100 | //- Update fields | ||
101 | virtual void preUpdate(); | ||
102 | |||
103 | //- Coalescence kernel for a cell | ||
104 | scalar Ka | ||
94 | 105 | ( | ( |
95 | const scalar& abscissa1, | ||
96 | const scalar& abscissa2, | ||
106 | const scalar& d1, | ||
107 | const scalar& d2, | ||
108 | const vector& Ur, | ||
97 | 109 | const label celli, | const label celli, |
98 | 110 | const label environment = 0 | const label environment = 0 |
99 | 111 | ) const; | ) const; |
100 | |||
101 | 112 | }; | }; |
102 | 113 | ||
103 | 114 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.C changed (mode: 100644) (index d59309b..3414410) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | |
72 | 72 | Foam::scalar | Foam::scalar |
73 | 73 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka |
74 | 74 | ( | ( |
75 | const scalar& abscissa1, | ||
76 | const scalar& abscissa2, | ||
75 | const scalar& d1, | ||
76 | const scalar& d2, | ||
77 | const vector& Ur, | ||
77 | 78 | const label celli, | const label celli, |
78 | 79 | const label environment | const label environment |
79 | 80 | ) const | ) const |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.H changed (mode: 100644) (index f93fb4b..bd4cfb6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
90 | 90 | //- Aggregation kernel | //- Aggregation kernel |
91 | 91 | virtual scalar Ka | virtual scalar Ka |
92 | 92 | ( | ( |
93 | const scalar& abscissa1, | ||
94 | const scalar& abscissa2, | ||
93 | const scalar& d1, | ||
94 | const scalar& d2, | ||
95 | const vector& Ur, | ||
95 | 96 | const label celli, | const label celli, |
96 | 97 | const label environment = 0 | const label environment = 0 |
97 | 98 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.C changed (mode: 100644) (index 63973a3..5016d3e) | |||
... | ... | Foam::scalar | |
73 | 73 | Foam::populationBalanceSubModels::aggregationKernels:: | Foam::populationBalanceSubModels::aggregationKernels:: |
74 | 74 | differentialForceAggregation::Ka | differentialForceAggregation::Ka |
75 | 75 | ( | ( |
76 | const scalar& abscissa1, | ||
77 | const scalar& abscissa2, | ||
76 | const scalar& d1, | ||
77 | const scalar& d2, | ||
78 | const vector& Ur, | ||
78 | 79 | const label celli, | const label celli, |
79 | 80 | const label environment | const label environment |
80 | 81 | ) const | ) const |
81 | 82 | { | { |
82 | return Ca_.value()*sqr(abscissa1 + abscissa2) | ||
83 | *mag(sqr(abscissa1) - sqr(abscissa2)); | ||
83 | return Ca_.value()*sqr(d1 + d2)*mag(sqr(d1) - sqr(d2)); | ||
84 | 84 | } | } |
85 | 85 | ||
86 | 86 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.H changed (mode: 100644) (index 034f42e..678dfa5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
92 | 92 | //- Aggregation kernel | //- Aggregation kernel |
93 | 93 | virtual scalar Ka | virtual scalar Ka |
94 | 94 | ( | ( |
95 | const scalar& abscissa1, | ||
96 | const scalar& abscissa2, | ||
95 | const scalar& d1, | ||
96 | const scalar& d2, | ||
97 | const vector& Ur, | ||
97 | 98 | const label celli, | const label celli, |
98 | 99 | const label environment = 0 | const label environment = 0 |
99 | 100 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.C changed (mode: 100644) (index 76f34b3..e95b99f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::scalar | |
73 | 73 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation:: | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation:: |
74 | 74 | Ka | Ka |
75 | 75 | ( | ( |
76 | const scalar& abscissa1, | ||
77 | const scalar& abscissa2, | ||
76 | const scalar& d1, | ||
77 | const scalar& d2, | ||
78 | const vector& Ur, | ||
78 | 79 | const label celli, | const label celli, |
79 | 80 | const label environment | const label environment |
80 | 81 | ) const | ) const |
81 | 82 | { | { |
82 | return Ca_.value()*pow3(abscissa1 + abscissa2); | ||
83 | return Ca_.value()*pow3(d1 + d2); | ||
83 | 84 | } | } |
84 | 85 | ||
85 | 86 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.H changed (mode: 100644) (index 27afe46..504f250) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
94 | 94 | ( | ( |
95 | 95 | const scalar& abscissa1, | const scalar& abscissa1, |
96 | 96 | const scalar& abscissa2, | const scalar& abscissa2, |
97 | const vector& Ur, | ||
97 | 98 | const label celli, | const label celli, |
98 | 99 | const label environment = 0 | const label environment = 0 |
99 | 100 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C changed (mode: 100644) (index 049f300..5f4a906) | |||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | |
72 | 72 | Foam::scalar | Foam::scalar |
73 | 73 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation::Ka | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation::Ka |
74 | 74 | ( | ( |
75 | const scalar& abscissa1, | ||
76 | const scalar& abscissa2, | ||
75 | const scalar& d1, | ||
76 | const scalar& d2, | ||
77 | const vector& Ur, | ||
77 | 78 | const label celli, | const label celli, |
78 | 79 | const label environment | const label environment |
79 | 80 | ) const | ) const |
80 | 81 | { | { |
81 | return Ca_.value()*(pow3(abscissa1) + pow3(abscissa2)); | ||
82 | return Ca_.value()*(pow3(d1) + pow3(d2)); | ||
82 | 83 | } | } |
83 | 84 | ||
84 | 85 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.H changed (mode: 100644) (index 8910435..60750ec) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
91 | 91 | //- Aggregation kernel | //- Aggregation kernel |
92 | 92 | virtual scalar Ka | virtual scalar Ka |
93 | 93 | ( | ( |
94 | const scalar& abscissa1, | ||
95 | const scalar& abscissa2, | ||
94 | const scalar& d1, | ||
95 | const scalar& d2, | ||
96 | const vector& Ur, | ||
96 | 97 | const label celli, | const label celli, |
97 | 98 | const label environment = 0 | const label environment = 0 |
98 | 99 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C changed (mode: 100644) (index 8c8da75..2b730aa) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | |
58 | 58 | ) | ) |
59 | 59 | : | : |
60 | 60 | aggregationKernel(dict, mesh), | aggregationKernel(dict, mesh), |
61 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
61 | continuousPhase_(dict.lookupOrDefault("continuousPhase", word::null)), | ||
62 | flThermo_ | ||
63 | ( | ||
64 | mesh_.lookupObject<fluidThermo> | ||
65 | ( | ||
66 | IOobject::groupName(basicThermo::dictName, continuousPhase_) | ||
67 | ) | ||
68 | ), | ||
62 | 69 | flTurb_ | flTurb_ |
63 | 70 | ( | ( |
64 | mesh_.lookupObject<compressible::turbulenceModel> | ||
71 | mesh_.lookupObject<turbulenceModel> | ||
65 | 72 | ( | ( |
66 | turbulenceModel::propertiesName | ||
73 | IOobject::groupName | ||
74 | ( | ||
75 | turbulenceModel::propertiesName, | ||
76 | continuousPhase_ | ||
77 | ) | ||
67 | 78 | ) | ) |
68 | 79 | ), | ), |
69 | 80 | T_(flThermo_.T()), | T_(flThermo_.T()), |
... | ... | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | |
85 | 96 | Foam::scalar | Foam::scalar |
86 | 97 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian::Ka | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian::Ka |
87 | 98 | ( | ( |
88 | const scalar& abscissa1, | ||
89 | const scalar& abscissa2, | ||
99 | const scalar& d1, | ||
100 | const scalar& d2, | ||
101 | const vector& Ur, | ||
90 | 102 | const label celli, | const label celli, |
91 | 103 | const label environment | const label environment |
92 | 104 | ) const | ) const |
93 | 105 | { | { |
94 | 106 | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] |
95 | *sqr(abscissa1 + abscissa2)/(3.0*mu_[celli] | ||
96 | *max(abscissa1*abscissa2, SMALL)) + 4.0/3.0*pow3(abscissa1 + abscissa2) | ||
107 | *sqr(d1 + d2)/(3.0*mu_[celli] | ||
108 | *max(d1*d2, small)) + 4.0/3.0*pow3(d1 + d2) | ||
97 | 109 | *sqrt(3.0*Foam::constant::mathematical::pi*epsilon_[celli] | *sqrt(3.0*Foam::constant::mathematical::pi*epsilon_[celli] |
98 | 110 | /(10.0*mu_[celli]/rho_[celli])); | /(10.0*mu_[celli]/rho_[celli])); |
99 | 111 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.H changed (mode: 100644) (index 9c2bf34..d210995) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class turbulentBrownian | |
94 | 94 | { | { |
95 | 95 | // Private data | // Private data |
96 | 96 | ||
97 | //- Continuous phase name | ||
98 | const word continuousPhase_; | ||
99 | |||
97 | 100 | //- Thermo model | //- Thermo model |
98 | 101 | const fluidThermo& flThermo_; | const fluidThermo& flThermo_; |
99 | 102 | ||
100 | 103 | //- Turbulence model | //- Turbulence model |
101 | const compressible::turbulenceModel& flTurb_; | ||
104 | const turbulenceModel& flTurb_; | ||
102 | 105 | ||
103 | 106 | //- Temperature field | //- Temperature field |
104 | 107 | const volScalarField& T_; | const volScalarField& T_; |
... | ... | public: | |
140 | 143 | ( | ( |
141 | 144 | const scalar& abscissa1, | const scalar& abscissa1, |
142 | 145 | const scalar& abscissa2, | const scalar& abscissa2, |
146 | const vector& Ur, | ||
143 | 147 | const label celli, | const label celli, |
144 | 148 | const label environment = 0 | const label environment = 0 |
145 | 149 | ) const; | ) const; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C changed (mode: 100644) (index dea8446..0ccde45) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou | |
57 | 57 | ) | ) |
58 | 58 | : | : |
59 | 59 | breakupKernel(dict, mesh), | breakupKernel(dict, mesh), |
60 | continuousPhase_(dict.lookupOrDefault("continuousPhase", word::null)), | ||
60 | 61 | A_(dict.lookup("A")), | A_(dict.lookup("A")), |
61 | 62 | df_(dict.lookup("df")), | df_(dict.lookup("df")), |
62 | 63 | H0_(dict.lookup("H0")), | H0_(dict.lookup("H0")), |
63 | 64 | primarySize_(dict.lookup("primarySize")), | primarySize_(dict.lookup("primarySize")), |
64 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
65 | flThermo_ | ||
66 | ( | ||
67 | mesh_.lookupObject<fluidThermo> | ||
68 | ( | ||
69 | IOobject::groupName(basicThermo::dictName, continuousPhase_) | ||
70 | ) | ||
71 | ), | ||
65 | 72 | flTurb_ | flTurb_ |
66 | 73 | ( | ( |
67 | mesh_.lookupObject<compressible::turbulenceModel> | ||
74 | mesh_.lookupObject<turbulenceModel> | ||
68 | 75 | ( | ( |
69 | turbulenceModel::propertiesName | ||
76 | IOobject::groupName | ||
77 | ( | ||
78 | turbulenceModel::propertiesName, | ||
79 | continuousPhase_ | ||
80 | ) | ||
70 | 81 | ) | ) |
71 | 82 | ), | ), |
72 | 83 | epsilon_(flTurb_.epsilon()), | epsilon_(flTurb_.epsilon()), |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.H changed (mode: 100644) (index bb8b669..fe5577a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | private: | |
68 | 68 | ||
69 | 69 | // Private data | // Private data |
70 | 70 | ||
71 | //- Continuous phase name | ||
72 | const word continuousPhase_; | ||
73 | |||
71 | 74 | //- Hamaker constant | //- Hamaker constant |
72 | 75 | dimensionedScalar A_; | dimensionedScalar A_; |
73 | 76 | ||
... | ... | private: | |
84 | 87 | const fluidThermo& flThermo_; | const fluidThermo& flThermo_; |
85 | 88 | ||
86 | 89 | //- Turbulence model | //- Turbulence model |
87 | const compressible::turbulenceModel& flTurb_; | ||
90 | const turbulenceModel& flTurb_; | ||
88 | 91 | ||
89 | 92 | //- Turbulent dissipation rate | //- Turbulent dissipation rate |
90 | 93 | const volScalarField& epsilon_; | const volScalarField& epsilon_; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.C changed (mode: 100644) (index 9ad4a9f..bad1b13) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen | |
57 | 57 | ) | ) |
58 | 58 | : | : |
59 | 59 | breakupKernel(dict, mesh), | breakupKernel(dict, mesh), |
60 | continuousPhase_(dict.lookupOrDefault("continuousPhase", word::null)), | ||
60 | 61 | Cb_(dict.lookup("Cb")), | Cb_(dict.lookup("Cb")), |
61 | 62 | epsilonExp_(readScalar(dict.lookup("epsilonExp"))), | epsilonExp_(readScalar(dict.lookup("epsilonExp"))), |
62 | 63 | nuExp_(readScalar(dict.lookup("nuExp"))), | nuExp_(readScalar(dict.lookup("nuExp"))), |
63 | 64 | sizeExp_(readScalar(dict.lookup("sizeExp"))), | sizeExp_(readScalar(dict.lookup("sizeExp"))), |
64 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
65 | flThermo_ | ||
66 | ( | ||
67 | mesh_.lookupObject<fluidThermo> | ||
68 | ( | ||
69 | IOobject::groupName(basicThermo::dictName, continuousPhase_) | ||
70 | ) | ||
71 | ), | ||
65 | 72 | flTurb_ | flTurb_ |
66 | 73 | ( | ( |
67 | mesh_.lookupObject<compressible::turbulenceModel> | ||
74 | mesh_.lookupObject<turbulenceModel> | ||
68 | 75 | ( | ( |
69 | turbulenceModel::propertiesName | ||
76 | IOobject::groupName | ||
77 | ( | ||
78 | turbulenceModel::propertiesName, | ||
79 | continuousPhase_ | ||
80 | ) | ||
70 | 81 | ) | ) |
71 | 82 | ), | ), |
72 | 83 | epsilon_(flTurb_.epsilon()), | epsilon_(flTurb_.epsilon()), |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.H changed (mode: 100644) (index 42268a6..2303eff) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | private: | |
67 | 67 | ||
68 | 68 | // Private data | // Private data |
69 | 69 | ||
70 | //- Continuous phase name | ||
71 | const word continuousPhase_; | ||
72 | |||
70 | 73 | //- Model coefficient | //- Model coefficient |
71 | 74 | dimensionedScalar Cb_; | dimensionedScalar Cb_; |
72 | 75 | ||
... | ... | private: | |
83 | 86 | const fluidThermo& flThermo_; | const fluidThermo& flThermo_; |
84 | 87 | ||
85 | 88 | //- Turbulence model | //- Turbulence model |
86 | const compressible::turbulenceModel& flTurb_; | ||
89 | const turbulenceModel& flTurb_; | ||
87 | 90 | ||
88 | 91 | //- Turbulent dissipation rate | //- Turbulent dissipation rate |
89 | 92 | const volScalarField& epsilon_; | const volScalarField& epsilon_; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C changed (mode: 100644) (index 1e4bf64..273a00d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::breakupKernel::breakupKernel | |
55 | 55 | "Cb", | "Cb", |
56 | 56 | dimensionedScalar("one", inv(dimTime), 1.0) | dimensionedScalar("one", inv(dimTime), 1.0) |
57 | 57 | ) | ) |
58 | ), | ||
59 | daughterDistribution_ | ||
60 | ( | ||
61 | Foam::populationBalanceSubModels::daughterDistribution::New | ||
62 | ( | ||
63 | dict.subDict("daughterDistribution") | ||
64 | ) | ||
58 | 65 | ) | ) |
59 | 66 | {} | {} |
60 | 67 | ||
... | ... | Foam::populationBalanceSubModels::breakupKernel::~breakupKernel() | |
65 | 72 | {} | {} |
66 | 73 | ||
67 | 74 | ||
75 | Foam::scalar | ||
76 | Foam::populationBalanceSubModels::breakupKernel::nodeSource | ||
77 | ( | ||
78 | const scalar& abscissa, | ||
79 | const label momentOrder | ||
80 | ) const | ||
81 | { | ||
82 | return | ||
83 | daughterDistribution_->mD(momentOrder, abscissa)//Birth | ||
84 | - pow(abscissa, momentOrder); | ||
85 | } | ||
86 | |||
87 | |||
88 | Foam::scalar | ||
89 | Foam::populationBalanceSubModels::breakupKernel::massNodeSource | ||
90 | ( | ||
91 | const scalar& abscissa, | ||
92 | const label momentOrder | ||
93 | ) const | ||
94 | { | ||
95 | return | ||
96 | daughterDistribution_->mDMass(momentOrder, abscissa)//Birth | ||
97 | - pow(abscissa, momentOrder); | ||
98 | } | ||
99 | |||
100 | |||
101 | Foam::scalar | ||
102 | Foam::populationBalanceSubModels::breakupKernel::breakupSource | ||
103 | ( | ||
104 | const labelList& momentOrder, | ||
105 | const label celli, | ||
106 | const scalarQuadratureApproximation& quadrature | ||
107 | ) | ||
108 | { | ||
109 | scalar bSource = 0.0; | ||
110 | |||
111 | const PtrList<volScalarNode>& nodes = quadrature.nodes(); | ||
112 | bool lengthBased = nodes[0].lengthBased(); | ||
113 | label sizeIndex = nodes[0].sizeIndex(); | ||
114 | |||
115 | if (sizeIndex == -1) | ||
116 | { | ||
117 | return bSource; | ||
118 | } | ||
119 | |||
120 | label sizeOrder = momentOrder[sizeIndex]; | ||
121 | bool volumeFraction = nodes[0].useVolumeFraction(); | ||
122 | |||
123 | if (volumeFraction) | ||
124 | { | ||
125 | if (lengthBased) | ||
126 | { | ||
127 | sizeOrder += 3; | ||
128 | } | ||
129 | else | ||
130 | { | ||
131 | sizeOrder += 1; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
136 | |||
137 | |||
138 | if (!nodes[0].extended()) | ||
139 | { | ||
140 | forAll(nodes, pNodei) | ||
141 | { | ||
142 | const volScalarNode& node = nodes[pNodei]; | ||
143 | |||
144 | scalar bAbscissa = | ||
145 | max(node.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
146 | |||
147 | scalar bSourcei = 0.0; | ||
148 | |||
149 | if (lengthBased) | ||
150 | { | ||
151 | bSourcei = nodeSource(bAbscissa, sizeOrder); | ||
152 | } | ||
153 | else | ||
154 | { | ||
155 | bSourcei = massNodeSource(bAbscissa, sizeOrder); | ||
156 | } | ||
157 | |||
158 | bSourcei *= | ||
159 | node.primaryWeight()[celli] | ||
160 | *Kb(bAbscissa, celli); | ||
161 | |||
162 | if (volumeFraction) | ||
163 | { | ||
164 | if (lengthBased) | ||
165 | { | ||
166 | bSourcei /= pow3(max(bAbscissa, small)); | ||
167 | } | ||
168 | else | ||
169 | { | ||
170 | bSourcei /= max(bAbscissa, small); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | forAll(scalarIndexes, nodei) | ||
175 | { | ||
176 | if (scalarIndexes[nodei] != sizeIndex) | ||
177 | { | ||
178 | bSourcei *= | ||
179 | pow | ||
180 | ( | ||
181 | node.primaryAbscissae()[nodei][celli], | ||
182 | momentOrder[scalarIndexes[nodei]] | ||
183 | ); | ||
184 | } | ||
185 | } | ||
186 | |||
187 | bSource += bSourcei; | ||
188 | } | ||
189 | |||
190 | return bSource; | ||
191 | } | ||
192 | |||
193 | forAll(nodes, pNodei) | ||
194 | { | ||
195 | const volScalarNode& node = nodes[pNodei]; | ||
196 | |||
197 | forAll(node.secondaryWeights()[0], sNodei) | ||
198 | { | ||
199 | scalar bAbscissa = | ||
200 | max(node.secondaryAbscissae()[sizeIndex][sNodei][celli], 0.0); | ||
201 | |||
202 | scalar bSourcei = 0.0; | ||
203 | |||
204 | if (lengthBased) | ||
205 | { | ||
206 | bSourcei = nodeSource(bAbscissa, sizeOrder); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | bSourcei = massNodeSource(bAbscissa, sizeOrder); | ||
211 | } | ||
212 | |||
213 | bSourcei *= | ||
214 | node.primaryWeight()[celli] | ||
215 | *node.secondaryWeights()[sizeIndex][sNodei][celli] | ||
216 | *Kb(bAbscissa, celli); | ||
217 | |||
218 | if (volumeFraction) | ||
219 | { | ||
220 | if (lengthBased) | ||
221 | { | ||
222 | bSourcei /= pow3(max(bAbscissa, small)); | ||
223 | } | ||
224 | else | ||
225 | { | ||
226 | bSourcei /= max(bAbscissa, small); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | forAll(scalarIndexes, cmpt) | ||
231 | { | ||
232 | if (scalarIndexes[cmpt] != sizeIndex) | ||
233 | { | ||
234 | bSourcei *= | ||
235 | node.secondaryWeights()[cmpt][sNodei][celli] | ||
236 | *pow | ||
237 | ( | ||
238 | node.secondaryAbscissae()[cmpt][sNodei][celli], | ||
239 | momentOrder[scalarIndexes[cmpt]] | ||
240 | ); | ||
241 | } | ||
242 | } | ||
243 | |||
244 | bSource += bSourcei; | ||
245 | } | ||
246 | } | ||
247 | |||
248 | return bSource; | ||
249 | } | ||
250 | |||
251 | Foam::scalar | ||
252 | Foam::populationBalanceSubModels::breakupKernel::breakupSource | ||
253 | ( | ||
254 | const labelList& momentOrder, | ||
255 | const label celli, | ||
256 | const velocityQuadratureApproximation& quadrature | ||
257 | ) | ||
258 | { | ||
259 | scalar bSource = 0.0; | ||
260 | |||
261 | const mappedPtrList<volVelocityNode>& nodes = quadrature.nodes(); | ||
262 | bool lengthBased = nodes[0].lengthBased(); | ||
263 | label sizeIndex = nodes[0].sizeIndex(); | ||
264 | |||
265 | if (sizeIndex == -1) | ||
266 | { | ||
267 | return bSource; | ||
268 | } | ||
269 | |||
270 | label sizeOrder = momentOrder[sizeIndex]; | ||
271 | bool volumeFraction = nodes[0].useVolumeFraction(); | ||
272 | |||
273 | if (volumeFraction) | ||
274 | { | ||
275 | if (lengthBased) | ||
276 | { | ||
277 | sizeOrder += 3; | ||
278 | } | ||
279 | else | ||
280 | { | ||
281 | sizeOrder += 1; | ||
282 | } | ||
283 | } | ||
284 | |||
285 | label nSizes = quadrature.nNodes()[sizeIndex]; | ||
286 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
287 | const labelList& velocityIndexes = nodes[0].velocityIndexes(); | ||
288 | |||
289 | if (!nodes[0].extended()) | ||
290 | { | ||
291 | scalarList bSources(nSizes, 0.0); | ||
292 | |||
293 | for (label sizei = 0; sizei < nSizes; sizei++) | ||
294 | { | ||
295 | const volVelocityNode& node = nodes(sizei); | ||
296 | |||
297 | scalar bAbscissa = | ||
298 | max(node.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
299 | |||
300 | if (lengthBased) | ||
301 | { | ||
302 | bSources[sizei] = nodeSource(bAbscissa, sizeOrder); | ||
303 | } | ||
304 | else | ||
305 | { | ||
306 | bSources[sizei] = massNodeSource(bAbscissa, sizeOrder); | ||
307 | } | ||
308 | |||
309 | bSources[sizei] *= Kb(bAbscissa, celli); | ||
310 | |||
311 | if (volumeFraction) | ||
312 | { | ||
313 | if (lengthBased) | ||
314 | { | ||
315 | bSources[sizei] /= pow3(max(bAbscissa, small)); | ||
316 | } | ||
317 | else | ||
318 | { | ||
319 | bSources[sizei] /= max(bAbscissa, small); | ||
320 | } | ||
321 | } | ||
322 | } | ||
323 | |||
324 | forAll(nodes, pNodei) | ||
325 | { | ||
326 | const volVelocityNode& node = nodes[pNodei]; | ||
327 | label sizei = quadrature.nodeIndexes()[pNodei][sizeIndex]; | ||
328 | |||
329 | scalar bSourcei = node.primaryWeight()[celli]*bSources[sizei]; | ||
330 | |||
331 | forAll(scalarIndexes, nodei) | ||
332 | { | ||
333 | if (scalarIndexes[nodei] != sizeIndex) | ||
334 | { | ||
335 | bSourcei *= | ||
336 | pow | ||
337 | ( | ||
338 | node.primaryAbscissae()[nodei][celli], | ||
339 | momentOrder[scalarIndexes[nodei]] | ||
340 | ); | ||
341 | } | ||
342 | } | ||
343 | |||
344 | forAll(velocityIndexes, cmpt) | ||
345 | { | ||
346 | bSourcei *= | ||
347 | pow | ||
348 | ( | ||
349 | node.velocityAbscissae()[celli][cmpt], | ||
350 | momentOrder[velocityIndexes[cmpt]] | ||
351 | ); | ||
352 | } | ||
353 | |||
354 | bSource += bSourcei; | ||
355 | } | ||
356 | |||
357 | return bSource; | ||
358 | } | ||
359 | |||
360 | label nSecondaryNodes(nodes[0].secondaryWeights().size()); | ||
361 | scalarListList bSources(nSizes, scalarList(nSecondaryNodes, 0.0)); | ||
362 | for (label pNodei = 0; pNodei < nSizes; pNodei++) | ||
363 | { | ||
364 | for (label sNodei = 0; sNodei < nSecondaryNodes; sNodei++) | ||
365 | { | ||
366 | const volVelocityNode& node = nodes(pNodei); | ||
367 | |||
368 | scalar bAbscissa = | ||
369 | max(node.secondaryAbscissae()[sizeIndex][sNodei][celli], 0.0); | ||
370 | |||
371 | if (lengthBased) | ||
372 | { | ||
373 | bSources[pNodei][sNodei] = nodeSource(bAbscissa, sizeOrder); | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | bSources[pNodei][sNodei] = massNodeSource(bAbscissa, sizeOrder); | ||
378 | } | ||
379 | |||
380 | bSources[pNodei][sNodei] *= Kb(bAbscissa, celli); | ||
381 | |||
382 | if (volumeFraction) | ||
383 | { | ||
384 | if (lengthBased) | ||
385 | { | ||
386 | bSources[pNodei][sNodei] /= pow3(max(bAbscissa, small)); | ||
387 | } | ||
388 | else | ||
389 | { | ||
390 | bSources[pNodei][sNodei] /= max(bAbscissa, small); | ||
391 | } | ||
392 | } | ||
393 | } | ||
394 | } | ||
395 | |||
396 | forAll(nodes, pNodei) | ||
397 | { | ||
398 | const volVelocityNode& node = nodes[pNodei]; | ||
399 | label sizei = quadrature.nodeIndexes()[pNodei][sizeIndex]; | ||
400 | |||
401 | scalar bSourcei = 0.0; | ||
402 | |||
403 | forAll(node.secondaryWeights()[0], sNodei) | ||
404 | { | ||
405 | bSourcei += | ||
406 | node.primaryWeight()[celli] | ||
407 | *node.secondaryWeights()[sizeIndex][sNodei][celli] | ||
408 | *bSources[sizei][sNodei]; | ||
409 | |||
410 | } | ||
411 | |||
412 | forAll(scalarIndexes, cmpt) | ||
413 | { | ||
414 | if (scalarIndexes[cmpt] != sizeIndex) | ||
415 | { | ||
416 | bSourcei *= | ||
417 | pow | ||
418 | ( | ||
419 | node.primaryAbscissae()[cmpt][celli], | ||
420 | momentOrder[scalarIndexes[cmpt]] | ||
421 | ); | ||
422 | } | ||
423 | } | ||
424 | |||
425 | forAll(velocityIndexes, cmpt) | ||
426 | { | ||
427 | bSourcei *= | ||
428 | pow | ||
429 | ( | ||
430 | node.velocityAbscissae()[celli][cmpt], | ||
431 | momentOrder[velocityIndexes[cmpt]] | ||
432 | ); | ||
433 | } | ||
434 | |||
435 | bSource += bSourcei; | ||
436 | } | ||
437 | |||
438 | return bSource; | ||
439 | } | ||
440 | |||
68 | 441 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.H changed (mode: 100644) (index 9f98bdd..618f3f5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
39 | 39 | #include "volFields.H" | #include "volFields.H" |
40 | 40 | #include "dimensionedTypes.H" | #include "dimensionedTypes.H" |
41 | 41 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
42 | #include "daughterDistribution.H" | ||
43 | #include "quadratureApproximations.H" | ||
42 | 44 | ||
43 | 45 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 46 | ||
... | ... | namespace populationBalanceSubModels | |
53 | 55 | ||
54 | 56 | class breakupKernel | class breakupKernel |
55 | 57 | { | { |
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 | 58 | protected: | protected: |
66 | 59 | ||
67 | 60 | // Protected data | // Protected data |
... | ... | protected: | |
72 | 65 | //- Mesh | //- Mesh |
73 | 66 | const fvMesh& mesh_; | const fvMesh& mesh_; |
74 | 67 | ||
75 | //- Coefficient of aggregation kernel | ||
68 | //- Coefficient of breakup kernel | ||
76 | 69 | const dimensionedScalar Cb_; | const dimensionedScalar Cb_; |
77 | 70 | ||
71 | //- Daughter distribution function | ||
72 | autoPtr | ||
73 | < | ||
74 | Foam::populationBalanceSubModels::daughterDistribution | ||
75 | > daughterDistribution_; | ||
76 | |||
78 | 77 | ||
79 | 78 | public: | public: |
80 | 79 | ||
... | ... | public: | |
104 | 103 | const fvMesh& mesh | const fvMesh& mesh |
105 | 104 | ); | ); |
106 | 105 | ||
106 | //- Disallow default bitwise copy construct | ||
107 | breakupKernel(const breakupKernel&) = delete; | ||
108 | |||
107 | 109 | ||
108 | 110 | // Selectors | // Selectors |
109 | 111 | ||
... | ... | public: | |
120 | 122 | ||
121 | 123 | // Member Functions | // Member Functions |
122 | 124 | ||
125 | //- Uodate sources before ode solve | ||
126 | virtual void preUpdate() | ||
127 | { | ||
128 | return; | ||
129 | } | ||
130 | |||
123 | 131 | //- Breakup kernel | //- Breakup kernel |
124 | 132 | virtual scalar Kb | virtual scalar Kb |
125 | 133 | ( | ( |
... | ... | public: | |
127 | 135 | const label celli, | const label celli, |
128 | 136 | const label environment = 0 | const label environment = 0 |
129 | 137 | ) const = 0; | ) const = 0; |
138 | |||
139 | //- Length based breakup source given two abscissae and an order | ||
140 | scalar nodeSource | ||
141 | ( | ||
142 | const scalar& abscissa, | ||
143 | const label momentOrder | ||
144 | ) const; | ||
145 | |||
146 | //- Mass based breakup source given two abscissae and an order | ||
147 | scalar massNodeSource | ||
148 | ( | ||
149 | const scalar& abscissa, | ||
150 | const label momentOrder | ||
151 | ) const; | ||
152 | |||
153 | //- Return Breakup source term | ||
154 | scalar breakupSource | ||
155 | ( | ||
156 | const labelList& momentOrder, | ||
157 | const label celli, | ||
158 | const scalarQuadratureApproximation& quadrature | ||
159 | ); | ||
160 | |||
161 | //- Return Breakup source term | ||
162 | scalar breakupSource | ||
163 | ( | ||
164 | const labelList& momentOrder, | ||
165 | const label celli, | ||
166 | const velocityQuadratureApproximation& quadrature | ||
167 | ); | ||
168 | |||
169 | |||
170 | // Member Operators | ||
171 | |||
172 | //- Disallow default bitwise assignment | ||
173 | void operator=(const breakupKernel&) = delete; | ||
130 | 174 | }; | }; |
131 | 175 | ||
132 | 176 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C changed (mode: 100644) (index 42abec9..e2453c8) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.C changed (mode: 100644) (index a2334e4..6c34180) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.H changed (mode: 100644) (index 3a28279..8bc5af3) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.C changed (mode: 100644) (index 0321a6e..ef15a59) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.H changed (mode: 100644) (index 0122853..5c96a76) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.C changed (mode: 100644) (index 3d4cb76..8f5d40c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.H changed (mode: 100644) (index fea75af..981e4d8) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coalescenceKernel/coalescenceKernel.C deleted (index cb23e4d..0000000) | |||
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 "coalescenceKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | defineTypeNameAndDebug(coalescenceKernel, 0); | ||
35 | |||
36 | defineRunTimeSelectionTable(coalescenceKernel, dictionary); | ||
37 | } | ||
38 | } | ||
39 | |||
40 | |||
41 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
42 | |||
43 | Foam::populationBalanceSubModels::coalescenceKernel::coalescenceKernel | ||
44 | ( | ||
45 | const dictionary& dict | ||
46 | ) | ||
47 | : | ||
48 | dict_(dict), | ||
49 | Cc_ | ||
50 | ( | ||
51 | dict.lookupOrDefault | ||
52 | ( | ||
53 | "Cc", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | ) | ||
56 | ) | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
61 | |||
62 | Foam::populationBalanceSubModels::coalescenceKernel::~coalescenceKernel() | ||
63 | {} | ||
64 | |||
65 | |||
66 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coalescenceKernel/coalescenceKernel.H deleted (index a89a819..0000000) | |||
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::coalescenceKernel | ||
26 | |||
27 | Description | ||
28 | Abstract class for coalescence kernels. | ||
29 | |||
30 | SourceFiles | ||
31 | coalescenceKernel.C | ||
32 | |||
33 | \*---------------------------------------------------------------------------*/ | ||
34 | |||
35 | #ifndef coalescenceKernel_H | ||
36 | #define coalescenceKernel_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 coalescenceKernel Declaration | ||
52 | \*---------------------------------------------------------------------------*/ | ||
53 | |||
54 | class coalescenceKernel | ||
55 | { | ||
56 | // Private member functions | ||
57 | |||
58 | //- Disallow default bitwise copy construct | ||
59 | coalescenceKernel(const coalescenceKernel&); | ||
60 | |||
61 | //- Disallow default bitwise assignment | ||
62 | void operator=(const coalescenceKernel&); | ||
63 | |||
64 | |||
65 | protected: | ||
66 | |||
67 | // Protected data | ||
68 | |||
69 | const dictionary& dict_; | ||
70 | |||
71 | //- Coefficient of coalescence kernel | ||
72 | const dimensionedScalar Cc_; | ||
73 | |||
74 | |||
75 | public: | ||
76 | |||
77 | //- Runtime type information | ||
78 | TypeName("coalescenceKernel"); | ||
79 | |||
80 | // Declare runtime constructor selection table | ||
81 | declareRunTimeSelectionTable | ||
82 | ( | ||
83 | autoPtr, | ||
84 | coalescenceKernel, | ||
85 | dictionary, | ||
86 | ( | ||
87 | const dictionary& dict | ||
88 | ), | ||
89 | (dict) | ||
90 | ); | ||
91 | |||
92 | |||
93 | // Constructors | ||
94 | |||
95 | //- Construct from components | ||
96 | coalescenceKernel(const dictionary& dict); | ||
97 | |||
98 | |||
99 | // Selectors | ||
100 | |||
101 | static autoPtr<coalescenceKernel> New | ||
102 | ( | ||
103 | const dictionary& dict | ||
104 | ); | ||
105 | |||
106 | |||
107 | //- Destructor | ||
108 | virtual ~coalescenceKernel(); | ||
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/coalescenceKernels/coalescenceKernel/newCoalescenceKernel.C deleted (index 85ab038..0000000) | |||
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 "coalescenceKernel.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::coalescenceKernel> | ||
31 | Foam::populationBalanceSubModels::coalescenceKernel::New | ||
32 | ( | ||
33 | const dictionary& dict | ||
34 | ) | ||
35 | { | ||
36 | word coalescenceKernelType(dict.lookup("coalescenceKernel")); | ||
37 | |||
38 | Info<< "Selecting coalescenceKernel " | ||
39 | << coalescenceKernelType << endl; | ||
40 | |||
41 | dictionaryConstructorTable::iterator cstrIter = | ||
42 | dictionaryConstructorTablePtr_->find(coalescenceKernelType); | ||
43 | |||
44 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | ||
45 | { | ||
46 | FatalErrorInFunction | ||
47 | << "Unknown coalescenceKernelType type " | ||
48 | << coalescenceKernelType << endl << endl | ||
49 | << "Valid coalescenceKernelType types are :" << endl | ||
50 | << dictionaryConstructorTablePtr_->sortedToc() | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | return autoPtr<coalescenceKernel>(cstrIter()(dict)); | ||
55 | } | ||
56 | |||
57 | |||
58 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coulaloglouTavlarides/coulaloglouTavlarides.C deleted (index 27d7739..0000000) | |||
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 "coulaloglouTavlarides.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 coalescenceKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(coulaloglouTavlarides, 0); | ||
40 | |||
41 | addToRunTimeSelectionTable | ||
42 | ( | ||
43 | coalescenceKernel, | ||
44 | coulaloglouTavlarides, | ||
45 | dictionary | ||
46 | ); | ||
47 | } | ||
48 | } | ||
49 | } | ||
50 | |||
51 | |||
52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
53 | |||
54 | Foam::populationBalanceSubModels::coalescenceKernels::coulaloglouTavlarides | ||
55 | ::coulaloglouTavlarides | ||
56 | ( | ||
57 | const dictionary& dict | ||
58 | ) | ||
59 | : | ||
60 | etaC_(dict.lookupOrDefault("etaC", 6.0E9)), | ||
61 | coalescenceKernel(dict) | ||
62 | {} | ||
63 | |||
64 | |||
65 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
66 | |||
67 | Foam::populationBalanceSubModels::coalescenceKernels::coulaloglouTavlarides | ||
68 | ::~coulaloglouTavlarides() | ||
69 | {} | ||
70 | |||
71 | |||
72 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
73 | |||
74 | Foam::tmp<Foam::volScalarField> | ||
75 | Foam::populationBalanceSubModels::coalescenceKernels::coulaloglouTavlarides::Ka | ||
76 | ( | ||
77 | const volScalarField& abscissa1, | ||
78 | const volScalarField& abscissa2 | ||
79 | ) const | ||
80 | { | ||
81 | if (!abscissa1.mesh().foundObject<fluidThermo>(basicThermo::dictName)) | ||
82 | { | ||
83 | FatalErrorInFunction | ||
84 | << "No valid thermophysical model found." | ||
85 | << abort(FatalError); | ||
86 | } | ||
87 | |||
88 | const fluidThermo& flThermo = | ||
89 | abscissa1.mesh().lookupObject<fluidThermo>(basicThermo::dictName); | ||
90 | |||
91 | typedef compressible::turbulenceModel cmpTurbModel; | ||
92 | |||
93 | if | ||
94 | ( | ||
95 | !abscissa1.mesh().foundObject<cmpTurbModel> | ||
96 | ( | ||
97 | cmpTurbModel::propertiesName | ||
98 | ) | ||
99 | ) | ||
100 | { | ||
101 | FatalErrorInFunction | ||
102 | << "No valid compressible turbulence model found." | ||
103 | << abort(FatalError); | ||
104 | } | ||
105 | |||
106 | const compressible::turbulenceModel& flTurb = | ||
107 | abscissa1.mesh().lookupObject<compressible::turbulenceModel> | ||
108 | ( | ||
109 | turbulenceModel::propertiesName | ||
110 | ); | ||
111 | |||
112 | // NEED TO LOOK UP SIGMA STILL\\ | ||
113 | |||
114 | dimensionedScalar smallAbs("smallAbs", sqr(abscissa1.dimensions()), SMALL); | ||
115 | |||
116 | volScalarField eta = exp(-etaC_*sqrt(2.0*flThermo.mu()/flTurb.nu() | ||
117 | *pow(flTurb.epsilon(), 2.0/3.0)/sigma*(abscissa1*abscissa2) | ||
118 | /(max(smallAbs, abscissa1 + abscissa2)))); | ||
119 | |||
120 | return | ||
121 | Cc_*pow(flTurb.epsilon(), 1.0/3.0)*sqr(abscissa1 + abscissa2) | ||
122 | *sqrt(pow(abscissa1, 2.0/3.0) + pow(abscissa2, 2.0/3.0))*eta; | ||
123 | } | ||
124 | |||
125 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coulaloglouTavlarides/coulaloglouTavlarides.H deleted (index 5cce3e5..0000000) | |||
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::coalescenceKernels::coulaloglouTavlarides | ||
26 | |||
27 | Description | ||
28 | coulaloglouTavlarides kernel supplemented kernel for | ||
29 | |||
30 | References | ||
31 | \verbatim | ||
32 | "Simulation of polydisperse multiphase systems using population balance | ||
33 | and example application to bubbly flows" | ||
34 | Antonio Buffo, Daniele Marchisio, Marco Vanni, Peter Renze | ||
35 | Chemical Engineering Research and Design | ||
36 | Volume 91, Pages 1859-1875, 2013 | ||
37 | \endverbatim | ||
38 | |||
39 | \verbatim | ||
40 | "Description of interaction processes in agitated liquid-liquid | ||
41 | dispersions" | ||
42 | C A Coulaloglou, L L Tavlrides | ||
43 | Chemical Engineering Science | ||
44 | Volume 32, Pages 1289-1297, 1977 | ||
45 | \endverbatim | ||
46 | |||
47 | SourceFiles | ||
48 | coulaloglouTavlarides.C | ||
49 | |||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | #ifndef coulaloglouTavlarides_H | ||
53 | #define coulaloglouTavlarides_H | ||
54 | |||
55 | #include "coalescenceKernel.H" | ||
56 | |||
57 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
58 | |||
59 | namespace Foam | ||
60 | { | ||
61 | namespace populationBalanceSubModels | ||
62 | { | ||
63 | namespace coalescenceKernels | ||
64 | { | ||
65 | |||
66 | /*---------------------------------------------------------------------------*\ | ||
67 | Class coulaloglouTavlarides Declaration | ||
68 | \*---------------------------------------------------------------------------*/ | ||
69 | |||
70 | class coulaloglouTavlarides | ||
71 | : | ||
72 | public coalescenceKernel | ||
73 | { | ||
74 | // Private data | ||
75 | //- Coefficients | ||
76 | scalar etaC_; | ||
77 | public: | ||
78 | |||
79 | //- Runtime type information | ||
80 | TypeName("coulaloglouTavlarides"); | ||
81 | |||
82 | |||
83 | // Constructors | ||
84 | |||
85 | //- Construct from components | ||
86 | coulaloglouTavlarides(const dictionary& dict); | ||
87 | |||
88 | |||
89 | //- Destructor | ||
90 | virtual ~coulaloglouTavlarides(); | ||
91 | |||
92 | |||
93 | // Member Functions | ||
94 | |||
95 | //- Aggregation kernel | ||
96 | virtual tmp<volScalarField> Ka | ||
97 | ( | ||
98 | const volScalarField& abscissa1, | ||
99 | const volScalarField& abscissa2 | ||
100 | ) const; | ||
101 | |||
102 | }; | ||
103 | |||
104 | |||
105 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
106 | |||
107 | } // End namespace coalescenceKernels | ||
108 | } // End namespace populationBalanceSubModels | ||
109 | } // End namespace Foam | ||
110 | |||
111 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
112 | |||
113 | #endif | ||
114 | |||
115 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BGKCollision/BGKCollision.C changed (mode: 100644) (index 37190a2..cf093ab) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace collisionKernels | |
47 | 47 | } | } |
48 | 48 | ||
49 | 49 | ||
50 | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // | ||
50 | // * * * * * * * * * * * * * Protected Functions * * * * * * * * * * * * * * // | ||
51 | 51 | ||
52 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
53 | ::updateCells1D(const label celli) | ||
52 | Foam::symmTensor | ||
53 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision::covariance | ||
54 | ( | ||
55 | const label celli, | ||
56 | const scalar& u, | ||
57 | const scalar& v, | ||
58 | const scalar& w | ||
59 | ) | ||
54 | 60 | { | { |
55 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
61 | symmTensor sigma(Zero); | ||
56 | 62 | ||
57 | scalar m0 = max(moments(0)[celli], SMALL); | ||
63 | const volVelocityMomentFieldSet& moments = quadrature_.moments(); | ||
64 | scalar m0 = max(moments(0)[celli], small); | ||
65 | sigma.xx() = max(moments(2)[celli]/m0 - sqr(u), 0.0); | ||
58 | 66 | ||
59 | // Mean velocity | ||
60 | scalar u = meanVelocity(m0, moments(1)[celli]); | ||
61 | scalar uSqr = sqr(u); | ||
67 | if (nDimensions_ > 1) | ||
68 | { | ||
69 | sigma.xy() = moments(1,1)[celli]/m0 - u*v; | ||
70 | sigma.yy() = max(moments(0,2)[celli]/m0 - sqr(v), 0.0); | ||
62 | 71 | ||
63 | // Variances of velocities | ||
64 | scalar sigma = max(moments(2)[celli]/m0 - uSqr, 0.0); | ||
72 | if (nDimensions_ > 2) | ||
73 | { | ||
74 | sigma.xz() = moments(1,0,1)[celli]/m0 - u*w; | ||
75 | sigma.yz() = moments(0,1,1)[celli]/m0 - v*w; | ||
76 | sigma.zz() = max(moments(0,0,2)[celli]/m0 - sqr(w), 0.0); | ||
77 | } | ||
78 | } | ||
65 | 79 | ||
66 | Meq_(0) = moments(0)[celli]; | ||
67 | Meq_(1) = moments(1)[celli]; | ||
68 | Meq_(2) = moments(2)[celli]; | ||
69 | Meq_(3) = m0*(3.0*sigma*u + u*uSqr); | ||
70 | Meq_(4) = m0*(6.0*uSqr*sigma + 3.0*sqr(sigma) + uSqr*uSqr); | ||
80 | return sigma; | ||
71 | 81 | } | } |
72 | 82 | ||
73 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
74 | ::updateCells2D(const label celli) | ||
83 | Foam::symmTensor | ||
84 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision::covariance | ||
85 | ( | ||
86 | const mappedScalarList& moments, | ||
87 | const scalar& u, | ||
88 | const scalar& v, | ||
89 | const scalar& w | ||
90 | ) | ||
75 | 91 | { | { |
76 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
77 | scalar m00 = max(moments(0,0)[celli], SMALL); | ||
78 | |||
79 | // Mean velocity | ||
80 | scalar u = meanVelocity(m00, moments(1,0)[celli]); | ||
81 | scalar v = meanVelocity(m00, moments(0,1)[celli]); | ||
82 | scalar uSqr = sqr(u); | ||
83 | scalar vSqr = sqr(v); | ||
84 | |||
85 | // Variances of velocities | ||
86 | scalar sigma11 = max(moments(2,0)[celli]/m00 - uSqr, 0.0); | ||
87 | scalar sigma22 = max(moments(0,2)[celli]/m00 - vSqr, 0.0); | ||
88 | |||
89 | Meq_(0,0) = moments(0,0)[celli]; | ||
90 | Meq_(1,0) = moments(1,0)[celli]; | ||
91 | Meq_(0,1) = moments(0,1)[celli]; | ||
92 | Meq_(2,0) = moments(2,0)[celli]; | ||
93 | Meq_(1,1) = moments(1,1)[celli]; | ||
94 | Meq_(0,2) = moments(0,2)[celli]; | ||
95 | Meq_(3,0) = m00*(3.0*sigma11*u + u*uSqr); | ||
96 | Meq_(0,3) = m00*(3.0*sigma22*v + v*vSqr); | ||
97 | Meq_(4,0) = m00*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
98 | Meq_(0,4) = m00*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
99 | } | ||
92 | symmTensor sigma(Zero); | ||
93 | scalar m0 = moments(0); | ||
100 | 94 | ||
101 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
102 | ::updateCells3D(const label celli) | ||
103 | { | ||
104 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
105 | scalar m000 = max(moments(0,0,0)[celli], SMALL); | ||
106 | |||
107 | // Mean velocity | ||
108 | scalar u = meanVelocity(m000, moments(1,0,0)[celli]); | ||
109 | scalar v = meanVelocity(m000, moments(0,1,0)[celli]); | ||
110 | scalar w = meanVelocity(m000, moments(0,0,1)[celli]); | ||
111 | scalar uSqr = sqr(u); | ||
112 | scalar vSqr = sqr(v); | ||
113 | scalar wSqr = sqr(w); | ||
114 | |||
115 | // Variances of velocities | ||
116 | scalar sigma11 = max(moments(2,0,0)[celli]/m000 - uSqr, 0.0); | ||
117 | scalar sigma22 = max(moments(0,2,0)[celli]/m000 - vSqr, 0.0); | ||
118 | scalar sigma33 = max(moments(0,0,2)[celli]/m000 - wSqr, 0.0); | ||
119 | |||
120 | Meq_(0,0,0) = moments(0,0,0)[celli]; | ||
121 | Meq_(1,0,0) = moments(1,0,0)[celli]; | ||
122 | Meq_(0,1,0) = moments(0,1,0)[celli]; | ||
123 | Meq_(0,0,1) = moments(0,0,1)[celli]; | ||
124 | Meq_(2,0,0) = moments(2,0,0)[celli]; | ||
125 | Meq_(1,1,0) = moments(1,1,0)[celli]; | ||
126 | Meq_(1,0,1) = moments(1,0,1)[celli]; | ||
127 | Meq_(0,2,0) = moments(0,2,0)[celli]; | ||
128 | Meq_(0,1,1) = moments(0,1,1)[celli]; | ||
129 | Meq_(0,0,2) = moments(0,0,2)[celli]; | ||
130 | Meq_(3,0,0) = m000*(3.0*sigma11*u + u*uSqr); | ||
131 | Meq_(0,3,0) = m000*(3.0*sigma22*v + v*vSqr); | ||
132 | Meq_(0,0,3) = m000*(3.0*sigma33*w + w*wSqr); | ||
133 | Meq_(4,0,0) = m000*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
134 | Meq_(0,4,0) = m000*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
135 | Meq_(0,0,4) = m000*(6.0*wSqr*sigma33 + 3.0*sqr(sigma33) + wSqr*wSqr); | ||
136 | } | ||
95 | if (m0 < small) | ||
96 | { | ||
97 | return sigma; | ||
98 | } | ||
137 | 99 | ||
100 | sigma.xx() = max(moments(2)/m0 - sqr(u), 0.0); | ||
138 | 101 | ||
139 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
140 | ::updateFields1D() | ||
141 | { | ||
142 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
143 | volScalarField m0(max(moments(0), SMALL)); | ||
144 | |||
145 | // Mean velocity | ||
146 | volScalarField u(meanVelocity(m0, moments(1))); | ||
147 | volScalarField uSqr(sqr(u)); | ||
148 | |||
149 | // Variances of velocities | ||
150 | dimensionedScalar zeroVar("zero", sqr(dimVelocity), 0.0); | ||
151 | volScalarField sigma(max(moments(2)/m0 - uSqr, zeroVar)); | ||
152 | |||
153 | Meqf_(0) = moments(0); | ||
154 | Meqf_(1) = moments(1); | ||
155 | Meqf_(2) = moments(2); | ||
156 | Meqf_(3) = m0*(3.0*sigma*u + u*uSqr); | ||
157 | Meqf_(4) = m0*(6.0*uSqr*sigma + 3.0*sqr(sigma) + uSqr*uSqr); | ||
158 | } | ||
102 | if (nDimensions_ > 1) | ||
103 | { | ||
104 | sigma.xy() = moments(1,1)/m0 - u*v; | ||
105 | sigma.yy() = max(moments(0,2)/m0 - sqr(v), 0.0); | ||
159 | 106 | ||
160 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
161 | ::updateFields2D() | ||
162 | { | ||
163 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
164 | volScalarField m00(max(moments(0,0), SMALL)); | ||
165 | |||
166 | // Mean velocity | ||
167 | volScalarField u(meanVelocity(m00, moments(1,0))); | ||
168 | volScalarField v(meanVelocity(m00, moments(0,1))); | ||
169 | volScalarField uSqr(sqr(u)); | ||
170 | volScalarField vSqr(sqr(v)); | ||
171 | |||
172 | // Variances of velocities | ||
173 | dimensionedScalar zeroVar("zero", sqr(dimVelocity), 0.0); | ||
174 | volScalarField sigma11(max(moments(2,0)/m00 - uSqr, zeroVar)); | ||
175 | volScalarField sigma22(max(moments(0,2)/m00 - vSqr, zeroVar)); | ||
176 | |||
177 | Meqf_(0,0) = moments(0,0); | ||
178 | Meqf_(1,0) = moments(1,0); | ||
179 | Meqf_(0,1) = moments(0,1); | ||
180 | Meqf_(2,0) = moments(2,0); | ||
181 | Meqf_(1,1) = moments(1,1); | ||
182 | Meqf_(0,2) = moments(0,2); | ||
183 | Meqf_(3,0) = m00*(3.0*sigma11*u + u*uSqr); | ||
184 | Meqf_(0,3) = m00*(3.0*sigma22*v + v*vSqr); | ||
185 | Meqf_(4,0) = m00*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
186 | Meqf_(0,4) = m00*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
107 | if (nDimensions_ > 2) | ||
108 | { | ||
109 | sigma.xz() = moments(1,0,1)/m0 - u*w; | ||
110 | sigma.yz() = moments(0,1,1)/m0 - v*w; | ||
111 | sigma.zz() = max(moments(0,0,2)/m0 - sqr(w), 0.0); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | return sigma; | ||
187 | 116 | } | } |
188 | 117 | ||
118 | |||
119 | // * * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * // | ||
120 | |||
189 | 121 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision |
190 | ::updateFields3D() | ||
122 | ::updateCells(const label celli) | ||
191 | 123 | { | { |
192 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
193 | volScalarField m000(max(moments(0,0,0), SMALL)); | ||
194 | |||
195 | // Mean velocity | ||
196 | volScalarField u(meanVelocity(m000, moments(1,0,0))); | ||
197 | volScalarField v(meanVelocity(m000, moments(0,1,0))); | ||
198 | volScalarField w(meanVelocity(m000, moments(0,0,1))); | ||
199 | volScalarField uSqr(sqr(u)); | ||
200 | volScalarField vSqr(sqr(v)); | ||
201 | volScalarField wSqr(sqr(w)); | ||
202 | |||
203 | // Variances of velocities | ||
204 | dimensionedScalar zeroVar("zero", sqr(dimVelocity), 0.0); | ||
205 | volScalarField sigma11(max(moments(2,0,0)/m000 - uSqr, zeroVar)); | ||
206 | volScalarField sigma22(max(moments(0,2,0)/m000 - vSqr, zeroVar)); | ||
207 | volScalarField sigma33(max(moments(0,0,2)/m000 - wSqr, zeroVar)); | ||
208 | |||
209 | Meqf_(0,0,0) = moments(0,0,0); | ||
210 | Meqf_(1,0,0) = moments(1,0,0); | ||
211 | Meqf_(0,1,0) = moments(0,1,0); | ||
212 | Meqf_(0,0,1) = moments(0,0,1); | ||
213 | Meqf_(2,0,0) = moments(2,0,0); | ||
214 | Meqf_(1,1,0) = moments(1,1,0); | ||
215 | Meqf_(1,0,1) = moments(1,0,1); | ||
216 | Meqf_(0,2,0) = moments(0,2,0); | ||
217 | Meqf_(0,1,1) = moments(0,1,1); | ||
218 | Meqf_(0,0,2) = moments(0,0,2); | ||
219 | Meqf_(3,0,0) = m000*(3.0*sigma11*u + u*uSqr); | ||
220 | Meqf_(0,3,0) = m000*(3.0*sigma22*v + v*vSqr); | ||
221 | Meqf_(0,0,3) = m000*(3.0*sigma33*w + w*wSqr); | ||
222 | Meqf_(4,0,0) = m000*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
223 | Meqf_(0,4,0) = m000*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
224 | Meqf_(0,0,4) = m000*(6.0*wSqr*sigma33 + 3.0*sqr(sigma33) + wSqr*wSqr); | ||
124 | //- Monodisperse case | ||
125 | const volVelocityMomentFieldSet& moments = quadrature_.moments(); | ||
126 | |||
127 | scalar m0 = moments(0)[celli]; | ||
128 | |||
129 | if (nSizes_ == 0) | ||
130 | { | ||
131 | scalar u = moments(1)[celli]/max(m0, small); | ||
132 | scalar v = 0.0; | ||
133 | scalar w = 0.0; | ||
134 | |||
135 | if (nDimensions_ > 1) | ||
136 | { | ||
137 | v = moments(0,1)[celli]/max(m0, small); | ||
138 | |||
139 | if (nDimensions_ > 2) | ||
140 | { | ||
141 | w = moments(0,0,1)[celli]/max(m0, small); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | symmTensor sigma = covariance(celli, u, v, w); | ||
146 | |||
147 | // Temporay moments | ||
148 | mappedScalarList tmpMoments(momentOrders_.size(), momentOrders_); | ||
149 | |||
150 | // Compute equilibrium distribuition moments given mean velocity | ||
151 | // and covariance tensor | ||
152 | forAllIter(List<momentFunction>, equilibriumMomentFunctions_, iter) | ||
153 | { | ||
154 | (*iter)(tmpMoments, m0, u, v, w, sigma); | ||
155 | } | ||
156 | |||
157 | forAll(moments, mi) | ||
158 | { | ||
159 | Meq_[mi][celli] = tmpMoments[mi]; | ||
160 | } | ||
161 | |||
162 | return; | ||
163 | } | ||
164 | |||
165 | // Reset moment sources | ||
166 | forAll(Meq_, mi) | ||
167 | { | ||
168 | Meq_[mi][celli] = 0.0; | ||
169 | } | ||
170 | |||
171 | // Construct conditional moments | ||
172 | forAll(velocityMoments_, sizei) | ||
173 | { | ||
174 | Ks_[sizei] = scalarList(nSizes_, 0.0); | ||
175 | forAll(velocityMomentOrders_, mi) | ||
176 | { | ||
177 | velocityMoments_[sizei][mi] = 0.0; | ||
178 | forAll(velocityMoments_, sizej) | ||
179 | { | ||
180 | Gs_[sizei][sizej][mi] = 0.0; | ||
181 | } | ||
182 | } | ||
183 | } | ||
184 | |||
185 | // Continuous phase volume fraction used for radial distribution | ||
186 | scalar alphac = 1.0 - m0; | ||
187 | |||
188 | // Particle diameters | ||
189 | scalarList ds(nSizes_); | ||
190 | |||
191 | // Size conditioned mean velocities | ||
192 | List<vector> Us(nSizes_, Zero); | ||
193 | |||
194 | // Size conditioned covariance tensors | ||
195 | List<symmTensor> Sigmas(nSizes_, Zero); | ||
196 | |||
197 | // Volume fraction of sizes | ||
198 | scalarList weights(nSizes_, 0.0); | ||
199 | |||
200 | // Compute size conditioned velocity moments | ||
201 | forAll(quadrature_.nodes(), nodei) | ||
202 | { | ||
203 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
204 | const volVelocityNode& node = quadrature_.nodes()[nodei]; | ||
205 | label sizei = nodeIndex[sizeIndex_]; | ||
206 | |||
207 | forAll(velocityMomentOrders_, mi) | ||
208 | { | ||
209 | const labelList& vOrder = velocityMomentOrders_[mi]; | ||
210 | |||
211 | scalar mCmpt = node.primaryWeight()[celli]; | ||
212 | |||
213 | forAll(vOrder, cmpt) | ||
214 | { | ||
215 | mCmpt *= | ||
216 | pow(node.velocityAbscissae()[celli][cmpt], vOrder[cmpt]); | ||
217 | } | ||
218 | |||
219 | velocityMoments_[sizei](vOrder) += mCmpt; | ||
220 | } | ||
221 | } | ||
222 | |||
223 | // Set size conditioned mean velocities and covariance tensors | ||
224 | forAll(velocityMoments_, sizei) | ||
225 | { | ||
226 | scalar m0i = velocityMoments_[sizei](0); | ||
227 | weights[sizei] = m0i; | ||
228 | |||
229 | ds[sizei] = | ||
230 | max | ||
231 | ( | ||
232 | quadrature_.nodes()(sizei).primaryAbscissae()[sizeIndex_][celli], | ||
233 | minD_ | ||
234 | ); | ||
235 | |||
236 | // Only compute variance and mean if m0 is not small | ||
237 | if (m0i > minM0_) | ||
238 | { | ||
239 | Us[sizei].x() = velocityMoments_[sizei](1)/m0i; | ||
240 | |||
241 | if (nDimensions_ > 1) | ||
242 | { | ||
243 | Us[sizei].y() = velocityMoments_[sizei](0,1)/m0i; | ||
244 | |||
245 | if (nDimensions_ > 2) | ||
246 | { | ||
247 | Us[sizei].z() = velocityMoments_[sizei](0,0,1)/m0i; | ||
248 | } | ||
249 | } | ||
250 | |||
251 | Sigmas[sizei] = | ||
252 | covariance | ||
253 | ( | ||
254 | velocityMoments_[sizei], | ||
255 | Us[sizei].x(), | ||
256 | Us[sizei].y(), | ||
257 | Us[sizei].z() | ||
258 | ); | ||
259 | } | ||
260 | } | ||
261 | |||
262 | scalar alphard = 0.0; | ||
263 | |||
264 | forAll(velocityMoments_, sizei) | ||
265 | { | ||
266 | alphard += weights[sizei]/ds[sizei]; | ||
267 | } | ||
268 | |||
269 | // Compute source term coefficients and pair equilibrium distributions | ||
270 | forAll(velocityMoments_, sizei) | ||
271 | { | ||
272 | scalar di = ds[sizei]; | ||
273 | scalar Vi = Foam::constant::mathematical::pi/6.0*pow3(di); | ||
274 | scalar ni= weights[sizei]/Vi; | ||
275 | |||
276 | forAll(velocityMoments_, sizej) | ||
277 | { | ||
278 | scalar m0ij = weights[sizei] + weights[sizej]; | ||
279 | |||
280 | //- Do not compute null moment sets | ||
281 | if (m0ij > minM0_) | ||
282 | { | ||
283 | scalar dj = ds[sizej]; | ||
284 | scalar Vj = Foam::constant::mathematical::pi/6.0*pow3(dj); | ||
285 | scalar nj = weights[sizej]/Vj; | ||
286 | scalar dij = (di + dj)*0.5; | ||
287 | |||
288 | vector Uij = Us[sizei]; | ||
289 | symmTensor Sigmaij = Sigmas[sizei]; | ||
290 | |||
291 | scalar xi = Foam::constant::mathematical::pi*(ni*sqr(di) | ||
292 | + nj*sqr(dj))/6.0; | ||
293 | |||
294 | scalar g0ij = | ||
295 | 1.0/alphac | ||
296 | + 1.5*xi*di*dj/(sqr(alphac)*(dij)) | ||
297 | + 0.5*sqr(xi)/pow3(alphac)*sqr(di*dj/dij); | ||
298 | |||
299 | if (sizei == sizej) | ||
300 | { | ||
301 | // Total granular temperature | ||
302 | scalar Thetai = max(tr(Sigmas[sizei]), 0.0); | ||
303 | symmTensor Si = Sigmas[sizei] + symmTensor::I*Thetai; | ||
304 | |||
305 | // Covariance tensor | ||
306 | Sigmaij += | ||
307 | 0.5*(1.0 + e())*(0.25*(1.0 + e())*Si - Sigmas[sizei]); | ||
308 | |||
309 | // Collision time scale | ||
310 | Ks_[sizei][sizej] = | ||
311 | 24.0*g0ij*weights[sizej]*sqrt(Thetai) | ||
312 | /(sqrt(Foam::constant::mathematical::pi)*di); | ||
313 | } | ||
314 | else | ||
315 | { | ||
316 | const mappedScalarList& vmi = velocityMoments_[sizei]; | ||
317 | const mappedScalarList& vmj = velocityMoments_[sizej]; | ||
318 | |||
319 | // Total granular temperature | ||
320 | scalar Thetaij = | ||
321 | max | ||
322 | ( | ||
323 | (vmi(2) + vmj(2))/m0ij | ||
324 | - sqr((vmi(1) + vmj(1))/m0ij), | ||
325 | 0.0 | ||
326 | ); | ||
327 | |||
328 | if (nDimensions_ > 1) | ||
329 | { | ||
330 | Thetaij += | ||
331 | max | ||
332 | ( | ||
333 | (vmi(0,2) + vmj(0,2))/m0ij | ||
334 | - sqr((vmi(0,1) + vmj(0,1))/m0ij), | ||
335 | 0.0 | ||
336 | ); | ||
337 | } | ||
338 | |||
339 | if (nDimensions_ > 2) | ||
340 | { | ||
341 | Thetaij += | ||
342 | max | ||
343 | ( | ||
344 | (vmi(0,0,2) + vmj(0,0,2))/m0ij | ||
345 | - sqr((vmi(0,0,1) + vmj(0,0,1))/m0ij), | ||
346 | 0.0 | ||
347 | ); | ||
348 | } | ||
349 | |||
350 | Thetaij /= nDimensions_; | ||
351 | |||
352 | symmTensor Sij = | ||
353 | 0.5 | ||
354 | *( | ||
355 | Sigmas[sizei] | ||
356 | + Sigmas[sizej] | ||
357 | + symmTensor::one*Thetaij | ||
358 | ); | ||
359 | |||
360 | scalar XiPow3 = pow3(dij/dj); | ||
361 | scalar massi = Vi*rhos_[sizei]; | ||
362 | scalar massj = Vj*rhos_[sizej]; | ||
363 | scalar muij = 2.0*massj/(massi + massj); | ||
364 | |||
365 | // Collision time scale calculation | ||
366 | Ks_[sizei][sizej] = | ||
367 | 24.0*g0ij*weights[sizej]*XiPow3*sqrt(Thetaij) | ||
368 | /(sqrt(Foam::constant::mathematical::pi)*dij); | ||
369 | |||
370 | // Covariance | ||
371 | Sigmaij += | ||
372 | 0.5*(1.0 + e()) | ||
373 | *muij*(0.25*(1.0 + e())*muij*Sij - Sigmas[sizei]); | ||
374 | |||
375 | // Mean velocity | ||
376 | Uij += 0.25*(1.0 + e())*muij*(Us[sizej] - Us[sizei]); | ||
377 | } | ||
378 | |||
379 | // Compute equilibrium distribuition moments given mean velocity | ||
380 | // and covariance tensor | ||
381 | forAllIter | ||
382 | ( | ||
383 | List<momentFunction>, equilibriumMomentFunctions_, | ||
384 | iter | ||
385 | ) | ||
386 | { | ||
387 | (*iter) | ||
388 | ( | ||
389 | Gs_[sizei][sizej], | ||
390 | 1.0, | ||
391 | Uij.x(), | ||
392 | Uij.y(), | ||
393 | Uij.z(), | ||
394 | Sigmaij | ||
395 | ); | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | } | ||
400 | |||
401 | // Compute source terms | ||
402 | forAll(momentOrders_, mi) | ||
403 | { | ||
404 | const labelList& momentOrder = momentOrders_[mi]; | ||
405 | label si = momentOrder[sizeIndex_]; | ||
406 | labelList order(velocityIndexes_.size(), 0); | ||
407 | |||
408 | forAll(velocityIndexes_, cmpt) | ||
409 | { | ||
410 | order[cmpt] = momentOrder[velocityIndexes_[cmpt]]; | ||
411 | } | ||
412 | |||
413 | scalar& Meqi = Meq_(momentOrder)[celli]; | ||
414 | |||
415 | forAll(velocityMoments_, sizei) | ||
416 | { | ||
417 | scalar mCmpt = 0.0; | ||
418 | |||
419 | forAll(velocityMoments_, sizej) | ||
420 | { | ||
421 | mCmpt += | ||
422 | Ks_[sizei][sizej] | ||
423 | *( | ||
424 | Gs_[sizei][sizej](order)*weights[sizei] | ||
425 | - velocityMoments_[sizei](order) | ||
426 | ); | ||
427 | } | ||
428 | |||
429 | if (si > 0) | ||
430 | { | ||
431 | mCmpt *= | ||
432 | pow | ||
433 | ( | ||
434 | quadrature_.nodes()(sizei).primaryAbscissae()[sizeIndex_][celli], | ||
435 | si | ||
436 | ); | ||
437 | } | ||
438 | |||
439 | Meqi += mCmpt; | ||
440 | } | ||
441 | } | ||
225 | 442 | } | } |
443 | |||
226 | 444 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
227 | 445 | ||
228 | 446 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision::BGKCollision | Foam::populationBalanceSubModels::collisionKernels::BGKCollision::BGKCollision |
229 | 447 | ( | ( |
230 | 448 | const dictionary& dict, | const dictionary& dict, |
231 | 449 | const fvMesh& mesh, | const fvMesh& mesh, |
232 | const velocityQuadratureApproximation& quadrature, | ||
233 | const bool ode | ||
450 | const velocityQuadratureApproximation& quadrature | ||
234 | 451 | ) | ) |
235 | 452 | : | : |
236 | collisionKernel(dict, mesh, quadrature, ode), | ||
237 | tauCollisional_("tau", dimTime, dict), | ||
238 | Meqf_(quadrature.moments().size(), momentOrders_), | ||
239 | Meq_(quadrature.moments().size(), momentOrders_) | ||
453 | collisionKernel(dict, mesh, quadrature), | ||
454 | tauCollisional_ | ||
455 | ( | ||
456 | dimensionedScalar::lookupOrDefault("tau", dict, dimTime, small) | ||
457 | ), | ||
458 | Meq_(momentOrders_.size(), momentOrders_), | ||
459 | Ks_(nSizes_, scalarList(nSizes_, 0.0)), | ||
460 | minM0_(dict.lookupOrDefault("minM0", small)) | ||
240 | 461 | { | { |
241 | if (!ode) | ||
462 | if (nSizes_ > 0) | ||
242 | 463 | { | { |
243 | // Meqf_.setSize(quadrature.moments().size()); | ||
464 | implicit_ = false; | ||
465 | } | ||
244 | 466 | ||
245 | forAll(Meqf_, mi) | ||
246 | { | ||
247 | const labelList& momentOrder = momentOrders_[mi]; | ||
248 | Meqf_.set | ||
467 | forAll(momentOrders_, mi) | ||
468 | { | ||
469 | const labelList& momentOrder = momentOrders_[mi]; | ||
470 | |||
471 | Meq_.set | ||
472 | ( | ||
473 | momentOrder, | ||
474 | new volScalarField | ||
249 | 475 | ( | ( |
250 | momentOrder, | ||
251 | new volScalarField | ||
476 | IOobject | ||
252 | 477 | ( | ( |
253 | IOobject | ||
478 | IOobject::groupName | ||
254 | 479 | ( | ( |
255 | "Meq" + mappedList<scalar>::listToWord(momentOrder), | ||
256 | mesh_.time().timeName(), | ||
257 | mesh_ | ||
480 | "Meq", | ||
481 | mappedList<scalar>::listToWord(momentOrder) | ||
258 | 482 | ), | ), |
259 | mesh_, | ||
260 | dimensionedScalar | ||
483 | mesh_.time().timeName(), | ||
484 | mesh_ | ||
485 | ), | ||
486 | mesh_, | ||
487 | dimensionedScalar | ||
488 | ( | ||
489 | "zero", | ||
490 | quadrature.moments()[mi].dimensions(), | ||
491 | 0.0 | ||
492 | ) | ||
493 | ) | ||
494 | ); | ||
495 | } | ||
496 | |||
497 | // Add required equilibrium moment functions | ||
498 | mappedLabelList map(velocityMomentOrders_.size(), velocityMomentOrders_, 0); | ||
499 | |||
500 | addMomentFunction1(map, equilibriumMomentFunctions_, 0) | ||
501 | |||
502 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,0,1) | ||
503 | addMomentFunction2(map, equilibriumMomentFunctions_, 0,1) | ||
504 | addMomentFunction1(map, equilibriumMomentFunctions_, 1) | ||
505 | |||
506 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,0,2) | ||
507 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,1,1) | ||
508 | addMomentFunction2(map, equilibriumMomentFunctions_, 0,2) | ||
509 | addMomentFunction3(map, equilibriumMomentFunctions_, 1,0,1) | ||
510 | addMomentFunction2(map, equilibriumMomentFunctions_, 1,1) | ||
511 | addMomentFunction1(map, equilibriumMomentFunctions_, 2) | ||
512 | |||
513 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,0,3) | ||
514 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,1,2) | ||
515 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,2,1) | ||
516 | addMomentFunction2(map, equilibriumMomentFunctions_, 0,3) | ||
517 | addMomentFunction3(map, equilibriumMomentFunctions_, 1,0,2) | ||
518 | addMomentFunction3(map, equilibriumMomentFunctions_, 1,1,1) | ||
519 | addMomentFunction2(map, equilibriumMomentFunctions_, 1,2) | ||
520 | addMomentFunction3(map, equilibriumMomentFunctions_, 2,0,1) | ||
521 | addMomentFunction2(map, equilibriumMomentFunctions_, 2,1) | ||
522 | addMomentFunction1(map, equilibriumMomentFunctions_, 3) | ||
523 | |||
524 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,0,4) | ||
525 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,1,3) | ||
526 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,2,2) | ||
527 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,3,1) | ||
528 | addMomentFunction2(map, equilibriumMomentFunctions_, 0,4) | ||
529 | addMomentFunction3(map, equilibriumMomentFunctions_, 1,0,3) | ||
530 | addMomentFunction2(map, equilibriumMomentFunctions_, 1,3) | ||
531 | addMomentFunction3(map, equilibriumMomentFunctions_, 2,0,2) | ||
532 | addMomentFunction2(map, equilibriumMomentFunctions_, 2,2) | ||
533 | addMomentFunction3(map, equilibriumMomentFunctions_, 3,0,1) | ||
534 | addMomentFunction2(map, equilibriumMomentFunctions_, 3,1) | ||
535 | addMomentFunction1(map, equilibriumMomentFunctions_, 4) | ||
536 | |||
537 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,0,5) | ||
538 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,1,4) | ||
539 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,2,3) | ||
540 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,3,2) | ||
541 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,4,1) | ||
542 | addMomentFunction2(map, equilibriumMomentFunctions_, 0,5) | ||
543 | addMomentFunction3(map, equilibriumMomentFunctions_, 1,0,4) | ||
544 | addMomentFunction2(map, equilibriumMomentFunctions_, 1,4) | ||
545 | addMomentFunction3(map, equilibriumMomentFunctions_, 2,0,3) | ||
546 | addMomentFunction2(map, equilibriumMomentFunctions_, 2,3) | ||
547 | addMomentFunction3(map, equilibriumMomentFunctions_, 3,0,2) | ||
548 | addMomentFunction2(map, equilibriumMomentFunctions_, 3,2) | ||
549 | addMomentFunction3(map, equilibriumMomentFunctions_, 4,0,1) | ||
550 | addMomentFunction2(map, equilibriumMomentFunctions_, 4,1) | ||
551 | addMomentFunction1(map, equilibriumMomentFunctions_, 5) | ||
552 | |||
553 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,1,5) | ||
554 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,2,4) | ||
555 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,4,2) | ||
556 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,5,1) | ||
557 | addMomentFunction3(map, equilibriumMomentFunctions_, 1,0,5) | ||
558 | addMomentFunction2(map, equilibriumMomentFunctions_, 1,5) | ||
559 | addMomentFunction3(map, equilibriumMomentFunctions_, 2,0,4) | ||
560 | addMomentFunction2(map, equilibriumMomentFunctions_, 2,4) | ||
561 | addMomentFunction3(map, equilibriumMomentFunctions_, 4,0,2) | ||
562 | addMomentFunction2(map, equilibriumMomentFunctions_, 4,2) | ||
563 | addMomentFunction3(map, equilibriumMomentFunctions_, 5,0,1) | ||
564 | addMomentFunction2(map, equilibriumMomentFunctions_, 5,1) | ||
565 | |||
566 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,2,5) | ||
567 | addMomentFunction3(map, equilibriumMomentFunctions_, 0,5,1) | ||
568 | addMomentFunction3(map, equilibriumMomentFunctions_, 2,0,5) | ||
569 | addMomentFunction2(map, equilibriumMomentFunctions_, 2,5) | ||
570 | addMomentFunction3(map, equilibriumMomentFunctions_, 5,0,2) | ||
571 | addMomentFunction2(map, equilibriumMomentFunctions_, 5,2) | ||
572 | |||
573 | if (nSizes_ > 0) | ||
574 | { | ||
575 | // Equilibrium conditional distributions | ||
576 | velocityMoments_.resize(nSizes_); | ||
577 | Gs_.resize(nSizes_); | ||
578 | |||
579 | forAll(Gs_, cmi) | ||
580 | { | ||
581 | Gs_.set(cmi, new PtrList<mappedScalarList>(nSizes_)); | ||
582 | |||
583 | forAll(Gs_[cmi], cmj) | ||
584 | { | ||
585 | Gs_[cmi].set | ||
586 | ( | ||
587 | cmj, | ||
588 | new mappedScalarList | ||
261 | 589 | ( | ( |
262 | "zero", | ||
263 | quadrature.moments()[mi].dimensions(), | ||
590 | velocityMomentOrders_.size(), | ||
591 | velocityMomentOrders_, | ||
264 | 592 | 0.0 | 0.0 |
265 | 593 | ) | ) |
594 | ); | ||
595 | } | ||
596 | |||
597 | velocityMoments_.set | ||
598 | ( | ||
599 | cmi, | ||
600 | new mappedScalarList | ||
601 | ( | ||
602 | velocityMomentOrders_.size(), | ||
603 | velocityMomentOrders_, | ||
604 | 0.0 | ||
266 | 605 | ) | ) |
267 | 606 | ); | ); |
268 | 607 | } | } |
... | ... | Foam::populationBalanceSubModels::collisionKernels::BGKCollision | |
279 | 618 | ||
280 | 619 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
281 | 620 | ||
282 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
283 | ::updateCells | ||
621 | Foam::scalar | ||
622 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
623 | ::explicitCollisionSource | ||
284 | 624 | ( | ( |
625 | const labelList& momentOrder, | ||
285 | 626 | const label celli | const label celli |
286 | ) | ||
627 | ) const | ||
287 | 628 | { | { |
288 | if (nDimensions_ == 1) | ||
289 | { | ||
290 | updateCells1D(celli); | ||
291 | } | ||
292 | else if (nDimensions_ == 2) | ||
293 | { | ||
294 | updateCells2D(celli); | ||
295 | } | ||
296 | else if (nDimensions_ == 3) | ||
629 | if (implicit_) | ||
297 | 630 | { | { |
298 | updateCells3D(celli); | ||
631 | return 0.0; | ||
299 | 632 | } | } |
300 | } | ||
301 | 633 | ||
302 | void Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
303 | ::updateFields() | ||
304 | { | ||
305 | if (nDimensions_ == 1) | ||
306 | { | ||
307 | updateFields1D(); | ||
308 | } | ||
309 | else if (nDimensions_ == 2) | ||
634 | //- Return calculated source | ||
635 | if (nSizes_ > 0) | ||
310 | 636 | { | { |
311 | updateFields2D(); | ||
637 | return Meq_(momentOrder)[celli]; | ||
312 | 638 | } | } |
313 | else if (nDimensions_ == 3) | ||
314 | { | ||
315 | updateFields3D(); | ||
316 | } | ||
317 | } | ||
318 | 639 | ||
319 | Foam::scalar | ||
320 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision | ||
321 | ::explicitCollisionSource(const label mi, const label celli) const | ||
322 | { | ||
323 | return (Meq_[mi] - quadrature_.moments()[mi][celli])/tauCollisional_.value(); | ||
640 | return | ||
641 | ( | ||
642 | Meq_(momentOrder)[celli] | ||
643 | - quadrature_.moments()(momentOrder)[celli] | ||
644 | )/tauCollisional_.value(); | ||
324 | 645 | } | } |
325 | 646 | ||
647 | |||
326 | 648 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
327 | 649 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision | Foam::populationBalanceSubModels::collisionKernels::BGKCollision |
328 | ::implicitCollisionSource(const volVectorMoment& m) const | ||
650 | ::implicitCollisionSource(const volVelocityMoment& m) const | ||
329 | 651 | { | { |
330 | return | ||
652 | if (implicit_) | ||
653 | { | ||
654 | return | ||
655 | ( | ||
656 | Meq_(m.cmptOrders())/tauCollisional_ | ||
657 | - fvm::Sp(1.0/tauCollisional_, m) | ||
658 | ); | ||
659 | } | ||
660 | |||
661 | return tmp<fvScalarMatrix> | ||
331 | 662 | ( | ( |
332 | Meqf_(m.cmptOrders())/tauCollisional_ | ||
333 | - fvm::Sp(1/tauCollisional_, m) | ||
663 | new fvScalarMatrix | ||
664 | ( | ||
665 | m, | ||
666 | m.dimensions()*dimVolume/dimTime | ||
667 | ) | ||
334 | 668 | ); | ); |
335 | 669 | } | } |
336 | 670 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BGKCollision/BGKCollision.H changed (mode: 100644) (index 18f640a..eb8b778) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Collision model which returns the velocity distribution to a Maxwellian | Collision model which returns the velocity distribution to a Maxwellian |
29 | 29 | distribution (multivariate Gaussian) with at a given collisional time | distribution (multivariate Gaussian) with at a given collisional time |
30 | scale. | ||
30 | scale. Used as a base class for esBGK as well, but a different covariance | ||
31 | tensor is used as well a variable collision time scale. | ||
32 | Polydispersity is also handled, but a variabel time scale is used | ||
31 | 33 | ||
32 | 34 | SourceFiles | SourceFiles |
33 | 35 | BGKCollision.C | BGKCollision.C |
36 | equilibriumMomentFunctions.C | ||
34 | 37 | ||
35 | 38 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
36 | 39 | ||
... | ... | namespace populationBalanceSubModels | |
49 | 52 | namespace collisionKernels | namespace collisionKernels |
50 | 53 | { | { |
51 | 54 | ||
55 | #define defineMFunc(i,j,k) \ | ||
56 | static void moment##i##j##k \ | ||
57 | ( \ | ||
58 | mappedScalarList& Meq_, \ | ||
59 | const scalar& m0, \ | ||
60 | const scalar& u, \ | ||
61 | const scalar& v, \ | ||
62 | const scalar& w, \ | ||
63 | const symmTensor& sigma \ | ||
64 | ) | ||
65 | |||
52 | 66 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
53 | 67 | Class BGKCollision Declaration | Class BGKCollision Declaration |
54 | 68 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
... | ... | class BGKCollision | |
64 | 78 | ||
65 | 79 | ||
66 | 80 | protected: | protected: |
81 | |||
82 | //- Typedef of function pointer list | ||
83 | typedef void (*momentFunction) | ||
84 | ( | ||
85 | mappedScalarList& Meq, | ||
86 | const scalar&, | ||
87 | const scalar&, | ||
88 | const scalar&, | ||
89 | const scalar&, | ||
90 | const symmTensor& | ||
91 | ); | ||
92 | |||
67 | 93 | // Protected data | // Protected data |
68 | 94 | ||
69 | //- Equilibrium moments (fields) | ||
70 | mappedPtrList<volScalarField> Meqf_; | ||
95 | //- Equilibrium velocity moments (for each size) | ||
96 | mappedPtrList<volScalarField> Meq_; | ||
71 | 97 | ||
72 | //- Equilibrium moments (fields) | ||
73 | mappedList<scalar> Meq_; | ||
98 | //- List of functions used to calculate equilibrium moments | ||
99 | List<momentFunction> equilibriumMomentFunctions_; | ||
74 | 100 | ||
101 | //- Conditioned velocity moments | ||
102 | PtrList<mappedScalarList> velocityMoments_; | ||
75 | 103 | ||
76 | // Protected functions | ||
104 | //- Size conditioned equilibrium veloicity moments (Gaussian) | ||
105 | PtrList<PtrList<mappedScalarList>> Gs_; | ||
77 | 106 | ||
78 | //- Update equilibrium moments for a cell (1D) | ||
79 | void updateCells1D(const label celli); | ||
107 | //- Collisional times | ||
108 | scalarListList Ks_; | ||
80 | 109 | ||
81 | //- Update equilibrium moments for a cell (2D) | ||
82 | void updateCells2D(const label celli); | ||
110 | //- Minimum volume fraction | ||
111 | scalar minM0_; | ||
83 | 112 | ||
84 | //- Update equilibrium moments for a cell (3D) | ||
85 | void updateCells3D(const label celli); | ||
86 | 113 | ||
87 | //- Update equilibrium moments for fields (1D) | ||
88 | void updateFields1D(); | ||
114 | // Protected functions | ||
89 | 115 | ||
90 | //- Update equilibrium moments for fields (2D) | ||
91 | void updateFields2D(); | ||
116 | //- Return the covariance tensor using quadrature moments | ||
117 | virtual symmTensor covariance | ||
118 | ( | ||
119 | const label celli, | ||
120 | const scalar& u, | ||
121 | const scalar& v, | ||
122 | const scalar& w | ||
123 | ); | ||
92 | 124 | ||
93 | //- Update equilibrium moments for fields (3D) | ||
94 | void updateFields3D(); | ||
125 | //- Return the covariance tensor given a list of moments | ||
126 | virtual symmTensor covariance | ||
127 | ( | ||
128 | const mappedScalarList& moments, | ||
129 | const scalar& u, | ||
130 | const scalar& v, | ||
131 | const scalar& w | ||
132 | ); | ||
133 | |||
134 | //- Return the coefficient of restitution | ||
135 | virtual scalar e() const | ||
136 | { | ||
137 | return 1.0; | ||
138 | } | ||
139 | |||
140 | //- Functions used to define equilibrium moments | ||
141 | // Stored in a list so that moment existance does not have to be | ||
142 | // checked at every cell, for every itteration. The implementation of | ||
143 | // equilibrium moment functions are in equilibriumMomentFunctions.C | ||
144 | defineMFunc(0,0,0); | ||
145 | |||
146 | defineMFunc(0,0,1); | ||
147 | defineMFunc(0,1,0); | ||
148 | defineMFunc(1,0,0); | ||
149 | |||
150 | defineMFunc(0,0,2); | ||
151 | defineMFunc(0,1,1); | ||
152 | defineMFunc(0,2,0); | ||
153 | defineMFunc(1,0,1); | ||
154 | defineMFunc(1,1,0); | ||
155 | defineMFunc(2,0,0); | ||
156 | |||
157 | defineMFunc(0,0,3); | ||
158 | defineMFunc(0,1,2); | ||
159 | defineMFunc(0,2,1); | ||
160 | defineMFunc(0,3,0); | ||
161 | defineMFunc(1,0,2); | ||
162 | defineMFunc(1,1,1); | ||
163 | defineMFunc(1,2,0); | ||
164 | defineMFunc(2,0,1); | ||
165 | defineMFunc(2,1,0); | ||
166 | defineMFunc(3,0,0); | ||
167 | |||
168 | defineMFunc(0,0,4); | ||
169 | defineMFunc(0,1,3); | ||
170 | defineMFunc(0,2,2); | ||
171 | defineMFunc(0,3,1); | ||
172 | defineMFunc(0,4,0); | ||
173 | defineMFunc(1,0,3); | ||
174 | defineMFunc(1,3,0); | ||
175 | defineMFunc(2,0,2); | ||
176 | defineMFunc(2,2,0); | ||
177 | defineMFunc(3,0,1); | ||
178 | defineMFunc(3,1,0); | ||
179 | defineMFunc(4,0,0); | ||
180 | |||
181 | defineMFunc(0,0,5); | ||
182 | defineMFunc(0,1,4); | ||
183 | defineMFunc(0,2,3); | ||
184 | defineMFunc(0,3,2); | ||
185 | defineMFunc(0,4,1); | ||
186 | defineMFunc(0,5,0); | ||
187 | defineMFunc(1,0,4); | ||
188 | defineMFunc(1,4,0); | ||
189 | defineMFunc(2,0,3); | ||
190 | defineMFunc(2,3,0); | ||
191 | defineMFunc(3,0,2); | ||
192 | defineMFunc(3,2,0); | ||
193 | defineMFunc(4,0,1); | ||
194 | defineMFunc(4,1,0); | ||
195 | defineMFunc(5,0,0); | ||
196 | |||
197 | defineMFunc(0,1,5); | ||
198 | defineMFunc(0,2,4); | ||
199 | defineMFunc(0,4,2); | ||
200 | defineMFunc(0,5,1); | ||
201 | defineMFunc(2,0,4); | ||
202 | defineMFunc(2,4,0); | ||
203 | defineMFunc(1,0,5); | ||
204 | defineMFunc(1,5,0); | ||
205 | defineMFunc(4,0,2); | ||
206 | defineMFunc(4,2,0); | ||
207 | defineMFunc(5,0,1); | ||
208 | defineMFunc(5,1,0); | ||
209 | |||
210 | defineMFunc(0,2,5); | ||
211 | defineMFunc(0,5,2); | ||
212 | defineMFunc(2,0,5); | ||
213 | defineMFunc(2,5,0); | ||
214 | defineMFunc(5,0,2); | ||
215 | defineMFunc(5,2,0); | ||
95 | 216 | ||
96 | 217 | ||
97 | 218 | public: | public: |
... | ... | public: | |
107 | 228 | ( | ( |
108 | 229 | const dictionary& dict, | const dictionary& dict, |
109 | 230 | const fvMesh& mesh, | const fvMesh& mesh, |
110 | const velocityQuadratureApproximation& quadrature, | ||
111 | const bool ode | ||
231 | const velocityQuadratureApproximation& quadrature | ||
112 | 232 | ); | ); |
113 | 233 | ||
114 | 234 | ||
... | ... | public: | |
118 | 238 | ||
119 | 239 | // Member Functions | // Member Functions |
120 | 240 | ||
121 | //- Update equilibrium moments | ||
122 | virtual void updateCells(const label celli); | ||
241 | //- Is an implicit source used | ||
242 | virtual bool implicit() const | ||
243 | { | ||
244 | return implicit_; | ||
245 | } | ||
123 | 246 | ||
124 | 247 | //- Update equilibrium moments | //- Update equilibrium moments |
125 | virtual void updateFields(); | ||
248 | virtual void updateCells(const label celli); | ||
126 | 249 | ||
127 | 250 | //- Return explicit collision source term | //- Return explicit collision source term |
128 | 251 | virtual scalar explicitCollisionSource | virtual scalar explicitCollisionSource |
129 | 252 | ( | ( |
130 | const label mi, | ||
253 | const labelList& momentOrder, | ||
131 | 254 | const label celli | const label celli |
132 | 255 | ) const; | ) const; |
133 | 256 | ||
134 | 257 | //- Return implicit collision source matrix | //- Return implicit collision source matrix |
135 | 258 | virtual tmp<fvScalarMatrix> implicitCollisionSource | virtual tmp<fvScalarMatrix> implicitCollisionSource |
136 | 259 | ( | ( |
137 | const volVectorMoment& m | ||
260 | const volVelocityMoment& m | ||
138 | 261 | ) const; | ) const; |
139 | 262 | ||
140 | 263 | }; | }; |
141 | 264 | ||
265 | #define addMomentFunction1(map,funcs,i) \ | ||
266 | if (map.found(i)) \ | ||
267 | { \ | ||
268 | funcs.append(&moment##i##00); \ | ||
269 | } | ||
270 | |||
271 | #define addMomentFunction2(map,funcs,i,j) \ | ||
272 | if (map.found(i,j)) \ | ||
273 | { \ | ||
274 | funcs.append(&moment##i##j##0); \ | ||
275 | } | ||
276 | |||
277 | #define addMomentFunction3(map,funcs,i,j,k) \ | ||
278 | if (map.found(i,j,k)) \ | ||
279 | { \ | ||
280 | funcs.append(&moment##i##j##k); \ | ||
281 | } | ||
282 | |||
283 | #define momentFuncHeader(i,j,k) \ | ||
284 | void \ | ||
285 | Foam::populationBalanceSubModels::collisionKernels::BGKCollision::moment##i##j##k\ | ||
286 | ( \ | ||
287 | mappedScalarList& moments, \ | ||
288 | const scalar& m0, \ | ||
289 | const scalar& u, \ | ||
290 | const scalar& v, \ | ||
291 | const scalar& w, \ | ||
292 | const symmTensor& sigma \ | ||
293 | ) | ||
142 | 294 | ||
143 | 295 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
144 | 296 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BGKCollision/equilibriumMomentFunctions.C added (mode: 100644) (index 0000000..ebbcafe) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2019 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 | #include "BGKCollision.H" | ||
26 | |||
27 | // Zero order | ||
28 | momentFuncHeader(0,0,0) | ||
29 | { | ||
30 | moments(0) = m0; | ||
31 | } | ||
32 | |||
33 | // First order | ||
34 | momentFuncHeader(0,0,1) | ||
35 | { | ||
36 | moments(0,0,1) = m0*w; | ||
37 | } | ||
38 | |||
39 | momentFuncHeader(0,1,0) | ||
40 | { | ||
41 | moments(0,1) = m0*v; | ||
42 | } | ||
43 | |||
44 | momentFuncHeader(1,0,0) | ||
45 | { | ||
46 | moments(1) = m0*u; | ||
47 | } | ||
48 | |||
49 | // Second order | ||
50 | momentFuncHeader(0,0,2) | ||
51 | { | ||
52 | moments(0,0,2) = m0*(sigma.zz() + sqr(w)); | ||
53 | } | ||
54 | |||
55 | momentFuncHeader(0,1,1) | ||
56 | { | ||
57 | moments(0,1,1) = m0*(sigma.yz() + v*w); | ||
58 | } | ||
59 | |||
60 | momentFuncHeader(1,0,1) | ||
61 | { | ||
62 | moments(1,0,1) = m0*(sigma.xz() + u*w); | ||
63 | } | ||
64 | |||
65 | momentFuncHeader(1,1,0) | ||
66 | { | ||
67 | moments(1,1) = m0*(sigma.xy() + u*v); | ||
68 | } | ||
69 | |||
70 | momentFuncHeader(0,2,0) | ||
71 | { | ||
72 | moments(0,2) = m0*(sigma.yy() + sqr(v)); | ||
73 | } | ||
74 | |||
75 | momentFuncHeader(2,0,0) | ||
76 | { | ||
77 | moments(2) = m0*(sigma.xx() + sqr(u)); | ||
78 | } | ||
79 | |||
80 | // Third order | ||
81 | momentFuncHeader(0,0,3) | ||
82 | { | ||
83 | moments(0,0,3) = m0*(3.0*sigma.zz()*w + pow3(w)); | ||
84 | } | ||
85 | |||
86 | momentFuncHeader(0,1,2) | ||
87 | { | ||
88 | moments(0,1,2) = m0*(v*sqr(w) + 2.0*sigma.yz()*w + sigma.zz()*v); | ||
89 | } | ||
90 | |||
91 | momentFuncHeader(0,2,1) | ||
92 | { | ||
93 | moments(0,2,1) = m0*(w*sqr(v) + 2.0*sigma.yz()*v + sigma.yy()*w); | ||
94 | } | ||
95 | |||
96 | momentFuncHeader(0,3,0) | ||
97 | { | ||
98 | moments(0,3) = m0*(3.0*sigma.yy()*v + pow3(v)); | ||
99 | } | ||
100 | |||
101 | momentFuncHeader(1,0,2) | ||
102 | { | ||
103 | moments(1,0,2) = m0*(u*sqr(w) + 2.0*sigma.xz()*w + sigma.zz()*u); | ||
104 | } | ||
105 | |||
106 | momentFuncHeader(1,1,1) | ||
107 | { | ||
108 | moments(1,1,1) = m0*(sigma.xy()*w + sigma.xz()*v + sigma.yz()*u + u*v*w); | ||
109 | } | ||
110 | |||
111 | momentFuncHeader(1,2,0) | ||
112 | { | ||
113 | moments(1,2) = m0*(u*sqr(v) + 2.0*sigma.xy()*v + sigma.yy()*u); | ||
114 | } | ||
115 | |||
116 | momentFuncHeader(2,0,1) | ||
117 | { | ||
118 | moments(2,0,1) = m0*(w*sqr(u) + 2.0*sigma.xz()*u + sigma.xx()*w); | ||
119 | } | ||
120 | |||
121 | momentFuncHeader(2,1,0) | ||
122 | { | ||
123 | moments(2,1) = m0*(v*sqr(u) + 2.0*sigma.xy()*u + sigma.xx()*v); | ||
124 | } | ||
125 | |||
126 | momentFuncHeader(3,0,0) | ||
127 | { | ||
128 | moments(3) = m0*(3.0*sigma.xx()*u + pow3(u)); | ||
129 | } | ||
130 | |||
131 | // Fourth order | ||
132 | momentFuncHeader(0,0,4) | ||
133 | { | ||
134 | moments(0,0,4) = | ||
135 | m0*(6.0*sqr(w)*sigma.zz() + 3.0*sqr(sigma.zz()) + pow4(w)); | ||
136 | } | ||
137 | |||
138 | momentFuncHeader(0,1,3) | ||
139 | { | ||
140 | moments(0,1,3) = | ||
141 | m0 | ||
142 | *( | ||
143 | v*pow3(w) | ||
144 | + 3.0*sigma.yz()*sqr(w) | ||
145 | + 3.0*sigma.zz()*w*v | ||
146 | + 3.0*sigma.zz()*sigma.yz() | ||
147 | ); | ||
148 | } | ||
149 | |||
150 | momentFuncHeader(0,2,2) | ||
151 | { | ||
152 | moments(0,2,2) = | ||
153 | m0 | ||
154 | *( | ||
155 | 2.0*sqr(sigma.yz()) | ||
156 | + 4.0*sigma.yz()*v*w | ||
157 | + sqr(v*w) | ||
158 | + sigma.zz()*sqr(v) | ||
159 | + sigma.yy()*sqr(w) | ||
160 | + sigma.yy()*sigma.zz() | ||
161 | |||
162 | ); | ||
163 | } | ||
164 | |||
165 | momentFuncHeader(0,3,1) | ||
166 | { | ||
167 | moments(0,3,1) = | ||
168 | m0 | ||
169 | *( | ||
170 | w*pow3(v) | ||
171 | + 3.0*sigma.yz()*sqr(v) | ||
172 | + 3.0*sigma.yy()*v*w | ||
173 | + 3.0*sigma.yy()*sigma.yz() | ||
174 | ); | ||
175 | } | ||
176 | |||
177 | momentFuncHeader(0,4,0) | ||
178 | { | ||
179 | moments(0,4) = | ||
180 | m0*(6.0*sqr(v)*sigma.yy() + 3.0*sqr(sigma.yy()) + pow4(v)); | ||
181 | } | ||
182 | |||
183 | momentFuncHeader(1,0,3) | ||
184 | { | ||
185 | moments(1,0,3) = | ||
186 | m0 | ||
187 | *( | ||
188 | u*pow3(w) | ||
189 | + 3.0*sigma.xz()*sqr(w) | ||
190 | + 3.0*sigma.zz()*w*u | ||
191 | + 3.0*sigma.zz()*sigma.xz() | ||
192 | ); | ||
193 | } | ||
194 | |||
195 | momentFuncHeader(2,0,2) | ||
196 | { | ||
197 | moments(2,0,2) = | ||
198 | m0 | ||
199 | *( | ||
200 | 2.0*sqr(sigma.xz()) | ||
201 | + 4.0*sigma.xz()*u*w | ||
202 | + sqr(u*w) | ||
203 | + sigma.zz()*sqr(u) + sigma.xx()*sqr(w) | ||
204 | + sigma.xx()*sigma.zz() | ||
205 | ); | ||
206 | } | ||
207 | |||
208 | momentFuncHeader(2,2,0) | ||
209 | { | ||
210 | moments(2,2) = | ||
211 | m0 | ||
212 | *( | ||
213 | 2.0*sqr(sigma.xy()) | ||
214 | + 4.0*sigma.xy()*u*v | ||
215 | + sqr(u*v) | ||
216 | + sigma.yy()*sqr(u) | ||
217 | + sigma.xx()*sqr(v) | ||
218 | + sigma.xx()*sigma.yy() | ||
219 | ); | ||
220 | } | ||
221 | |||
222 | momentFuncHeader(1,3,0) | ||
223 | { | ||
224 | moments(1,3) = | ||
225 | m0 | ||
226 | *( | ||
227 | u*pow3(v) | ||
228 | + 3.0*sigma.xy()*sqr(v) | ||
229 | + 3.0*sigma.yy()*v*u | ||
230 | + 3.0*sigma.yy()*sigma.xy() | ||
231 | ); | ||
232 | } | ||
233 | |||
234 | momentFuncHeader(3,0,1) | ||
235 | { | ||
236 | moments(3,0,1) = | ||
237 | m0 | ||
238 | *( | ||
239 | w*pow3(u) | ||
240 | + 3.0*sigma.xz()*sqr(u) | ||
241 | + 3.0*sigma.xx()*u*w | ||
242 | + 3.0*sigma.xx()*sigma.xz() | ||
243 | ); | ||
244 | } | ||
245 | |||
246 | momentFuncHeader(3,1,0) | ||
247 | { | ||
248 | moments(3,1) = | ||
249 | m0 | ||
250 | *( | ||
251 | v*pow3(u) | ||
252 | + 3.0*sigma.xy()*sqr(u) | ||
253 | + 3.0*sigma.xx()*u*v | ||
254 | + 3.0*sigma.xx()*sigma.xy() | ||
255 | ); | ||
256 | } | ||
257 | |||
258 | momentFuncHeader(4,0,0) | ||
259 | { | ||
260 | moments(4) = | ||
261 | m0*(6.0*sqr(u)*sigma.xx() + 3.0*sqr(sigma.xx()) + pow4(u)); | ||
262 | } | ||
263 | |||
264 | |||
265 | // Fith order | ||
266 | momentFuncHeader(0,0,5) | ||
267 | { | ||
268 | moments(0,0,5) = | ||
269 | m0*(15.0*w*sqr(sigma.zz()) + 10.0*sigma.zz()*pow3(w) + pow5(w)); | ||
270 | } | ||
271 | |||
272 | momentFuncHeader(0,1,4) | ||
273 | { | ||
274 | moments(0,1,4) = | ||
275 | m0 | ||
276 | *( | ||
277 | 3.0*v*sqr(sigma.zz()) | ||
278 | + 6.0*v*sigma.zz()*sqr(w) | ||
279 | + 12.0*sigma.yz()*sigma.zz()*w | ||
280 | + v*pow4(w) | ||
281 | + 4.0*sigma.yz()*pow3(w) | ||
282 | ); | ||
283 | } | ||
284 | |||
285 | momentFuncHeader(0,2,3) | ||
286 | { | ||
287 | moments(0,2,3) = | ||
288 | m0 | ||
289 | *( | ||
290 | sqr(v)*pow3(w) | ||
291 | + sigma.yy()*pow3(w) | ||
292 | + 6.0*sqr(sigma.yz())*w | ||
293 | + 6.0*sigma.yz()*v*sqr(w) | ||
294 | + 3.0*sigma.zz()*sqr(v)*w | ||
295 | + 6.0*sigma.yz()*sigma.zz()*v | ||
296 | + 3.0*sigma.yy()*sigma.zz()*w | ||
297 | ); | ||
298 | } | ||
299 | |||
300 | momentFuncHeader(0,3,2) | ||
301 | { | ||
302 | moments(0,3,2) = | ||
303 | m0 | ||
304 | *( | ||
305 | pow3(v)*sqr(w) | ||
306 | + 6.0*sqr(sigma.yz())*v | ||
307 | + sigma.zz()*pow3(v) | ||
308 | + 3.0*sigma.yy()*v*sqr(w) | ||
309 | + 6.0*sigma.yz()*sqr(v)*w | ||
310 | + 3.0*sigma.yy()*sigma.zz()*v | ||
311 | + 6.0*sigma.yy()*sigma.yz()*w | ||
312 | ); | ||
313 | } | ||
314 | |||
315 | momentFuncHeader(0,4,1) | ||
316 | { | ||
317 | moments(0,4,1) = | ||
318 | m0 | ||
319 | *( | ||
320 | 3.0*w*sqr(sigma.yy()) | ||
321 | + 6.0*w*sigma.yy()*sqr(v) | ||
322 | + 12.0*sigma.yz()*sigma.yy()*v | ||
323 | + w*pow4(v) | ||
324 | + 4.0*sigma.yz()*pow3(v) | ||
325 | ); | ||
326 | } | ||
327 | |||
328 | momentFuncHeader(0,5,0) | ||
329 | { | ||
330 | moments(0,5) = | ||
331 | m0*(15.0*v*sqr(sigma.yy()) + 10.0*sigma.yy()*pow3(v) + pow5(v)); | ||
332 | } | ||
333 | |||
334 | momentFuncHeader(1,0,4) | ||
335 | { | ||
336 | moments(1,0,4) = | ||
337 | m0 | ||
338 | *( | ||
339 | 3.0*u*sqr(sigma.zz()) | ||
340 | + 6.0*u*sigma.zz()*sqr(w) | ||
341 | + 12.0*sigma.xz()*sigma.zz()*w | ||
342 | + u*pow4(w) | ||
343 | + 4.0*sigma.xz()*pow3(w) | ||
344 | ); | ||
345 | } | ||
346 | |||
347 | momentFuncHeader(1,4,0) | ||
348 | { | ||
349 | moments(1,4) = | ||
350 | m0 | ||
351 | *( | ||
352 | 3.0*u*sqr(sigma.yy()) | ||
353 | + 6.0*u*sigma.yy()*sqr(v) | ||
354 | + 12.0*sigma.xy()*sigma.yy()*v | ||
355 | + u*pow4(v) | ||
356 | + 4.0*sigma.xy()*pow3(v) | ||
357 | ); | ||
358 | } | ||
359 | |||
360 | momentFuncHeader(2,0,3) | ||
361 | { | ||
362 | moments(2,0,3) = | ||
363 | m0 | ||
364 | *( | ||
365 | sqr(u)*pow3(w) | ||
366 | + sigma.xx()*pow3(w) | ||
367 | + 6.0*sqr(sigma.xz())*w | ||
368 | + 6.0*sigma.xz()*u*sqr(w) | ||
369 | + 3.0*sigma.zz()*sqr(u)*w | ||
370 | + 6.0*sigma.xz()*sigma.zz()*u | ||
371 | + 3.0*sigma.xx()*sigma.zz()*w | ||
372 | ); | ||
373 | } | ||
374 | |||
375 | momentFuncHeader(2,3,0) | ||
376 | { | ||
377 | moments(2,3) = | ||
378 | m0 | ||
379 | *( | ||
380 | sqr(u)*pow3(v) | ||
381 | + sigma.xx()*pow3(v) | ||
382 | + 6.0*sqr(sigma.xy())*v | ||
383 | + 6.0*sigma.xy()*u*sqr(v) | ||
384 | + 3.0*sigma.yy()*sqr(u)*v | ||
385 | + 6.0*sigma.xy()*sigma.yy()*u | ||
386 | + 3.0*sigma.xx()*sigma.yy()*v | ||
387 | ); | ||
388 | } | ||
389 | |||
390 | momentFuncHeader(3,0,2) | ||
391 | { | ||
392 | moments(3,0,2) = | ||
393 | m0 | ||
394 | *( | ||
395 | pow3(u)*sqr(w) | ||
396 | + 6.0*sqr(sigma.xz())*u | ||
397 | + sigma.zz()*pow3(u) | ||
398 | + 3.0*sigma.xx()*u*sqr(w) | ||
399 | + 6.0*sigma.xz()*sqr(u)*w | ||
400 | + 3.0*sigma.xx()*sigma.zz()*u | ||
401 | + 6.0*sigma.xx()*sigma.xz()*w | ||
402 | ); | ||
403 | } | ||
404 | |||
405 | momentFuncHeader(3,2,0) | ||
406 | { | ||
407 | moments(3,2) = | ||
408 | m0 | ||
409 | *( | ||
410 | pow3(u)*sqr(v) | ||
411 | + 6.0*sqr(sigma.xy())*u | ||
412 | + sigma.yy()*pow3(u) | ||
413 | + 3.0*sigma.xx()*u*sqr(v) | ||
414 | + 6.0*sigma.xy()*sqr(u)*v | ||
415 | + 3.0*sigma.xx()*sigma.yy()*u | ||
416 | + 6.0*sigma.xx()*sigma.xy()*v | ||
417 | ); | ||
418 | } | ||
419 | |||
420 | momentFuncHeader(4,0,1) | ||
421 | { | ||
422 | moments(4,0,1) = | ||
423 | m0 | ||
424 | *( | ||
425 | 3.0*w*sqr(sigma.xx()) | ||
426 | + 6.0*w*sigma.xx()*sqr(u) | ||
427 | + 12.0*sigma.xz()*sigma.xx()*u | ||
428 | + w*pow4(u) | ||
429 | + 4.0*sigma.xz()*pow3(u) | ||
430 | ); | ||
431 | } | ||
432 | |||
433 | momentFuncHeader(4,1,0) | ||
434 | { | ||
435 | moments(4,1) = | ||
436 | m0 | ||
437 | *( | ||
438 | 3.0*v*sqr(sigma.xx()) | ||
439 | + 6.0*v*sigma.xx()*sqr(u) | ||
440 | + 12.0*sigma.xy()*sigma.xx()*u | ||
441 | + v*pow4(u) | ||
442 | + 4.0*sigma.xy()*pow3(u) | ||
443 | ); | ||
444 | } | ||
445 | |||
446 | momentFuncHeader(5,0,0) | ||
447 | { | ||
448 | moments(5) = | ||
449 | m0*(15.0*u*sqr(sigma.xx()) + 10.0*sigma.xx()*pow3(u) + pow5(u)); | ||
450 | } | ||
451 | |||
452 | |||
453 | // Sixth order | ||
454 | momentFuncHeader(0,1,5) | ||
455 | { | ||
456 | moments(0,1,5) = | ||
457 | m0 | ||
458 | *( | ||
459 | 15.0*v*w*sqr(sigma.zz()) | ||
460 | + 15.0*sigma.yz()*sqr(sigma.zz()) | ||
461 | + 10.0*v*sigma.zz()*pow3(w) | ||
462 | + 30.0*sigma.yz()*sigma.zz()*sqr(w) | ||
463 | + v*pow5(w) | ||
464 | + 5.0*sigma.yz()*pow4(w) | ||
465 | ); | ||
466 | } | ||
467 | |||
468 | momentFuncHeader(0,2,4) | ||
469 | { | ||
470 | moments(0,2,4) = | ||
471 | m0 | ||
472 | *( | ||
473 | 12.0*sqr(sigma.yz())*sigma.zz() | ||
474 | + 12.0*sqr(sigma.yz()*w) | ||
475 | + 24.0*sigma.yz()*sigma.zz()*v*w | ||
476 | + 8.0*sigma.yz()*v*pow3(w) | ||
477 | + 3.0*sqr(sigma.zz()*v) | ||
478 | + 3.0*sigma.yy()*sqr(sigma.zz()) | ||
479 | + 6.0*sigma.zz()*sqr(v*w) | ||
480 | + 6.0*sigma.yy()*sigma.zz()*sqr(w) | ||
481 | + sqr(v*sqr(w)) | ||
482 | + sigma.yy()*pow4(w) | ||
483 | ); | ||
484 | } | ||
485 | |||
486 | momentFuncHeader(0,4,2) | ||
487 | { | ||
488 | moments(0,4,2) = | ||
489 | m0 | ||
490 | *( | ||
491 | 3.0*sqr(sigma.yy()*w) | ||
492 | + 3.0*sigma.zz()*sqr(sigma.yy()) | ||
493 | + 12.0*sigma.yy()*sqr(sigma.yz()) | ||
494 | + 24.0*sigma.yy()*sigma.yz()*v*w | ||
495 | + 6.0*sigma.yy()*sqr(v*w) | ||
496 | + 6.0*sigma.zz()*sigma.yy()*sqr(v) | ||
497 | + 12.0*sqr(sigma.yz()*v) | ||
498 | + 8.0*sigma.yz()*pow3(v)*w | ||
499 | + sqr(sqr(v)*w) | ||
500 | + sigma.zz()*pow4(v) | ||
501 | ); | ||
502 | } | ||
503 | |||
504 | momentFuncHeader(0,5,1) | ||
505 | { | ||
506 | moments(0,5,1) = | ||
507 | m0 | ||
508 | *( | ||
509 | 15.0*w*v*sqr(sigma.yy()) | ||
510 | + 15.0*sigma.yz()*sqr(sigma.yy()) | ||
511 | + 10.0*w*sigma.yy()*pow3(v) | ||
512 | + 30.0*sigma.yz()*sigma.yy()*sqr(v) | ||
513 | + w*pow5(v) | ||
514 | + 5.0*sigma.yz()*pow4(v) | ||
515 | ); | ||
516 | } | ||
517 | |||
518 | momentFuncHeader(1,0,5) | ||
519 | { | ||
520 | moments(1,0,5) = | ||
521 | m0 | ||
522 | *( | ||
523 | 15.0*u*w*sqr(sigma.zz()) | ||
524 | + 15.0*sigma.xz()*sqr(sigma.zz()) | ||
525 | + 10.0*u*sigma.zz()*pow3(w) | ||
526 | + 30.0*sigma.xz()*sigma.zz()*sqr(w) | ||
527 | + u*pow5(w) | ||
528 | + 5.0*sigma.xz()*pow4(w) | ||
529 | ); | ||
530 | } | ||
531 | |||
532 | momentFuncHeader(1,5,0) | ||
533 | { | ||
534 | moments(1,5) = | ||
535 | m0 | ||
536 | *( | ||
537 | 15.0*u*v*sqr(sigma.yy()) | ||
538 | + 15.0*sigma.xy()*sqr(sigma.yy()) | ||
539 | + 10.0*u*sigma.yy()*pow3(v) | ||
540 | + 30.0*sigma.xy()*sigma.yy()*sqr(v) | ||
541 | + u*pow5(v) | ||
542 | + 5.0*sigma.xy()*pow4(v) | ||
543 | ); | ||
544 | } | ||
545 | |||
546 | momentFuncHeader(2,0,4) | ||
547 | { | ||
548 | moments(2,0,4) = | ||
549 | m0 | ||
550 | *( | ||
551 | 3.0*sqr(sigma.zz()*u) | ||
552 | + 12.0*sqr(sigma.xz()*w) | ||
553 | + sqr(u)*pow4(w) | ||
554 | + 3.0*sigma.xx()*sqr(sigma.zz()) | ||
555 | + 12.0*sqr(sigma.xz())*sigma.zz() | ||
556 | + sigma.xx()*pow4(w) | ||
557 | + 6.0*sigma.xx()*sigma.zz()*sqr(w) | ||
558 | + 8.0*sigma.xz()*u*pow3(w) | ||
559 | + 6.0*sigma.zz()*sqr(u*w) | ||
560 | + 24.0*sigma.xz()*sigma.zz()*u*w | ||
561 | ); | ||
562 | } | ||
563 | |||
564 | momentFuncHeader(2,4,0) | ||
565 | { | ||
566 | moments(2,4) = | ||
567 | m0 | ||
568 | *( | ||
569 | 3.0*sqr(sigma.yy()*u) | ||
570 | + 12.0*sqr(sigma.xy()*v) | ||
571 | + sqr(u)*pow4(v) | ||
572 | + 3.0*sigma.xx()*sqr(sigma.yy()) | ||
573 | + 12.0*sqr(sigma.xy())*sigma.yy() | ||
574 | + sigma.xx()*pow4(v) | ||
575 | + 6.0*sigma.xx()*sigma.yy()*sqr(v) | ||
576 | + 8.0*sigma.xy()*u*pow3(v) | ||
577 | + 6.0*sigma.yy()*sqr(u*v) | ||
578 | + 24.0*sigma.xy()*sigma.yy()*u*v | ||
579 | ); | ||
580 | } | ||
581 | |||
582 | momentFuncHeader(4,0,2) | ||
583 | { | ||
584 | moments(4,0,2) = | ||
585 | m0 | ||
586 | *( | ||
587 | 12.0*sqr(sigma.xz()*u) | ||
588 | + 3.0*sqr(sigma.xx()*w) | ||
589 | + pow4(u)*sqr(w) | ||
590 | + 12.0*sigma.xx()*sqr(sigma.xz()) | ||
591 | + 3.0*sqr(sigma.xx())*sigma.zz() | ||
592 | + sigma.zz()*pow4(u) | ||
593 | + 6.0*sigma.xx()*sigma.zz()*sqr(u) | ||
594 | + 8.0*sigma.xz()*pow3(u)*w | ||
595 | + 6.0*sigma.xx()*sqr(u*w) | ||
596 | + 24.0*sigma.xx()*sigma.xz()*u*w | ||
597 | ); | ||
598 | } | ||
599 | |||
600 | momentFuncHeader(4,2,0) | ||
601 | { | ||
602 | moments(4,2) = | ||
603 | m0 | ||
604 | *( | ||
605 | 12.0*sqr(sigma.xy()*u) | ||
606 | + 3.0*sqr(sigma.xx()*v) | ||
607 | + pow4(u)*sqr(v) | ||
608 | + 12.0*sigma.xx()*sqr(sigma.xy()) | ||
609 | + 3.0*sqr(sigma.xx())*sigma.yy() | ||
610 | + sigma.yy()*pow4(u) | ||
611 | + 6.0*sigma.xx()*sigma.yy()*sqr(u) | ||
612 | + 8.0*sigma.xy()*pow3(u)*v | ||
613 | + 6.0*sigma.xx()*sqr(u*v) | ||
614 | + 24.0*sigma.xx()*sigma.xy()*u*v | ||
615 | ); | ||
616 | } | ||
617 | |||
618 | momentFuncHeader(5,0,1) | ||
619 | { | ||
620 | moments(5,0,1) = | ||
621 | m0 | ||
622 | *( | ||
623 | 15.0*sqr(sigma.xx())*sigma.xz() | ||
624 | + 5.0*sigma.xz()*pow4(u) | ||
625 | + pow5(u)*w | ||
626 | + 30.0*sigma.xx()*sigma.xz()*sqr(u) | ||
627 | + 15.0*sqr(sigma.xx())*u*w | ||
628 | + 10.0*sigma.xx()*pow3(u)*w | ||
629 | ); | ||
630 | } | ||
631 | |||
632 | momentFuncHeader(5,1,0) | ||
633 | { | ||
634 | moments(5,1) = | ||
635 | m0 | ||
636 | *( | ||
637 | 15.0*sqr(sigma.xx())*sigma.xy() | ||
638 | + 5.0*sigma.xy()*pow4(u) | ||
639 | + pow5(u)*v | ||
640 | + 30.0*sigma.xx()*sigma.xy()*sqr(u) | ||
641 | + 15.0*sqr(sigma.xx())*u*v | ||
642 | + 10.0*sigma.xx()*pow3(u)*v | ||
643 | ); | ||
644 | } | ||
645 | |||
646 | momentFuncHeader(0,2,5) | ||
647 | { | ||
648 | moments(0,2,5) = | ||
649 | m0 | ||
650 | *( | ||
651 | 20.0*sqr(sigma.yz())*pow3(w) | ||
652 | + sqr(v)*pow5(w) | ||
653 | + sigma.yy()*pow5(w) | ||
654 | + 30.0*sigma.yz()*sqr(sigma.zz())*v | ||
655 | + 15.0*sigma.yy()*sqr(sigma.zz())*w | ||
656 | + 10.0*sigma.yy()*sigma.zz()*pow3(w) | ||
657 | + 60.0*sqr(sigma.yz())*sigma.zz()*w | ||
658 | + 10.0*sigma.yz()*v*pow4(w) | ||
659 | + 15.0*sqr(sigma.zz())*sqr(v)*w | ||
660 | + 10.0*sigma.zz()*sqr(v)*pow3(w) | ||
661 | + 60.0*sigma.yz()*sigma.zz()*v*sqr(w) | ||
662 | ); | ||
663 | } | ||
664 | |||
665 | momentFuncHeader(0,5,2) | ||
666 | { | ||
667 | moments(0,5,2) = | ||
668 | m0 | ||
669 | *( | ||
670 | 20.0*sqr(sigma.yz())*pow3(v) | ||
671 | + pow5(v)*sqr(w) | ||
672 | + sigma.zz()*pow5(v) | ||
673 | + 60.0*sigma.yy()*sqr(sigma.yz())*v | ||
674 | + 15.0*sqr(sigma.yy())*sigma.zz()*v | ||
675 | + 10.0*sigma.yy()*sigma.zz()*pow3(v) | ||
676 | + 30.0*sqr(sigma.yy())*sigma.yz()*w | ||
677 | + 10.0*sigma.yz()*pow4(v)*w | ||
678 | + 15.0*sqr(sigma.yy())*v*sqr(w) | ||
679 | + 10.0*sigma.yy()*pow3(v)*sqr(w) | ||
680 | + 60.0*sigma.yy()*sigma.yz()*sqr(v)*w | ||
681 | ); | ||
682 | } | ||
683 | |||
684 | momentFuncHeader(2,0,5) | ||
685 | { | ||
686 | moments(2,0,5) = | ||
687 | m0 | ||
688 | *( | ||
689 | 20.0*sqr(sigma.xz())*pow3(w) | ||
690 | + sqr(u)*pow5(w) | ||
691 | + sigma.xx()*pow5(w) | ||
692 | + 30.0*sigma.xz()*sqr(sigma.zz())*u | ||
693 | + 15.0*sigma.xx()*sqr(sigma.zz())*w | ||
694 | + 10.0*sigma.xx()*sigma.zz()*pow3(w) | ||
695 | + 60.0*sqr(sigma.xz())*sigma.zz()*w | ||
696 | + 10.0*sigma.xz()*u*pow4(w) | ||
697 | + 15.0*sqr(sigma.zz())*sqr(u)*w | ||
698 | + 10.0*sigma.zz()*sqr(u)*pow3(w) | ||
699 | + 60.0*sigma.xz()*sigma.zz()*u*sqr(w) | ||
700 | ); | ||
701 | } | ||
702 | |||
703 | momentFuncHeader(2,5,0) | ||
704 | { | ||
705 | moments(2,5) = | ||
706 | m0 | ||
707 | *( | ||
708 | 20.0*sqr(sigma.xy())*pow3(v) | ||
709 | + sqr(u)*pow5(v) | ||
710 | + sigma.xx()*pow5(v) | ||
711 | + 30.0*sigma.xy()*sqr(sigma.yy())*u | ||
712 | + 15.0*sigma.xx()*sqr(sigma.yy())*v | ||
713 | + 10.0*sigma.xx()*sigma.yy()*pow3(v) | ||
714 | + 60.0*sqr(sigma.xy())*sigma.yy()*v | ||
715 | + 10.0*sigma.xy()*u*pow4(v) | ||
716 | + 15.0*sqr(sigma.yy())*sqr(u)*v | ||
717 | + 10.0*sigma.yy()*sqr(u)*pow3(v) | ||
718 | + 60.0*sigma.xy()*sigma.yy()*u*sqr(v) | ||
719 | ); | ||
720 | } | ||
721 | |||
722 | momentFuncHeader(5,0,2) | ||
723 | { | ||
724 | moments(5,0,2) = | ||
725 | m0 | ||
726 | *( | ||
727 | 20.0*sqr(sigma.xz())*pow3(u) | ||
728 | + pow5(u)*sqr(w) | ||
729 | + sigma.zz()*pow5(u) | ||
730 | + 60.0*sigma.xx()*sqr(sigma.xz())*u | ||
731 | + 15.0*sqr(sigma.xx())*sigma.zz()*u | ||
732 | + 10.0*sigma.xx()*sigma.zz()*pow3(u) | ||
733 | + 30.0*sqr(sigma.xx())*sigma.xz()*w | ||
734 | + 10.0*sigma.xz()*pow4(u)*w | ||
735 | + 15.0*sqr(sigma.xx())*u*sqr(w) | ||
736 | + 10.0*sigma.xx()*pow3(u)*sqr(w) | ||
737 | + 60.0*sigma.xx()*sigma.xz()*sqr(u)*w | ||
738 | ); | ||
739 | } | ||
740 | |||
741 | momentFuncHeader(5,2,0) | ||
742 | { | ||
743 | moments(5,2) = | ||
744 | m0 | ||
745 | *( | ||
746 | 20.0*sqr(sigma.xy())*pow3(u) | ||
747 | + pow5(u)*sqr(v) | ||
748 | + sigma.yy()*pow5(u) | ||
749 | + 60.0*sigma.xx()*sqr(sigma.xy())*u | ||
750 | + 15.0*sqr(sigma.xx())*sigma.yy()*u | ||
751 | + 10.0*sigma.xx()*sigma.yy()*pow3(u) | ||
752 | + 30.0*sqr(sigma.xx())*sigma.xy()*v | ||
753 | + 10.0*sigma.xy()*pow4(u)*v | ||
754 | + 15.0*sqr(sigma.xx())*u*sqr(v) | ||
755 | + 10.0*sigma.xx()*pow3(u)*sqr(v) | ||
756 | + 60.0*sigma.xx()*sigma.xy()*sqr(u)*v | ||
757 | ); | ||
758 | } | ||
759 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BoltzmannCollision/BoltzmannCollision.C changed (mode: 100644) (index a08c614..cf33add) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | 26 | #include "BoltzmannCollision.H" | #include "BoltzmannCollision.H" |
27 | #include "constants.H" | ||
27 | 28 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | 29 | ||
29 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
... | ... | namespace collisionKernels | |
50 | 51 | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // |
51 | 52 | ||
52 | 53 | void | void |
53 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision::I1D | ||
54 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision::updateI | ||
54 | 55 | ( | ( |
55 | 56 | const label celli, | const label celli, |
56 | 57 | const label node1, | const label node1, |
57 | const label node2 | ||
58 | const label node2, | ||
59 | const scalar omega | ||
58 | 60 | ) | ) |
59 | 61 | { | { |
60 | const vector& u1 = quadrature_.nodes()[node1].primaryAbscissa()[celli]; | ||
61 | const vector& u2 = quadrature_.nodes()[node2].primaryAbscissa()[celli]; | ||
62 | scalar v1(u1.x()); | ||
63 | vector g = u1 - u2; | ||
64 | scalar g1(g.x()); | ||
65 | scalar g1Sqr(sqr(g1)); | ||
66 | scalar gMag = mag(g); | ||
67 | scalar gMagSqr = sqr(gMag); | ||
68 | scalar omegaSqr = sqr(omega_); | ||
69 | scalar omegaPow3 = omega_*omegaSqr; | ||
70 | scalar omegaPow4 = omegaSqr*omegaSqr; | ||
71 | |||
72 | Is_(0) = 0.0; | ||
73 | Is_(1) = -(omega_/2.0)*g1; | ||
74 | Is_(2) = (omegaSqr/12.0)*gMagSqr + (omegaSqr/4.0)*g1Sqr - omega_*g1*v1; | ||
75 | Is_(3) = | ||
76 | - (omegaPow3/8.0)*(gMagSqr + g1Sqr)*g1 | ||
77 | + (omegaSqr/4.0)*(gMagSqr + 3.0*g1Sqr)*v1 | ||
78 | - (1.5*omega_)*g1*sqr(v1); | ||
79 | Is_(4) = | ||
80 | (omegaPow4/80.0)*(sqr(gMagSqr) + 10.0*gMagSqr*g1Sqr + 5.0*sqr(g1Sqr)) | ||
81 | - (omegaPow3/2.0)*(gMagSqr + g1Sqr)*g1*v1 | ||
82 | + (omegaSqr/2.0)*(gMagSqr + 3.0*g1Sqr)*sqr(v1) | ||
83 | - 2.0*omega_*g1*pow3(v1); | ||
84 | } | ||
62 | const vector& u1 = quadrature_.nodes()[node1].velocityAbscissae()[celli]; | ||
63 | const vector& u2 = quadrature_.nodes()[node2].velocityAbscissae()[celli]; | ||
85 | 64 | ||
86 | void | ||
87 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision::I2D | ||
88 | ( | ||
89 | const label celli, | ||
90 | const label node1, | ||
91 | const label node2 | ||
92 | ) | ||
93 | { | ||
94 | const vector& u1 = quadrature_.nodes()[node1].primaryAbscissa()[celli]; | ||
95 | const vector& u2 = quadrature_.nodes()[node2].primaryAbscissa()[celli]; | ||
96 | scalar v1(u1.x()); | ||
97 | scalar v2(u1.y()); | ||
65 | // Store powers of velocities to reduce evaluations | ||
98 | 66 | vector g = u1 - u2; | vector g = u1 - u2; |
99 | scalar g1(g.x()); | ||
100 | scalar g1Sqr(sqr(g1)); | ||
101 | scalar g2(g.y()); | ||
102 | scalar g2Sqr(sqr(g2)); | ||
103 | scalar gMag = mag(g); | ||
104 | scalar gMagSqr = sqr(gMag); | ||
105 | scalar omegaSqr = sqr(omega_); | ||
106 | scalar omegaPow3 = omega_*omegaSqr; | ||
107 | scalar omegaPow4 = omegaSqr*omegaSqr; | ||
108 | |||
109 | Is_(0,0) = 0.0; | ||
110 | Is_(1,0) = -(omega_/2.0)*g1; | ||
111 | Is_(0,1) = -(omega_/2.0)*g2; | ||
112 | Is_(2,0) = (omegaSqr/12.0)*gMagSqr + (omegaSqr/4.0)*g1Sqr - omega_*g1*v1; | ||
113 | Is_(1,1) = (omegaSqr/4.0)*g1*g2 - (omega_/2.0)*(v1*g2 + g1*v2); | ||
114 | Is_(0,2) = (omegaSqr/12.0)*gMagSqr + (omegaSqr/4.0)*g2Sqr - omega_*g2*v2; | ||
115 | Is_(3,0) = | ||
116 | - (omegaPow3/8.0)*(gMagSqr + g1Sqr)*g1 | ||
117 | + (omegaSqr/4.0)*(gMagSqr + 3.0*g1Sqr)*v1 | ||
118 | - (1.5*omega_)*g1*sqr(v1); | ||
119 | Is_(0,3) = | ||
120 | - (omegaPow3/8.0)*(gMagSqr + g2Sqr)*g2 | ||
121 | + (omegaSqr/4.0)*(gMagSqr + 3.0*g2Sqr)*v2 | ||
122 | - (1.5*omega_)*g2*sqr(v2); | ||
123 | Is_(4,0) = | ||
124 | (omegaPow4/80.0)*(sqr(gMagSqr) + 10.0*gMagSqr*g1Sqr + 5.0*sqr(g1Sqr)) | ||
125 | - (omegaPow3/2.0)*(gMagSqr + g1Sqr)*g1*v1 | ||
126 | + (omegaSqr/2.0)*(gMagSqr + 3.0*g1Sqr)*sqr(v1) | ||
127 | - 2.0*omega_*g1*pow3(v1); | ||
128 | Is_(0,4) = | ||
129 | (omegaPow4/80.0)*(sqr(gMagSqr) + 10.0*gMagSqr*g2Sqr + 5.0*sqr(g2Sqr)) | ||
130 | - (omegaPow3/2.0)*(gMagSqr + g2Sqr)*g2*v2 | ||
131 | + (omegaSqr/2.0)*(gMagSqr + 3.0*g2Sqr)*sqr(v2) | ||
132 | - 2.0*omega_*g2*pow3(v2); | ||
133 | } | ||
67 | scalarList omegaPow(6, omega); | ||
68 | vectorList gPow(6, g); | ||
69 | scalar gMagSqr(magSqr(g)); | ||
70 | vectorList vPow(6, u1); | ||
134 | 71 | ||
135 | void | ||
136 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision::I3D | ||
137 | ( | ||
138 | const label celli, | ||
139 | const label node1, | ||
140 | const label node2 | ||
141 | ) | ||
142 | { | ||
143 | const vector& u1 = quadrature_.nodes()[node1].primaryAbscissa()[celli]; | ||
144 | const vector& u2 = quadrature_.nodes()[node2].primaryAbscissa()[celli]; | ||
145 | scalar v1(u1.x()); | ||
146 | scalar v2(u1.y()); | ||
147 | scalar v3(u1.z()); | ||
148 | vector g = u1 - u2; | ||
149 | scalar g1(g.x()); | ||
150 | scalar g1Sqr(sqr(g1)); | ||
151 | scalar g2(g.y()); | ||
152 | scalar g2Sqr(sqr(g2)); | ||
153 | scalar g3(g.z()); | ||
154 | scalar g3Sqr(sqr(g3)); | ||
155 | scalar gMag = mag(g); | ||
156 | scalar gMagSqr = sqr(gMag); | ||
157 | scalar omegaSqr = sqr(omega_); | ||
158 | scalar omegaPow3 = omega_*omegaSqr; | ||
159 | scalar omegaPow4 = omegaSqr*omegaSqr; | ||
160 | |||
161 | Is_(0,0,0) = 0.0; | ||
162 | Is_(1,0,0) = -(omega_/2.0)*g1; | ||
163 | Is_(0,1,0) = -(omega_/2.0)*g2; | ||
164 | Is_(0,0,1) = -(omega_/2.0)*g3; | ||
165 | Is_(2,0,0) = (omegaSqr/12.0)*gMagSqr + (omegaSqr/4.0)*g1Sqr - omega_*g1*v1; | ||
166 | Is_(1,1,0) = (omegaSqr/4.0)*g1*g2 - (omega_/2.0)*(v1*g2 + g1*v2); | ||
167 | Is_(1,0,1) = (omegaSqr/4.0)*g1*g3 - (omega_/2.0)*(v1*g3 + g1*v3); | ||
168 | Is_(0,2,0) = (omegaSqr/12.0)*gMagSqr + (omegaSqr/4.0)*g2Sqr - omega_*g2*v2; | ||
169 | Is_(0,1,1) = (omegaSqr/4.0)*g2*g3 - (omega_/2.0)*(v2*g3 + g2*v3); | ||
170 | Is_(0,0,2) = (omegaSqr/12.0)*gMagSqr + (omegaSqr/4.0)*g3Sqr - omega_*g3*v3; | ||
171 | Is_(3,0,0) = | ||
172 | - (omegaPow3/8.0)*(gMagSqr + g1Sqr)*g1 | ||
173 | + (omegaSqr/4.0)*(gMagSqr + 3.0*g1Sqr)*v1 | ||
174 | - (1.5*omega_)*g1*sqr(v1); | ||
175 | Is_(0,3,0) = | ||
176 | - (omegaPow3/8.0)*(gMagSqr + g2Sqr)*g2 | ||
177 | + (omegaSqr/4.0)*(gMagSqr + 3.0*g2Sqr)*v2 | ||
178 | - (1.5*omega_)*g2*sqr(v2); | ||
179 | Is_(0,0,3) = | ||
180 | - (omegaPow3/8.0)*(gMagSqr + g3Sqr)*g3 | ||
181 | + (omegaSqr/4.0)*(gMagSqr + 3.0*g3Sqr)*v3 | ||
182 | - (1.5*omega_)*g3*sqr(v3); | ||
183 | Is_(4,0,0) = | ||
184 | (omegaPow4/80.0)*(sqr(gMagSqr) + 10.0*gMagSqr*g1Sqr + 5.0*sqr(g1Sqr)) | ||
185 | - (omegaPow3/2.0)*(gMagSqr + g1Sqr)*g1*v1 | ||
186 | + (omegaSqr/2.0)*(gMagSqr + 3.0*g1Sqr)*sqr(v1) | ||
187 | - 2.0*omega_*g1*pow3(v1); | ||
188 | Is_(0,4,0) = | ||
189 | (omegaPow4/80.0)*(sqr(gMagSqr) + 10.0*gMagSqr*g2Sqr + 5.0*sqr(g2Sqr)) | ||
190 | - (omegaPow3/2.0)*(gMagSqr + g2Sqr)*g2*v2 | ||
191 | + (omegaSqr/2.0)*(gMagSqr + 3.0*g2Sqr)*sqr(v2) | ||
192 | - 2.0*omega_*g2*pow3(v2); | ||
193 | Is_(0,0,4) = | ||
194 | (omegaPow4/80.0)*(sqr(gMagSqr) + 10.0*gMagSqr*g3Sqr + 5.0*sqr(g3Sqr)) | ||
195 | - (omegaPow3/2.0)*(gMagSqr + g3Sqr)*g3*v3 | ||
196 | + (omegaSqr/2.0)*(gMagSqr + 3.0*g3Sqr)*sqr(v3) | ||
197 | - 2.0*omega_*g3*pow3(v3); | ||
72 | forAll(gPow, powi) | ||
73 | { | ||
74 | omegaPow[powi] = pow(omega, powi); | ||
75 | for (label cmpt = 0; cmpt < 3; cmpt++) | ||
76 | { | ||
77 | gPow[powi][cmpt] = pow(g[cmpt], powi); | ||
78 | vPow[powi][cmpt] = pow(u1[cmpt], powi); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | // Update coefficients for zero order terms | ||
83 | forAllIter(List<momentFunction>, coefficientFunctions_, iter) | ||
84 | { | ||
85 | (*iter)(Is_, omegaPow, gPow, gMagSqr, vPow); | ||
86 | } | ||
87 | |||
88 | // Update first order (Enskog) terms if used | ||
89 | if (Enskog_) | ||
90 | { | ||
91 | forAllIter(List<momentFunction>, enskogFunctions_[0], iter) | ||
92 | { | ||
93 | (*iter)(I1s_[0], omegaPow, gPow, gMagSqr, vPow); | ||
94 | } | ||
95 | |||
96 | if (nDimensions_ > 1) | ||
97 | { | ||
98 | forAllIter(List<momentFunction>, enskogFunctions_[1], iter) | ||
99 | { | ||
100 | (*iter)(I1s_[1], omegaPow, gPow, gMagSqr, vPow); | ||
101 | } | ||
102 | } | ||
103 | if (nDimensions_ > 2) | ||
104 | { | ||
105 | forAllIter(List<momentFunction>, enskogFunctions_[2], iter) | ||
106 | { | ||
107 | (*iter)(I1s_[2], omegaPow, gPow, gMagSqr, vPow); | ||
108 | } | ||
109 | } | ||
110 | } | ||
198 | 111 | } | } |
199 | 112 | ||
200 | 113 | ||
201 | 114 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
202 | 115 | ||
203 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision::BoltzmannCollision | ||
116 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | ||
117 | ::BoltzmannCollision | ||
204 | 118 | ( | ( |
205 | 119 | const dictionary& dict, | const dictionary& dict, |
206 | 120 | const fvMesh& mesh, | const fvMesh& mesh, |
207 | const velocityQuadratureApproximation& quadrature, | ||
208 | const bool ode | ||
121 | const velocityQuadratureApproximation& quadrature | ||
209 | 122 | ) | ) |
210 | 123 | : | : |
211 | collisionKernel(dict, mesh, quadrature, ode), | ||
212 | dp_("d", dimless, dict), | ||
124 | collisionKernel(dict, mesh, quadrature), | ||
213 | 125 | e_(dict.lookupType<scalar>("e")), | e_(dict.lookupType<scalar>("e")), |
214 | 126 | omega_((1.0 + e_)*0.5), | omega_((1.0 + e_)*0.5), |
215 | Is_(momentOrders_.size(), momentOrders_), | ||
216 | Cs_(momentOrders_.size(), momentOrders_) | ||
127 | Enskog_(dict.lookupOrDefault("Enskog", false)), | ||
128 | scalarIndexes_(quadrature.nodes()[0].scalarIndexes()), | ||
129 | Is_(velocityMomentOrders_.size(), velocityMomentOrders_, 0.0), | ||
130 | I1s_(velocityIndexes_.size()), | ||
131 | Cs_(momentOrders_.size(), momentOrders_), | ||
132 | gradWs_(), | ||
133 | Gs_(momentOrders_.size(), momentOrders_) | ||
217 | 134 | { | { |
218 | Info<<"found d.particles"<<endl; | ||
219 | if (!ode) | ||
135 | implicit_ = false; | ||
136 | forAll(Cs_, mi) | ||
220 | 137 | { | { |
221 | FatalErrorInFunction | ||
222 | << "Boltzmann collision kernel does not support implicit" << nl | ||
223 | << "solutions to the collisional source term." | ||
224 | << abort(FatalError); | ||
138 | const labelList& momentOrder = momentOrders_[mi]; | ||
139 | Cs_.set | ||
140 | ( | ||
141 | momentOrder, | ||
142 | new volScalarField | ||
143 | ( | ||
144 | IOobject | ||
145 | ( | ||
146 | "collisionalSource." | ||
147 | + mappedList<scalar>::listToWord(momentOrder), | ||
148 | mesh_.time().timeName(), | ||
149 | mesh_ | ||
150 | ), | ||
151 | mesh_, | ||
152 | dimensionedScalar | ||
153 | ( | ||
154 | "zero", | ||
155 | quadrature.moments()[mi].dimensions()/dimTime, | ||
156 | 0.0 | ||
157 | ) | ||
158 | ) | ||
159 | ); | ||
225 | 160 | } | } |
161 | |||
162 | if (Enskog_) | ||
163 | { | ||
164 | forAll(velocityIndexes_, cmpt) | ||
165 | { | ||
166 | I1s_.set | ||
167 | ( | ||
168 | cmpt, | ||
169 | new mappedScalarList | ||
170 | ( | ||
171 | velocityMomentOrders_.size(), | ||
172 | velocityMomentOrders_, | ||
173 | 0.0 | ||
174 | ) | ||
175 | ); | ||
176 | } | ||
177 | |||
178 | gradWs_.resize(quadrature_.nodes().size()); | ||
179 | |||
180 | forAll(gradWs_, nodei) | ||
181 | { | ||
182 | gradWs_.set | ||
183 | ( | ||
184 | nodei, | ||
185 | new volVectorField | ||
186 | ( | ||
187 | fvc::grad(quadrature.nodes()[nodei].primaryWeight()) | ||
188 | ) | ||
189 | ); | ||
190 | } | ||
191 | |||
192 | forAll(Gs_, mi) | ||
193 | { | ||
194 | const labelList& momentOrder = momentOrders_[mi]; | ||
195 | |||
196 | Gs_.set | ||
197 | ( | ||
198 | mi, | ||
199 | new volVectorField | ||
200 | ( | ||
201 | IOobject | ||
202 | ( | ||
203 | IOobject::groupName | ||
204 | ( | ||
205 | IOobject::groupName | ||
206 | ( | ||
207 | "collisionalFlux", | ||
208 | mappedScalarList::listToWord(momentOrder) | ||
209 | ), | ||
210 | quadrature_.moments()[0].group() | ||
211 | ), | ||
212 | mesh.time().timeName(), | ||
213 | mesh | ||
214 | ), | ||
215 | mesh, | ||
216 | dimensionedVector | ||
217 | ( | ||
218 | "zero", | ||
219 | quadrature_.moments()(momentOrder).dimensions()*dimLength/dimTime, | ||
220 | Zero | ||
221 | ), | ||
222 | wordList | ||
223 | ( | ||
224 | quadrature_.moments()[0].boundaryField().size(), | ||
225 | "zeroGradient" | ||
226 | ) | ||
227 | ) | ||
228 | ); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | //- Check if moments exist and add coefficient functions | ||
233 | mappedLabelList map(velocityMomentOrders_.size(), velocityMomentOrders_, 0); | ||
234 | |||
235 | addIFunction1(map, 0) | ||
236 | |||
237 | addIFunction3(map, 0,0,1) | ||
238 | addIFunction2(map, 0,1) | ||
239 | addIFunction1(map, 1) | ||
240 | |||
241 | addIFunction3(map, 0,0,2) | ||
242 | addIFunction3(map, 0,1,1) | ||
243 | addIFunction2(map, 0,2) | ||
244 | addIFunction3(map, 1,0,1) | ||
245 | addIFunction2(map, 1,1) | ||
246 | addIFunction1(map, 2) | ||
247 | |||
248 | addIFunction3(map, 0,0,3) | ||
249 | addIFunction3(map, 0,1,2) | ||
250 | addIFunction3(map, 0,2,1) | ||
251 | addIFunction2(map, 0,3) | ||
252 | addIFunction3(map, 1,0,2) | ||
253 | addIFunction3(map, 1,1,1) | ||
254 | addIFunction2(map, 1,2) | ||
255 | addIFunction3(map, 2,0,1) | ||
256 | addIFunction2(map, 2,1) | ||
257 | addIFunction1(map, 3) | ||
258 | // | ||
259 | addIFunction3(map, 0,0,4) | ||
260 | // addIFunction3(map, 0,1,3) | ||
261 | // addIFunction3(map, 0,2,2) | ||
262 | // addIFunction3(map, 0,3,1) | ||
263 | addIFunction2(map, 0,4) | ||
264 | // addIFunction3(map, 1,0,3) | ||
265 | // addIFunction2(map, 1,3) | ||
266 | // addIFunction3(map, 2,0,2) | ||
267 | // addIFunction2(map, 2,2) | ||
268 | // addIFunction3(map, 3,0,1) | ||
269 | // addIFunction2(map, 3,1) | ||
270 | addIFunction1(map, 4) | ||
271 | // | ||
272 | // addIFunction3(map, 0,0,5) | ||
273 | // addIFunction3(map, 0,1,4) | ||
274 | // addIFunction3(map, 0,2,3) | ||
275 | // addIFunction3(map, 0,3,2) | ||
276 | // addIFunction3(map, 0,4,1) | ||
277 | // addIFunction2(map, 0,5) | ||
278 | // addIFunction3(map, 1,0,4) | ||
279 | // addIFunction2(map, 1,4) | ||
280 | // addIFunction3(map, 2,0,3) | ||
281 | // addIFunction2(map, 2,3) | ||
282 | // addIFunction3(map, 3,0,2) | ||
283 | // addIFunction2(map, 3,2) | ||
284 | // addIFunction3(map, 4,0,1) | ||
285 | // addIFunction2(map, 4,1) | ||
286 | // addIFunction1(map, 5) | ||
287 | // | ||
288 | // addIFunction3(map, 0,1,5) | ||
289 | // addIFunction3(map, 0,2,4) | ||
290 | // addIFunction3(map, 0,4,2) | ||
291 | // addIFunction3(map, 0,5,1) | ||
292 | // addIFunction3(map, 1,0,5) | ||
293 | // addIFunction2(map, 1,5) | ||
294 | // addIFunction3(map, 2,0,4) | ||
295 | // addIFunction2(map, 2,4) | ||
296 | // addIFunction3(map, 4,0,2) | ||
297 | // addIFunction2(map, 4,2) | ||
298 | // addIFunction3(map, 5,0,1) | ||
299 | // addIFunction2(map, 5,1) | ||
300 | // | ||
301 | // addIFunction3(map, 0,2,5) | ||
302 | // addIFunction3(map, 0,5,1) | ||
303 | // addIFunction3(map, 2,0,5) | ||
304 | // addIFunction2(map, 2,5) | ||
305 | // addIFunction3(map, 5,0,2) | ||
306 | // addIFunction2(map, 5,2) | ||
226 | 307 | } | } |
227 | 308 | ||
228 | 309 | ||
... | ... | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | |
235 | 316 | ||
236 | 317 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
237 | 318 | ||
319 | void Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision:: | ||
320 | preUpdate() | ||
321 | { | ||
322 | if (Enskog_) | ||
323 | { | ||
324 | forAll(gradWs_, nodei) | ||
325 | { | ||
326 | gradWs_[nodei] = | ||
327 | fvc::grad(quadrature_.nodes()[nodei].primaryWeight()); | ||
328 | } | ||
329 | } | ||
330 | } | ||
331 | |||
332 | |||
238 | 333 | void Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | void Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision |
239 | 334 | ::updateCells | ::updateCells |
240 | 335 | ( | ( |
... | ... | void Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | |
243 | 338 | { | { |
244 | 339 | forAll(Cs_, momenti) | forAll(Cs_, momenti) |
245 | 340 | { | { |
246 | Cs_[momenti] = 0.0; | ||
341 | Cs_[momenti][celli] = 0.0; | ||
247 | 342 | } | } |
248 | 343 | ||
249 | forAll(quadrature_.nodes(), nodei) | ||
344 | if (Enskog_) | ||
250 | 345 | { | { |
251 | const volVectorNode& node1 = quadrature_.nodes()[nodei]; | ||
252 | forAll(quadrature_.nodes(), nodej) | ||
346 | forAll(Gs_, momenti) | ||
253 | 347 | { | { |
254 | const volVectorNode& node2 = quadrature_.nodes()[nodej]; | ||
348 | Gs_[momenti][celli] = Zero; | ||
349 | } | ||
350 | } | ||
255 | 351 | ||
256 | if (nDimensions_ == 1) | ||
257 | { | ||
258 | I1D(celli, nodei, nodej); | ||
259 | } | ||
260 | else if (nDimensions_ == 2) | ||
261 | { | ||
262 | I2D(celli, nodei, nodej); | ||
263 | } | ||
264 | else if (nDimensions_ == 3) | ||
265 | { | ||
266 | I3D(celli, nodei, nodej); | ||
267 | } | ||
352 | scalar alpha = quadrature_.moments()(0)[celli]; | ||
353 | scalar alphac = 1.0 - alpha; | ||
354 | |||
355 | // Monodisperse case | ||
356 | if (sizeIndex_ == -1) | ||
357 | { | ||
358 | scalar c = min(alpha/0.63, 0.999); | ||
359 | scalar g0 = (2.0 - c)/(2.0*pow3(1.0 - c)) + 1.1603*c; | ||
360 | |||
361 | forAll(quadrature_.nodes(), nodei) | ||
362 | { | ||
363 | const volVelocityNode& node1 = quadrature_.nodes()[nodei]; | ||
268 | 364 | ||
269 | forAll(Cs_, momenti) | ||
365 | forAll(quadrature_.nodes(), nodej) | ||
270 | 366 | { | { |
271 | const labelList& momentOrder = momentOrders_[momenti]; | ||
272 | Cs_(momentOrder) += | ||
273 | node1.primaryWeight()[celli] | ||
274 | *node2.primaryWeight()[celli] | ||
275 | *mag | ||
276 | ( | ||
277 | node1.primaryAbscissa()[celli] | ||
278 | - node2.primaryAbscissa()[celli] | ||
279 | ) | ||
280 | *Is_(momentOrder); | ||
367 | const volVelocityNode& node2 = quadrature_.nodes()[nodej]; | ||
368 | updateI(celli, nodei, nodej, omega_); | ||
369 | |||
370 | forAll(Cs_, momenti) | ||
371 | { | ||
372 | const labelList& momentOrder = momentOrders_[momenti]; | ||
373 | labelList vMomentOrder(velocityIndexes_.size(), 0); | ||
374 | |||
375 | forAll(velocityIndexes_, cmpt) | ||
376 | { | ||
377 | vMomentOrder[cmpt] = | ||
378 | momentOrder[velocityIndexes_[cmpt]]; | ||
379 | } | ||
380 | |||
381 | //- Zero order source term | ||
382 | scalar cSource = | ||
383 | 6.0*g0/dp_()[celli] | ||
384 | *node1.primaryWeight()[celli] | ||
385 | *node2.primaryWeight()[celli] | ||
386 | *mag | ||
387 | ( | ||
388 | node1.velocityAbscissae()[celli] | ||
389 | - node2.velocityAbscissae()[celli] | ||
390 | ) | ||
391 | *Is_(vMomentOrder); | ||
392 | |||
393 | //- Enskog term | ||
394 | if (Enskog_) | ||
395 | { | ||
396 | scalar eSource = 0.0; | ||
397 | |||
398 | forAll(velocityIndexes_, m) | ||
399 | { | ||
400 | scalar I1m = I1s_[m](vMomentOrder); | ||
401 | eSource += | ||
402 | I1m | ||
403 | *( | ||
404 | node2.primaryWeight()[celli] | ||
405 | *gradWs_[nodei][celli][m] | ||
406 | - node1.primaryWeight()[celli] | ||
407 | *gradWs_[nodej][celli][m] | ||
408 | ); | ||
409 | |||
410 | Gs_[momenti][celli][m] += | ||
411 | 3.0*g0 | ||
412 | *I1m | ||
413 | *node1.primaryWeight()[celli] | ||
414 | *node2.primaryWeight()[celli]; | ||
415 | } | ||
416 | |||
417 | cSource += 3.0*g0*eSource; | ||
418 | } | ||
419 | |||
420 | // Integrate over non-velocity components | ||
421 | forAll(scalarIndexes_, cmpt) | ||
422 | { | ||
423 | scalar absCmpt = | ||
424 | pow | ||
425 | ( | ||
426 | node1.primaryAbscissae()[scalarIndexes_[cmpt]][celli], | ||
427 | momentOrder[scalarIndexes_[cmpt]] | ||
428 | ); | ||
429 | |||
430 | cSource *= absCmpt; | ||
431 | |||
432 | if (Enskog_) | ||
433 | { | ||
434 | Gs_[momenti][celli] *= absCmpt; | ||
435 | } | ||
436 | } | ||
437 | |||
438 | Cs_[momenti][celli] += cSource; | ||
439 | } | ||
281 | 440 | } | } |
282 | 441 | } | } |
283 | } | ||
284 | 442 | ||
285 | scalar alpha = quadrature_.moments()(labelList(nDimensions_, 0))[celli]; | ||
286 | scalar g0 = 1.0/(1 - alpha) | ||
287 | + 3*alpha/(2*sqr(1 - alpha)) | ||
288 | + sqr(alpha)/(2*pow3(1 - alpha)); | ||
443 | return; | ||
444 | } | ||
289 | 445 | ||
290 | forAll(Cs_, momenti) | ||
446 | // Polydisperse case | ||
447 | forAll(quadrature_.nodes(), nodei) | ||
291 | 448 | { | { |
292 | Cs_[momenti] *= 6.0*g0/dp_.value(); | ||
449 | const label sizei = nodeIndexes_[nodei][sizeIndex_]; | ||
450 | const volVelocityNode& node1 = quadrature_.nodes()[nodei]; | ||
451 | scalar d1 = d(sizei, celli); | ||
452 | scalar V1 = Foam::constant::mathematical::pi/6.0*pow3(d1); | ||
453 | scalar mass1 = V1*rhos_[sizei]; | ||
454 | scalar n1 = node1.primaryWeight()[celli]/V1; | ||
455 | |||
456 | forAll(quadrature_.nodes(), nodej) | ||
457 | { | ||
458 | const label sizej = nodeIndexes_[nodej][sizeIndex_]; | ||
459 | const volVelocityNode& node2 = quadrature_.nodes()[nodej]; | ||
460 | scalar d2 = d(sizej, celli); | ||
461 | scalar V2 = Foam::constant::mathematical::pi/6.0*pow3(d2); | ||
462 | scalar mass2 = V2*rhos_[sizej]; | ||
463 | scalar n2 = node2.primaryWeight()[celli]/V2; | ||
464 | |||
465 | scalar d12 = (d1 + d2)*0.5; | ||
466 | scalar XiSqr = sqr(d12/d2); | ||
467 | scalar omega = mass2*(1.0 + e_)/(mass1 + mass2); | ||
468 | |||
469 | scalar xi = Foam::constant::mathematical::pi*(n1*sqr(d1) | ||
470 | + n2*sqr(d2))/6.0; | ||
471 | |||
472 | scalar g012 = | ||
473 | 1.0/alphac | ||
474 | + 1.5*xi*d1*d2/(sqr(alphac)*(d12)) | ||
475 | + 0.5*sqr(xi)/pow3(alphac)*sqr(d1*d2/d12); | ||
476 | |||
477 | if (omega > small) | ||
478 | { | ||
479 | updateI(celli, nodei, nodej, omega); | ||
480 | |||
481 | forAll(Cs_, momenti) | ||
482 | { | ||
483 | const labelList& momentOrder = momentOrders_[momenti]; | ||
484 | labelList vMomentOrder(velocityIndexes_.size(), 0); | ||
485 | |||
486 | forAll(velocityIndexes_, cmpt) | ||
487 | { | ||
488 | vMomentOrder[cmpt] = | ||
489 | momentOrder[velocityIndexes_[cmpt]]; | ||
490 | } | ||
491 | |||
492 | //- Zero order source term | ||
493 | scalar cSource = | ||
494 | 6.0*XiSqr*g012/d2 | ||
495 | *node1.primaryWeight()[celli] | ||
496 | *node2.primaryWeight()[celli] | ||
497 | *mag | ||
498 | ( | ||
499 | node1.velocityAbscissae()[celli] | ||
500 | - node2.velocityAbscissae()[celli] | ||
501 | ) | ||
502 | *Is_(vMomentOrder); | ||
503 | |||
504 | //- Enskog term | ||
505 | if (Enskog_) | ||
506 | { | ||
507 | scalar enskogCoeff = 3.0*XiSqr*g012*d1/d2; | ||
508 | scalar eSource = 0.0; | ||
509 | forAll(velocityIndexes_, m) | ||
510 | { | ||
511 | scalar I1m = I1s_[m](vMomentOrder); | ||
512 | eSource += | ||
513 | I1m | ||
514 | *( | ||
515 | d1*node2.primaryWeight()[celli] | ||
516 | *gradWs_[nodei][celli][m] | ||
517 | - d2*node1.primaryWeight()[celli] | ||
518 | *gradWs_[nodej][celli][m] | ||
519 | ); | ||
520 | Gs_[momenti][celli][m] = | ||
521 | enskogCoeff | ||
522 | *I1m | ||
523 | *node1.primaryWeight()[celli] | ||
524 | *node2.primaryWeight()[celli]; | ||
525 | } | ||
526 | cSource += enskogCoeff*eSource; | ||
527 | } | ||
528 | |||
529 | // Integrate over non-velocity abscissae | ||
530 | forAll(scalarIndexes_, cmpt) | ||
531 | { | ||
532 | scalar absCmpt = | ||
533 | pow | ||
534 | ( | ||
535 | node1.primaryAbscissae()[scalarIndexes_[cmpt]][celli], | ||
536 | momentOrder[scalarIndexes_[cmpt]] | ||
537 | ); | ||
538 | cSource *= absCmpt; | ||
539 | |||
540 | if (Enskog_) | ||
541 | { | ||
542 | Gs_[momenti][celli] *= absCmpt; | ||
543 | } | ||
544 | } | ||
545 | |||
546 | Cs_[momenti][celli] += cSource; | ||
547 | } | ||
548 | } | ||
549 | } | ||
293 | 550 | } | } |
294 | 551 | } | } |
295 | 552 | ||
296 | void Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | ||
297 | ::updateFields() | ||
298 | { | ||
299 | NotImplemented; | ||
300 | } | ||
301 | 553 | ||
302 | 554 | Foam::scalar | Foam::scalar |
303 | 555 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision |
304 | ::explicitCollisionSource(const label mi, const label celli) const | ||
556 | ::explicitCollisionSource | ||
557 | ( | ||
558 | const labelList& momentOrder, | ||
559 | const label celli | ||
560 | ) const | ||
305 | 561 | { | { |
306 | return Cs_[mi]; | ||
562 | return Cs_(momentOrder)[celli]; | ||
307 | 563 | } | } |
308 | 564 | ||
565 | |||
309 | 566 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
310 | 567 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision |
311 | ::implicitCollisionSource(const volVectorMoment& m) const | ||
568 | ::implicitCollisionSource(const volVelocityMoment& m) const | ||
312 | 569 | { | { |
313 | NotImplemented; | ||
314 | |||
315 | return tmp<fvScalarMatrix> | ||
570 | tmp<fvScalarMatrix> iSource | ||
316 | 571 | ( | ( |
317 | 572 | new fvScalarMatrix | new fvScalarMatrix |
318 | 573 | ( | ( |
... | ... | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | |
320 | 575 | m.dimensions()*dimVolume/dimTime | m.dimensions()*dimVolume/dimTime |
321 | 576 | ) | ) |
322 | 577 | ); | ); |
578 | |||
579 | if (sizeIndex_ != -1 && Enskog_) | ||
580 | { | ||
581 | iSource.ref() -= fvc::div(Gs_(m.cmptOrders()))(); | ||
582 | } | ||
583 | |||
584 | return iSource; | ||
585 | |||
323 | 586 | } | } |
587 | |||
588 | |||
324 | 589 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BoltzmannCollision/BoltzmannCollision.H changed (mode: 100644) (index 2e00381..c23e70a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::collisionKernels::esBoltzmannCollision | ||
25 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Collision model which returns the velocity distribution to a Maxwellian | ||
29 | distribution (multivariate Gaussian) with at a given collisional time | ||
30 | scale. | ||
28 | Analytical expansion of Boltzmann collision intergral for monodisperse and | ||
29 | polydisperse particulate systems | ||
30 | |||
31 | Reference: | ||
32 | \verbatim | ||
33 | "Computational Models for Polydisperse Particulate and Multiphase Systems" | ||
34 | Marchisio, D.L., Fox, R.O., | ||
35 | Cambridge Core, 2013 | ||
36 | \endverbatim | ||
31 | 37 | ||
32 | 38 | SourceFiles | SourceFiles |
33 | 39 | BoltzmannCollision.C | BoltzmannCollision.C |
40 | ICoefficientFunctions.C | ||
41 | IxCoefficientFunctions.C | ||
42 | IyCoefficientFunctions.C | ||
43 | IzCoefficientFunctions.C | ||
34 | 44 | ||
35 | 45 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
36 | 46 | ||
... | ... | SourceFiles | |
38 | 48 | #define BoltzmannCollision_H | #define BoltzmannCollision_H |
39 | 49 | ||
40 | 50 | #include "collisionKernel.H" | #include "collisionKernel.H" |
41 | #include "mappedList.H" | ||
51 | #include "mappedLists.H" | ||
52 | #include "vectorList.H" | ||
42 | 53 | ||
43 | 54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 55 | ||
... | ... | namespace populationBalanceSubModels | |
49 | 60 | namespace collisionKernels | namespace collisionKernels |
50 | 61 | { | { |
51 | 62 | ||
63 | #define defineIFuncs(i,j,k) \ | ||
64 | static void I##i##j##k \ | ||
65 | ( \ | ||
66 | mappedScalarList& Is, \ | ||
67 | const scalarList& omegaPow, \ | ||
68 | const vectorList& gPow, \ | ||
69 | const scalar& gMagSqr, \ | ||
70 | const vectorList& vPow \ | ||
71 | ); \ | ||
72 | \ | ||
73 | static void Ix##i##j##k \ | ||
74 | ( \ | ||
75 | mappedScalarList& Is, \ | ||
76 | const scalarList& omegaPow, \ | ||
77 | const vectorList& gPow, \ | ||
78 | const scalar& gMagSqr, \ | ||
79 | const vectorList& vPow \ | ||
80 | ); \ | ||
81 | \ | ||
82 | static void Iy##i##j##k \ | ||
83 | ( \ | ||
84 | mappedScalarList& Is, \ | ||
85 | const scalarList& omegaPow, \ | ||
86 | const vectorList& gPow, \ | ||
87 | const scalar& gMagSqr, \ | ||
88 | const vectorList& vPow \ | ||
89 | ); \ | ||
90 | \ | ||
91 | static void Iz##i##j##k \ | ||
92 | ( \ | ||
93 | mappedScalarList& Is, \ | ||
94 | const scalarList& omegaPow, \ | ||
95 | const vectorList& gPow, \ | ||
96 | const scalar& gMagSqr, \ | ||
97 | const vectorList& vPow \ | ||
98 | ); | ||
99 | |||
52 | 100 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
53 | 101 | Class BoltzmannCollision Declaration | Class BoltzmannCollision Declaration |
54 | 102 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
... | ... | class BoltzmannCollision | |
57 | 105 | : | : |
58 | 106 | public collisionKernel | public collisionKernel |
59 | 107 | { | { |
60 | // Private data | ||
108 | //- Typedef of function pointer list | ||
109 | typedef void (*momentFunction) | ||
110 | ( | ||
111 | mappedScalarList& Is, | ||
112 | const scalarList& omegaPow, | ||
113 | const vectorList& gPow, | ||
114 | const scalar& gMagSqr, | ||
115 | const vectorList& vPow | ||
116 | ); | ||
61 | 117 | ||
62 | //- Refrence to particle diameter | ||
63 | dimensionedScalar dp_; | ||
118 | // Private data | ||
64 | 119 | ||
65 | 120 | //- Coefficient of restitution | //- Coefficient of restitution |
66 | 121 | scalar e_; | scalar e_; |
... | ... | class BoltzmannCollision | |
68 | 123 | //- Modified coefficient of restitution | //- Modified coefficient of restitution |
69 | 124 | scalar omega_; | scalar omega_; |
70 | 125 | ||
71 | //- Collisional coefficients sources | ||
72 | mappedList<scalar> Is_; | ||
126 | //- Is the Enskog term used | ||
127 | Switch Enskog_; | ||
73 | 128 | ||
74 | //- Collision sources | ||
75 | mappedList<scalar> Cs_; | ||
129 | //- List of scalar indexes | ||
130 | const labelList& scalarIndexes_; | ||
76 | 131 | ||
132 | //- Zero order collisional coefficients sources | ||
133 | mappedScalarList Is_; | ||
77 | 134 | ||
78 | // Protected functions | ||
135 | //- List of functions used to calculate equilibrium moments | ||
136 | List<momentFunction> coefficientFunctions_; | ||
79 | 137 | ||
80 | //- Update equilibrium moments for a cell (1D) | ||
81 | void I1D | ||
82 | ( | ||
83 | const label celli, | ||
84 | const label node1, | ||
85 | const label node2 | ||
86 | ); | ||
138 | //- Enskog (first order) collisional coefficients sources | ||
139 | PtrList<mappedScalarList> I1s_; | ||
87 | 140 | ||
88 | //- Update equilibrium moments for a cell (2D) | ||
89 | void I2D | ||
90 | ( | ||
91 | const label celli, | ||
92 | const label node1, | ||
93 | const label node2 | ||
94 | ); | ||
141 | //- List of functions used to calculate equilibrium moments | ||
142 | List<List<momentFunction>> enskogFunctions_; | ||
143 | |||
144 | //- Collision sources | ||
145 | mappedPtrList<volScalarField> Cs_; | ||
146 | |||
147 | //- Gradients of weights | ||
148 | PtrList<volVectorField> gradWs_; | ||
149 | |||
150 | //- Collisional fluxes | ||
151 | mappedPtrList<volVectorField> Gs_; | ||
95 | 152 | ||
96 | //- Update equilibrium moments for a cell (3D) | ||
97 | void I3D | ||
153 | // Protected functions | ||
154 | |||
155 | //- Functions used to define integral coefficients | ||
156 | defineIFuncs(0,0,0) | ||
157 | |||
158 | defineIFuncs(0,0,1) | ||
159 | defineIFuncs(0,1,0) | ||
160 | defineIFuncs(1,0,0) | ||
161 | |||
162 | defineIFuncs(0,0,2) | ||
163 | defineIFuncs(0,1,1) | ||
164 | defineIFuncs(0,2,0) | ||
165 | defineIFuncs(1,0,1) | ||
166 | defineIFuncs(1,1,0) | ||
167 | defineIFuncs(2,0,0) | ||
168 | |||
169 | defineIFuncs(0,0,3) | ||
170 | defineIFuncs(0,1,2) | ||
171 | defineIFuncs(0,2,1) | ||
172 | defineIFuncs(0,3,0) | ||
173 | defineIFuncs(1,0,2) | ||
174 | defineIFuncs(1,1,1) | ||
175 | defineIFuncs(1,2,0) | ||
176 | defineIFuncs(2,0,1) | ||
177 | defineIFuncs(2,1,0) | ||
178 | defineIFuncs(3,0,0) | ||
179 | |||
180 | defineIFuncs(0,0,4) | ||
181 | // defineIFuncs(0,1,3) | ||
182 | // defineIFuncs(0,2,2) | ||
183 | // defineIFuncs(0,3,1) | ||
184 | defineIFuncs(0,4,0) | ||
185 | // defineIFuncs(1,0,3) | ||
186 | // defineIFuncs(1,3,0) | ||
187 | // defineIFuncs(2,0,2) | ||
188 | // defineIFuncs(2,2,0) | ||
189 | // defineIFuncs(3,0,1) | ||
190 | // defineIFuncs(3,1,0) | ||
191 | defineIFuncs(4,0,0) | ||
192 | |||
193 | |||
194 | //- Update equilibrium moments for a cell | ||
195 | void updateI | ||
98 | 196 | ( | ( |
99 | 197 | const label celli, | const label celli, |
100 | 198 | const label node1, | const label node1, |
101 | const label node2 | ||
199 | const label node2, | ||
200 | const scalar omega | ||
102 | 201 | ); | ); |
103 | 202 | ||
104 | 203 | ||
... | ... | public: | |
115 | 214 | ( | ( |
116 | 215 | const dictionary& dict, | const dictionary& dict, |
117 | 216 | const fvMesh& mesh, | const fvMesh& mesh, |
118 | const velocityQuadratureApproximation& quadrature, | ||
119 | const bool ode | ||
217 | const velocityQuadratureApproximation& quadrature | ||
120 | 218 | ); | ); |
121 | 219 | ||
122 | 220 | ||
... | ... | public: | |
126 | 224 | ||
127 | 225 | // Member Functions | // Member Functions |
128 | 226 | ||
129 | //- Update equilibrium moments | ||
130 | virtual void updateCells(const label celli); | ||
227 | //- Update unchanged fields before solving ode system | ||
228 | virtual void preUpdate(); | ||
131 | 229 | ||
132 | 230 | //- Update equilibrium moments | //- Update equilibrium moments |
133 | virtual void updateFields(); | ||
231 | virtual void updateCells(const label celli); | ||
134 | 232 | ||
135 | 233 | //- Return explicit collision source term | //- Return explicit collision source term |
136 | 234 | virtual scalar explicitCollisionSource | virtual scalar explicitCollisionSource |
137 | 235 | ( | ( |
138 | const label mi, | ||
236 | const labelList& momentOrder, | ||
139 | 237 | const label celli | const label celli |
140 | 238 | ) const; | ) const; |
141 | 239 | ||
142 | 240 | //- Return implicit collision source matrix | //- Return implicit collision source matrix |
143 | 241 | virtual tmp<fvScalarMatrix> implicitCollisionSource | virtual tmp<fvScalarMatrix> implicitCollisionSource |
144 | 242 | ( | ( |
145 | const volVectorMoment& m | ||
243 | const volVelocityMoment& m | ||
146 | 244 | ) const; | ) const; |
147 | |||
148 | 245 | }; | }; |
149 | 246 | ||
247 | #define addIFunction1(map,i) \ | ||
248 | if (map.found(i)) \ | ||
249 | { \ | ||
250 | coefficientFunctions_.append(&I##i##00); \ | ||
251 | if (Enskog_) \ | ||
252 | { \ | ||
253 | enskogFunctions_[0].append(&Ix##i##00); \ | ||
254 | if (velocityIndexes_.size() > 1) \ | ||
255 | { \ | ||
256 | enskogFunctions_[1].append(&Iy##i##00); \ | ||
257 | } \ | ||
258 | if (velocityIndexes_.size() > 2) \ | ||
259 | { \ | ||
260 | enskogFunctions_[2].append(&Iz##i##00); \ | ||
261 | } \ | ||
262 | } \ | ||
263 | } | ||
264 | |||
265 | #define addIFunction2(map,i,j) \ | ||
266 | if (map.found(i,j)) \ | ||
267 | { \ | ||
268 | coefficientFunctions_.append(&I##i##j##0); \ | ||
269 | if (Enskog_) \ | ||
270 | { \ | ||
271 | enskogFunctions_[0].append(&Ix##i##j##0); \ | ||
272 | if (velocityIndexes_.size() > 1) \ | ||
273 | { \ | ||
274 | enskogFunctions_[1].append(&Iy##i##j##0); \ | ||
275 | } \ | ||
276 | if (velocityIndexes_.size() > 2) \ | ||
277 | { \ | ||
278 | enskogFunctions_[2].append(&Iz##i##j##0); \ | ||
279 | } \ | ||
280 | } \ | ||
281 | } | ||
282 | |||
283 | #define addIFunction3(map,i,j,k) \ | ||
284 | if (map.found(i,j,k)) \ | ||
285 | { \ | ||
286 | coefficientFunctions_.append(&I##i##j##k); \ | ||
287 | if (Enskog_) \ | ||
288 | { \ | ||
289 | enskogFunctions_[0].append(&Ix##i##j##k); \ | ||
290 | if (velocityIndexes_.size() > 1) \ | ||
291 | { \ | ||
292 | enskogFunctions_[1].append(&Iy##i##j##k); \ | ||
293 | } \ | ||
294 | if (velocityIndexes_.size() > 2) \ | ||
295 | { \ | ||
296 | enskogFunctions_[2].append(&Iz##i##j##k); \ | ||
297 | } \ | ||
298 | } \ | ||
299 | } | ||
300 | |||
301 | #define IFuncHeader(i,j,k) \ | ||
302 | void \ | ||
303 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision:: \ | ||
304 | I##i##j##k \ | ||
305 | ( \ | ||
306 | mappedScalarList& Is, \ | ||
307 | const scalarList& omegaPow, \ | ||
308 | const vectorList& gPow, \ | ||
309 | const scalar& gMagSqr, \ | ||
310 | const vectorList& vPow \ | ||
311 | ) | ||
312 | |||
313 | #define IxFuncHeader(i,j,k) \ | ||
314 | void \ | ||
315 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision:: \ | ||
316 | Ix##i##j##k \ | ||
317 | ( \ | ||
318 | mappedScalarList& Ix, \ | ||
319 | const scalarList& omegaPow, \ | ||
320 | const vectorList& gPow, \ | ||
321 | const scalar& gMagSqr, \ | ||
322 | const vectorList& vPow \ | ||
323 | ) | ||
324 | |||
325 | #define IyFuncHeader(i,j,k) \ | ||
326 | void \ | ||
327 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision:: \ | ||
328 | Iy##i##j##k \ | ||
329 | ( \ | ||
330 | mappedScalarList& Iy, \ | ||
331 | const scalarList& omegaPow, \ | ||
332 | const vectorList& gPow, \ | ||
333 | const scalar& gMagSqr, \ | ||
334 | const vectorList& vPow \ | ||
335 | ) | ||
336 | |||
337 | #define IzFuncHeader(i,j,k) \ | ||
338 | void \ | ||
339 | Foam::populationBalanceSubModels::collisionKernels::BoltzmannCollision:: \ | ||
340 | Iz##i##j##k \ | ||
341 | ( \ | ||
342 | mappedScalarList& Iz, \ | ||
343 | const scalarList& omegaPow, \ | ||
344 | const vectorList& gPow, \ | ||
345 | const scalar& gMagSqr, \ | ||
346 | const vectorList& vPow \ | ||
347 | ) | ||
150 | 348 | ||
151 | 349 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
152 | 350 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BoltzmannCollision/ICoefficientFunctions.C added (mode: 100644) (index 0000000..f4bda12) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2019 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 | #include "BoltzmannCollision.H" | ||
26 | |||
27 | // Zero order | ||
28 | IFuncHeader(0,0,0) | ||
29 | { | ||
30 | Is(0,0,0) = 0.0; | ||
31 | } | ||
32 | |||
33 | // First order | ||
34 | IFuncHeader(0,0,1) | ||
35 | { | ||
36 | Is(0,0,1) = -(omegaPow[1]/2.0)*gPow[1].z(); | ||
37 | } | ||
38 | |||
39 | IFuncHeader(0,1,0) | ||
40 | { | ||
41 | Is(0,1,0) = -(omegaPow[1]/2.0)*gPow[1].y(); | ||
42 | } | ||
43 | |||
44 | IFuncHeader(1,0,0) | ||
45 | { | ||
46 | Is(1,0,0) = -(omegaPow[1]/2.0)*gPow[1].x(); | ||
47 | } | ||
48 | |||
49 | // Second order | ||
50 | IFuncHeader(0,0,2) | ||
51 | { | ||
52 | Is(0,0,2) = | ||
53 | (omegaPow[2]/12.0)*(gMagSqr + 3.0*gPow[2].z()) | ||
54 | - omegaPow[1]*gPow[1].z()*vPow[1].z(); | ||
55 | } | ||
56 | |||
57 | IFuncHeader(0,1,1) | ||
58 | { | ||
59 | Is(0,1,1) = | ||
60 | (omegaPow[2]/4.0)*gPow[1].y()*gPow[1].z() | ||
61 | - (omegaPow[1]/2.0)*(vPow[1].y()*gPow[1].z() + gPow[1].y()*vPow[1].z()); | ||
62 | } | ||
63 | |||
64 | IFuncHeader(1,0,1) | ||
65 | { | ||
66 | Is(1,0,1) = | ||
67 | (omegaPow[2]/4.0)*gPow[1].x()*gPow[1].z() | ||
68 | - (omegaPow[1]/2.0)*(vPow[1].x()*gPow[1].z() + gPow[1].x()*vPow[1].z()); | ||
69 | } | ||
70 | |||
71 | IFuncHeader(1,1,0) | ||
72 | { | ||
73 | Is(1,1,0) = | ||
74 | (omegaPow[2]/4.0)*gPow[1].x()*gPow[1].y() | ||
75 | - (omegaPow[1]/2.0)*(vPow[1].x()*gPow[1].y() + gPow[1].x()*vPow[1].y()); | ||
76 | } | ||
77 | |||
78 | IFuncHeader(0,2,0) | ||
79 | { | ||
80 | Is(0,2,0) = | ||
81 | (omegaPow[2]/12.0)*(gMagSqr + 3.0*gPow[2].y()) | ||
82 | - omegaPow[1]*gPow[1].y()*vPow[1].y(); | ||
83 | } | ||
84 | |||
85 | IFuncHeader(2,0,0) | ||
86 | { | ||
87 | Is(2,0,0) = | ||
88 | (omegaPow[2]/12.0)*(gMagSqr + 3.0*gPow[2].x()) | ||
89 | - omegaPow[1]*gPow[1].x()*vPow[1].x(); | ||
90 | } | ||
91 | |||
92 | // Third order | ||
93 | IFuncHeader(0,0,3) | ||
94 | { | ||
95 | Is(0,0,3) = | ||
96 | - (omegaPow[3]/8.0)*(gMagSqr + gPow[2].z())*gPow[1].z() | ||
97 | + (omegaPow[2]/4.0)*(gMagSqr + 3.0*gPow[2].z())*vPow[1].z() | ||
98 | - (1.5*omegaPow[1])*gPow[1].z()*vPow[2].z(); | ||
99 | } | ||
100 | |||
101 | IFuncHeader(0,1,2) | ||
102 | { | ||
103 | Is(0,1,2) = | ||
104 | - omegaPow[3]/24.0*(gMagSqr + 3.0*gPow[2].z())*gPow[1].y() | ||
105 | + omegaPow[2]/2.0*gPow[1].z()*gPow[1].y()*vPow[1].z() | ||
106 | + omegaPow[2]/12.0*(gMagSqr + 3.0*gPow[2].z())*vPow[1].y() | ||
107 | - omegaPow[1]/2.0*gPow[1].y()*vPow[2].z() | ||
108 | - omegaPow[1]*gPow[1].z()*vPow[1].z()*vPow[1].y(); | ||
109 | } | ||
110 | |||
111 | IFuncHeader(0,2,1) | ||
112 | { | ||
113 | Is(0,2,1) = | ||
114 | - omegaPow[3]/24.0*(gMagSqr + 3.0*gPow[2].y())*gPow[1].z() | ||
115 | + omegaPow[2]/2.0*gPow[1].y()*gPow[1].z()*vPow[1].y() | ||
116 | + omegaPow[2]/12.0*(gMagSqr + 3.0*gPow[2].y())*vPow[1].z() | ||
117 | - omegaPow[1]/2.0*gPow[1].z()*vPow[2].y() | ||
118 | - omegaPow[1]*gPow[1].y()*vPow[1].y()*vPow[1].z(); | ||
119 | } | ||
120 | |||
121 | IFuncHeader(0,3,0) | ||
122 | { | ||
123 | Is(0,3,0) = | ||
124 | - (omegaPow[3]/8.0)*(gMagSqr + gPow[2].y())*gPow[1].y() | ||
125 | + (omegaPow[2]/4.0)*(gMagSqr + 3.0*gPow[2].y())*vPow[1].y() | ||
126 | - (1.5*omegaPow[1])*gPow[1].y()*vPow[2].y(); | ||
127 | } | ||
128 | |||
129 | IFuncHeader(1,0,2) | ||
130 | { | ||
131 | Is(1,0,2) = | ||
132 | - omegaPow[3]/24.0*(gMagSqr + 3.0*gPow[2].z())*gPow[1].x() | ||
133 | + omegaPow[2]/2.0*gPow[1].z()*gPow[1].x()*vPow[1].z() | ||
134 | + omegaPow[2]/12.0*(gMagSqr + 3.0*gPow[2].z())*vPow[1].x() | ||
135 | - omegaPow[1]/2.0*gPow[1].x()*vPow[2].z() | ||
136 | - omegaPow[1]*gPow[1].z()*vPow[1].z()*vPow[1].x(); | ||
137 | } | ||
138 | |||
139 | IFuncHeader(1,1,1) | ||
140 | { | ||
141 | Is(1,1,1) = | ||
142 | - omegaPow[3]/8.0*gPow[1].x()*gPow[1].y()*gPow[1].z() | ||
143 | + omegaPow[2]/4.0 | ||
144 | *( | ||
145 | gPow[1].x()*gPow[1].y()*vPow[1].z() | ||
146 | + gPow[1].y()*gPow[1].z()*vPow[1].x() | ||
147 | + gPow[1].z()*gPow[1].x()*vPow[1].y() | ||
148 | ) | ||
149 | - omegaPow[1]/2.0 | ||
150 | *( | ||
151 | gPow[1].x()*vPow[1].y()*vPow[1].z() | ||
152 | + gPow[1].y()*vPow[1].z()*vPow[1].x() | ||
153 | + gPow[1].z()*vPow[1].x()*vPow[1].y() | ||
154 | ); | ||
155 | } | ||
156 | |||
157 | IFuncHeader(1,2,0) | ||
158 | { | ||
159 | Is(1,2,0) = | ||
160 | - omegaPow[3]/24.0*(gMagSqr + 3.0*gPow[2].y())*gPow[1].x() | ||
161 | + omegaPow[2]/2.0*gPow[1].y()*gPow[1].x()*vPow[1].y() | ||
162 | + omegaPow[2]/12.0*(gMagSqr + 3.0*gPow[2].y())*vPow[1].x() | ||
163 | - omegaPow[1]/2.0*gPow[1].x()*vPow[2].y() | ||
164 | - omegaPow[1]*gPow[1].y()*vPow[1].y()*vPow[1].x(); | ||
165 | } | ||
166 | |||
167 | IFuncHeader(2,0,1) | ||
168 | { | ||
169 | Is(2,0,1) = | ||
170 | - omegaPow[3]/24.0*(gMagSqr + 3.0*gPow[2].x())*gPow[1].z() | ||
171 | + omegaPow[2]/2.0*gPow[1].x()*gPow[1].z()*vPow[1].x() | ||
172 | + omegaPow[2]/12.0*(gMagSqr + 3.0*gPow[2].x())*vPow[1].z() | ||
173 | - omegaPow[1]/2.0*gPow[1].z()*vPow[2].x() | ||
174 | - omegaPow[1]*gPow[1].x()*vPow[1].x()*vPow[1].z(); | ||
175 | } | ||
176 | |||
177 | IFuncHeader(2,1,0) | ||
178 | { | ||
179 | Is(2,1,0) = | ||
180 | - omegaPow[3]/24.0*(gMagSqr + 3.0*gPow[2].x())*gPow[1].y() | ||
181 | + omegaPow[2]/2.0*gPow[1].x()*gPow[1].y()*vPow[1].x() | ||
182 | + omegaPow[2]/12.0*(gMagSqr + 3.0*gPow[2].x())*vPow[1].y() | ||
183 | - omegaPow[1]/2.0*gPow[1].y()*vPow[2].x() | ||
184 | - omegaPow[1]*gPow[1].x()*vPow[1].x()*vPow[1].y(); | ||
185 | } | ||
186 | |||
187 | IFuncHeader(3,0,0) | ||
188 | { | ||
189 | Is(3,0,0) = | ||
190 | - (omegaPow[3]/8.0)*(gMagSqr + gPow[2].x())*gPow[1].x() | ||
191 | + (omegaPow[2]/4.0)*(gMagSqr + 3.0*gPow[2].x())*vPow[1].x() | ||
192 | - (1.5*omegaPow[1])*gPow[1].x()*vPow[2].x(); | ||
193 | } | ||
194 | |||
195 | // Fourth order | ||
196 | IFuncHeader(0,0,4) | ||
197 | { | ||
198 | Is(0,0,4) = | ||
199 | (omegaPow[4]/80.0) | ||
200 | *((gPow[2] & gPow[2]) + 10.0*gMagSqr*gPow[2].z() + 5.0*gPow[4].z()) | ||
201 | - (omegaPow[3]/2.0)*(gMagSqr + gPow[2].z())*gPow[1].z()*vPow[1].z() | ||
202 | + (omegaPow[2]/2.0)*(gMagSqr + 3.0*gPow[2].z())*vPow[2].z() | ||
203 | - 2.0*omegaPow[1]*gPow[1].z()*vPow[3].z(); | ||
204 | } | ||
205 | |||
206 | IFuncHeader(0,4,0) | ||
207 | { | ||
208 | Is(0,4,0) = | ||
209 | (omegaPow[4]/80.0) | ||
210 | *((gPow[2] & gPow[2]) + 10.0*gMagSqr*gPow[2].y() + 5.0*gPow[4].y()) | ||
211 | - (omegaPow[3]/2.0)*(gMagSqr + gPow[2].y())*gPow[1].y()*vPow[1].y() | ||
212 | + (omegaPow[2]/2.0)*(gMagSqr + 3.0*gPow[2].y())*vPow[2].y() | ||
213 | - 2.0*omegaPow[1]*gPow[1].y()*vPow[3].y(); | ||
214 | } | ||
215 | |||
216 | IFuncHeader(4,0,0) | ||
217 | { | ||
218 | Is(4,0,0) = | ||
219 | (omegaPow[4]/80.0) | ||
220 | *((gPow[2] & gPow[2]) + 10.0*gMagSqr*gPow[2].x() + 5.0*gPow[4].x()) | ||
221 | - (omegaPow[3]/2.0)*(gMagSqr + gPow[2].x())*gPow[1].x()*vPow[1].x() | ||
222 | + (omegaPow[2]/2.0)*(gMagSqr + 3.0*gPow[2].x())*vPow[2].x() | ||
223 | - 2.0*omegaPow[1]*gPow[1].x()*vPow[3].x(); | ||
224 | } | ||
225 | |||
226 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BoltzmannCollision/IxCoefficientFunctions.C added (mode: 100644) (index 0000000..5c61f53) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2019 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 | #include "BoltzmannCollision.H" | ||
26 | |||
27 | // Zero order | ||
28 | IxFuncHeader(0,0,0) | ||
29 | { | ||
30 | Ix(0) = 0.0; | ||
31 | } | ||
32 | |||
33 | // First order | ||
34 | IxFuncHeader(0,0,1) | ||
35 | { | ||
36 | Ix(0,0,1) = (4.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].z(); | ||
37 | } | ||
38 | |||
39 | IxFuncHeader(0,1,0) | ||
40 | { | ||
41 | Ix(0,1) = (4.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].y(); | ||
42 | } | ||
43 | |||
44 | IxFuncHeader(1,0,0) | ||
45 | { | ||
46 | Ix(1) = (2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].x()); | ||
47 | } | ||
48 | |||
49 | // Second order | ||
50 | IxFuncHeader(0,0,2) | ||
51 | { | ||
52 | Ix(0,0,2) = | ||
53 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].z())*gPow[1].x() | ||
54 | + (8.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].z()*vPow[1].z(); | ||
55 | } | ||
56 | |||
57 | IxFuncHeader(0,1,1) | ||
58 | { | ||
59 | Ix(0,1,1) = | ||
60 | - (4.0*omegaPow[2]/35.0)*gPow[1].x()*gPow[1].y()*gPow[1].z() | ||
61 | + (4.0*omegaPow[1]/15.0)*(gPow[1].x()*gPow[1].z()*vPow[1].y() | ||
62 | + gPow[1].x()*gPow[1].y()*vPow[1].z()); | ||
63 | } | ||
64 | |||
65 | IxFuncHeader(1,0,1) | ||
66 | { | ||
67 | Ix(1,0,1) = | ||
68 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].z()) | ||
69 | *(gPow[1].x() + vPow[1].z()) | ||
70 | + (4.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].z()*vPow[1].x(); | ||
71 | } | ||
72 | |||
73 | IxFuncHeader(1,1,0) | ||
74 | { | ||
75 | Ix(1,1) = | ||
76 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].y()) | ||
77 | *(gPow[1].x() + vPow[1].y()) | ||
78 | + (4.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].y()*vPow[1].x(); | ||
79 | } | ||
80 | |||
81 | IxFuncHeader(0,2,0) | ||
82 | { | ||
83 | Ix(0,2) = | ||
84 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].y())*gPow[1].x() | ||
85 | + (8.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].y()*vPow[1].y(); | ||
86 | } | ||
87 | |||
88 | IxFuncHeader(2,0,0) | ||
89 | { | ||
90 | Ix(2) = | ||
91 | - (2.0*omegaPow[2]/35.0)*(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].x() | ||
92 | + (4.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].x())*vPow[1].x(); | ||
93 | } | ||
94 | |||
95 | // Third order | ||
96 | IxFuncHeader(0,0,3) | ||
97 | { | ||
98 | Ix(0,0,3) = | ||
99 | (8.0*omegaPow[3]/315.0) | ||
100 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*gPow[1].z() | ||
101 | - (6.0*omegaPow[2]/35.0) | ||
102 | *(gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*vPow[1].z() | ||
103 | + (4.0*omegaPow[1]/5.0)*gPow[1].x()*gPow[1].z()*vPow[2].z(); | ||
104 | } | ||
105 | |||
106 | IxFuncHeader(0,1,2) | ||
107 | { | ||
108 | Ix(0,1,2) = | ||
109 | (8.0*omegaPow[3]/315.0) | ||
110 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*gPow[1].y() | ||
111 | - (2.0*omegaPow[2]/35.0) | ||
112 | *( | ||
113 | (gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*vPow[1].y() | ||
114 | + 4.0*gPow[1].x()*gPow[1].y()*gPow[1].z()*vPow[1].z() | ||
115 | ) | ||
116 | + (4.0*omegaPow[1]/15.0)*gPow[1].x()*vPow[1].z() | ||
117 | *(gPow[1].y()*vPow[1].z() + 2.0*gPow[1].z()*vPow[1].y()); | ||
118 | } | ||
119 | |||
120 | IxFuncHeader(0,2,1) | ||
121 | { | ||
122 | Ix(0,1,2) = | ||
123 | (8.0*omegaPow[3]/315.0) | ||
124 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*gPow[1].z() | ||
125 | - (2.0*omegaPow[2]/35.0) | ||
126 | *( | ||
127 | (gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*vPow[1].z() | ||
128 | + 4.0*gPow[1].x()*gPow[1].z()*gPow[1].y()*vPow[1].y() | ||
129 | ) | ||
130 | + (4.0*omegaPow[1]/15.0)*gPow[1].x()*vPow[1].y() | ||
131 | *(gPow[1].z()*vPow[1].y() + 2.0*gPow[1].y()*vPow[1].z()); | ||
132 | } | ||
133 | |||
134 | IxFuncHeader(0,3,0) | ||
135 | { | ||
136 | Ix(0,3) = | ||
137 | (8.0*omegaPow[3]/315.0) | ||
138 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*gPow[1].y() | ||
139 | - (6.0*omegaPow[2]/35.0) | ||
140 | *(gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*vPow[1].y() | ||
141 | + (4.0*omegaPow[1]/5.0)*gPow[1].x()*gPow[1].y()*sqr(vPow[1].y()); | ||
142 | } | ||
143 | |||
144 | IxFuncHeader(1,0,2) | ||
145 | { | ||
146 | Ix(1,0,2) = | ||
147 | (2.0*omegaPow[3]/315.0) | ||
148 | *( | ||
149 | sqr(gMagSqr) | ||
150 | + 4.0*gMagSqr*(gPow[2].x() + gPow[2].z()) | ||
151 | + 8.0*gPow[2].x()*gPow[2].z() | ||
152 | ) | ||
153 | - (2.0*omegaPow[2]/35.0) | ||
154 | *( | ||
155 | (gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*vPow[1].x() | ||
156 | + (gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*vPow[1].z() | ||
157 | ) | ||
158 | + (2.0*omegaPow[1]/15.0) | ||
159 | *( | ||
160 | (gMagSqr + 2.0*gPow[2].x())*vPow[2].z() | ||
161 | + 4.0*gPow[1].x()*gPow[1].z()*vPow[1].x()*vPow[1].z() | ||
162 | ); | ||
163 | } | ||
164 | |||
165 | IxFuncHeader(1,1,1) | ||
166 | { | ||
167 | Ix(1,1,1) = | ||
168 | (8.0*omegaPow[3]/315.0) | ||
169 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*gPow[1].z() | ||
170 | - (2.0*omegaPow[2]/35.0) | ||
171 | *( | ||
172 | 2.0*gPow[1].x()*gPow[1].y()*gPow[1].z()*vPow[1].x() | ||
173 | + (gMagSqr + 2.0*gPow[2].x()) | ||
174 | *(gPow[1].y()*vPow[1].z() + gPow[1].z()*vPow[1].y()) | ||
175 | ) | ||
176 | + (4.0*omegaPow[1]/15.0) | ||
177 | *( | ||
178 | 2.0*gPow[1].x()*vPow[1].x() | ||
179 | *(gPow[1].y()*vPow[1].z() + gPow[1].z()*vPow[1].y()) | ||
180 | + (gMagSqr + 2.0*gPow[2].x())*vPow[1].y()*vPow[1].z() | ||
181 | ); | ||
182 | } | ||
183 | |||
184 | IxFuncHeader(1,2,0) | ||
185 | { | ||
186 | Ix(1,2,0) = | ||
187 | (2.0*omegaPow[3]/315.0) | ||
188 | *( | ||
189 | sqr(gMagSqr) | ||
190 | + 4.0*gMagSqr*(gPow[2].x() + gPow[2].y()) | ||
191 | + 8.0*gPow[2].x()*gPow[2].y() | ||
192 | ) | ||
193 | - (2.0*omegaPow[2]/35.0) | ||
194 | *( | ||
195 | (gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*vPow[1].x() | ||
196 | + (gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*vPow[1].y() | ||
197 | ) | ||
198 | + (2.0*omegaPow[1]/15.0) | ||
199 | *( | ||
200 | (gMagSqr + 2.0*gPow[2].x())*vPow[2].y() | ||
201 | + 4.0*gPow[1].x()*gPow[1].y()*vPow[1].x()*vPow[1].y() | ||
202 | ); | ||
203 | } | ||
204 | |||
205 | IxFuncHeader(2,0,1) | ||
206 | { | ||
207 | Ix(2,0,1) = | ||
208 | (8.0*omegaPow[3]/315.0)*(3.0*gMagSqr | ||
209 | + 2.0*gPow[2].x())*gPow[1].x()*gPow[1].z() | ||
210 | - (2.0*omegaPow[2]/35.0) | ||
211 | *( | ||
212 | 2.0*(gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*vPow[1].x() | ||
213 | + (3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].x()*vPow[1].z() | ||
214 | ) | ||
215 | + (4.0*omegaPow[1]/15.0) | ||
216 | *( | ||
217 | (gMagSqr + 2.0*gPow[2].x())*vPow[1].x()*vPow[1].z() | ||
218 | + gPow[1].x()*gPow[1].z()*vPow[2].x() | ||
219 | ); | ||
220 | } | ||
221 | |||
222 | IxFuncHeader(2,1,0) | ||
223 | { | ||
224 | Ix(2,1) = | ||
225 | (8.0*omegaPow[3]/315.0)*(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].x()*gPow[1].y() | ||
226 | - (2.0*omegaPow[2]/35.0) | ||
227 | *( | ||
228 | 2.0*(gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*vPow[1].x() | ||
229 | + (3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].x()*vPow[1].y() | ||
230 | ) | ||
231 | + (4.0*omegaPow[1]/15.0) | ||
232 | *( | ||
233 | (gMagSqr + 2.0*gPow[2].x())*vPow[1].x()*vPow[1].y() | ||
234 | + gPow[1].x()*gPow[1].y()*vPow[2].x() | ||
235 | ); | ||
236 | } | ||
237 | |||
238 | IxFuncHeader(3,0,0) | ||
239 | { | ||
240 | Ix(3) = | ||
241 | (2.0*omegaPow[2]/315.0) | ||
242 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].x() + 8.0*gPow[4].x()) | ||
243 | - (6.0*omegaPow[2]/35.0) | ||
244 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].x()*vPow[1].x() | ||
245 | + (2.0*omegaPow[1]/5.0)*(gMagSqr + 2.0*gPow[2].x())*vPow[2].x(); | ||
246 | } | ||
247 | |||
248 | |||
249 | // Fourth order | ||
250 | IxFuncHeader(0,0,4) | ||
251 | { | ||
252 | Ix(0,0,4) = | ||
253 | - (2.0*omegaPow[4]/693.0) | ||
254 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].z() + 8.0*gPow[4].z())*gPow[1].x() | ||
255 | + (32.0*omegaPow[3]/315.0) | ||
256 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*gPow[1].z()*vPow[1].z() | ||
257 | - (12.0*omegaPow[2]/35.0) | ||
258 | *(gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*vPow[2].z() | ||
259 | + (16.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].z()*pow3(vPow[1].z()); | ||
260 | } | ||
261 | |||
262 | IxFuncHeader(0,4,0) | ||
263 | { | ||
264 | Ix(0,4) = | ||
265 | - (2.0*omegaPow[4]/693.0) | ||
266 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].y() + 8.0*gPow[4].y())*gPow[1].x() | ||
267 | + (32.0*omegaPow[3]/315.0) | ||
268 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*gPow[1].y()*vPow[1].y() | ||
269 | - (12.0*omegaPow[2]/35.0) | ||
270 | *(gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*sqr(vPow[1].y()) | ||
271 | + (16.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].y()*vPow[3].y(); | ||
272 | } | ||
273 | |||
274 | IxFuncHeader(4,0,0) | ||
275 | { | ||
276 | Ix(4) = | ||
277 | - (2.0*omegaPow[4]/693.0) | ||
278 | *(15.0*sqr(gMagSqr) + 40.0*gMagSqr*gPow[2].x() + 8.0*gPow[4].x()) | ||
279 | *gPow[1].x() | ||
280 | + (8.0*omegaPow[3]/315.0) | ||
281 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].x() | ||
282 | + 8.0*gPow[4].x())*vPow[1].x() | ||
283 | - (12.0*omegaPow[2]/35.0) | ||
284 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].x()*vPow[2].x() | ||
285 | + (8.0*omegaPow[1]/15.0) | ||
286 | *(gMagSqr + 2.0*gPow[2].x())*vPow[3].x(); | ||
287 | } | ||
288 | |||
289 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BoltzmannCollision/IyCoefficientFunctions.C added (mode: 100644) (index 0000000..13d2f0a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2019 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 | #include "BoltzmannCollision.H" | ||
26 | |||
27 | // Zero order | ||
28 | IyFuncHeader(0,0,0) | ||
29 | { | ||
30 | Iy(0) = 0.0; | ||
31 | } | ||
32 | |||
33 | // First order | ||
34 | IyFuncHeader(0,0,1) | ||
35 | { | ||
36 | Iy(0,0,1) =(4.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z(); | ||
37 | } | ||
38 | |||
39 | IyFuncHeader(0,1,0) | ||
40 | { | ||
41 | Iy(0,1) = (2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].y()); | ||
42 | } | ||
43 | |||
44 | IyFuncHeader(1,0,0) | ||
45 | { | ||
46 | Iy(1) = (4.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].y(); | ||
47 | } | ||
48 | |||
49 | // Second order | ||
50 | IyFuncHeader(0,0,2) | ||
51 | { | ||
52 | Iy(0,0,2) = | ||
53 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[3].z())*gPow[1].y() | ||
54 | + (8.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z()*vPow[1].z(); | ||
55 | } | ||
56 | |||
57 | IyFuncHeader(0,1,1) | ||
58 | { | ||
59 | Iy(0,1,1) = | ||
60 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].y())*gPow[1].z() | ||
61 | + (4.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z()*vPow[1].y() | ||
62 | + (2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].y())*vPow[1].z(); | ||
63 | } | ||
64 | |||
65 | IyFuncHeader(1,0,1) | ||
66 | { | ||
67 | Iy(1,0,1) = | ||
68 | - (4.0*omegaPow[2]/35.0)*gPow[1].x()*gPow[1].y()*gPow[1].z() | ||
69 | + (4.0*omegaPow[1]/15.0)*gPow[1].y()*(gPow[1].x()*vPow[1].z() | ||
70 | + gPow[1].z()*vPow[1].x()); | ||
71 | } | ||
72 | |||
73 | IyFuncHeader(1,1,0) | ||
74 | { | ||
75 | Iy(1,1) = | ||
76 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].y())*gPow[1].x() | ||
77 | + (4.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].x()*vPow[1].y() | ||
78 | + (2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].y())*vPow[1].x(); | ||
79 | } | ||
80 | |||
81 | IyFuncHeader(0,2,0) | ||
82 | { | ||
83 | Iy(0,2) = | ||
84 | - (2.0*omegaPow[2]/35.0)*(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y() | ||
85 | + (4.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].y())*vPow[1].y(); | ||
86 | } | ||
87 | |||
88 | IyFuncHeader(2,0,0) | ||
89 | { | ||
90 | Iy(2) = | ||
91 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].x())*gPow[1].y() | ||
92 | + (8.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].x()*vPow[1].x(); | ||
93 | } | ||
94 | |||
95 | // Third order | ||
96 | IyFuncHeader(0,0,3) | ||
97 | { | ||
98 | Iy(0,0,3) = | ||
99 | (8.0*omegaPow[3]/315.0) | ||
100 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*gPow[1].z() | ||
101 | - (6.0*omegaPow[2]/35.0) | ||
102 | *(gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*vPow[1].z() | ||
103 | + (4.0*omegaPow[1]/5.0)*gPow[1].y()*gPow[1].z()*vPow[2].z(); | ||
104 | } | ||
105 | |||
106 | IyFuncHeader(0,1,2) | ||
107 | { | ||
108 | Iy(0,1,2) = | ||
109 | (2.0*omegaPow[3]/315.0) | ||
110 | *( | ||
111 | sqr(gMagSqr) | ||
112 | + 4.0*gMagSqr*(gPow[2].y() + gPow[2].z()) | ||
113 | + 8.0*gPow[2].y()*gPow[2].z() | ||
114 | ) | ||
115 | - (2.0*omegaPow[2]/35.0) | ||
116 | *( | ||
117 | (gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*vPow[1].y() | ||
118 | + (gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*vPow[1].z() | ||
119 | ) | ||
120 | + (2.0*omegaPow[1]/15.0) | ||
121 | *( | ||
122 | (gMagSqr + 2.0*gPow[2].y())*vPow[2].z() | ||
123 | + 4.0*gPow[1].y()*gPow[1].z()*vPow[1].y()*vPow[1].z() | ||
124 | ); | ||
125 | } | ||
126 | |||
127 | IyFuncHeader(0,2,1) | ||
128 | { | ||
129 | Iy(0,2,1) = | ||
130 | (8.0*omegaPow[3]/315.0) | ||
131 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y()*gPow[1].z() | ||
132 | - (2.0*omegaPow[2]/35.0) | ||
133 | *( | ||
134 | 2.0*(gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*vPow[1].y() | ||
135 | + (3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y()*vPow[1].z() | ||
136 | ) | ||
137 | + (4.0*omegaPow[1]/15.0) | ||
138 | *( | ||
139 | (gMagSqr + 2.0*gPow[2].y())*vPow[1].y()*vPow[1].z() | ||
140 | + gPow[1].y()*gPow[1].z()*vPow[2].y() | ||
141 | ); | ||
142 | } | ||
143 | |||
144 | IyFuncHeader(0,3,0) | ||
145 | { | ||
146 | Iy(0,3) = | ||
147 | (2.0*omegaPow[2]/315.0) | ||
148 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].y() + 8.0*gPow[4].y()) | ||
149 | - (6.0*omegaPow[2]/35.0) | ||
150 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y()*vPow[1].y() | ||
151 | + (2.0*omegaPow[1]/5.0)*(gMagSqr + 2.0*gPow[2].y())*vPow[2].y(); | ||
152 | } | ||
153 | |||
154 | IyFuncHeader(1,0,2) | ||
155 | { | ||
156 | Iy(1,0,2) = | ||
157 | (8.0*omegaPow[3]/315.0) | ||
158 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*gPow[1].x() | ||
159 | - (2.0*omegaPow[2]/35.0) | ||
160 | *( | ||
161 | (gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*vPow[1].x() | ||
162 | + 4.0*gPow[1].y()*gPow[1].x()*gPow[1].z()*vPow[1].z() | ||
163 | ) | ||
164 | + (4.0*omegaPow[1]/15.0)*gPow[1].y()*vPow[1].z() | ||
165 | *(gPow[1].x()*vPow[1].z() + 2.0*gPow[1].z()*vPow[1].x()); | ||
166 | } | ||
167 | |||
168 | IyFuncHeader(1,1,1) | ||
169 | { | ||
170 | Iy(1,1,1) = | ||
171 | (8.0*omegaPow[3]/315.0) | ||
172 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*gPow[1].z() | ||
173 | - (2.0*omegaPow[2]/35.0) | ||
174 | *( | ||
175 | 2.0*gPow[1].y()*gPow[1].x()*gPow[1].z()*vPow[1].y() | ||
176 | + (gMagSqr + 2.0*gPow[2].y()) | ||
177 | *(gPow[1].x()*vPow[1].z() + gPow[1].z()*vPow[1].x()) | ||
178 | ) | ||
179 | + (4.0*omegaPow[1]/15.0) | ||
180 | *( | ||
181 | 2.0*gPow[1].y()*vPow[1].y() | ||
182 | *(gPow[1].x()*vPow[1].z() + gPow[1].z()*vPow[1].x()) | ||
183 | + (gMagSqr + 2.0*gPow[2].y())*vPow[1].x()*vPow[1].z() | ||
184 | ); | ||
185 | } | ||
186 | |||
187 | IyFuncHeader(1,2,0) | ||
188 | { | ||
189 | Iy(1,2,0) = | ||
190 | (8.0*omegaPow[3]/315.0) | ||
191 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y()*gPow[1].x() | ||
192 | - (2.0*omegaPow[2]/35.0) | ||
193 | *( | ||
194 | 2.0*(gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*vPow[1].y() | ||
195 | + (3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y()*vPow[1].x() | ||
196 | ) | ||
197 | + (4.0*omegaPow[1]/15.0) | ||
198 | *( | ||
199 | (gMagSqr + 2.0*gPow[2].y())*vPow[1].y()*vPow[1].x() | ||
200 | + gPow[1].y()*gPow[1].x()*vPow[2].y() | ||
201 | ); | ||
202 | } | ||
203 | |||
204 | IyFuncHeader(2,0,1) | ||
205 | { | ||
206 | Iy(2,0,1) = | ||
207 | (8.0*omegaPow[3]/315.0) | ||
208 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*gPow[1].z() | ||
209 | - (2.0*omegaPow[2]/35.0) | ||
210 | *( | ||
211 | (gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*vPow[1].z() | ||
212 | + 4.0*gPow[1].y()*gPow[1].z()*gPow[1].x()*vPow[1].x() | ||
213 | ) | ||
214 | + (4.0*omegaPow[1]/15.0)*gPow[1].y()*vPow[1].x() | ||
215 | *(gPow[1].z()*vPow[1].x() + 2.0*gPow[1].x()*vPow[1].z()); | ||
216 | } | ||
217 | |||
218 | IyFuncHeader(2,1,0) | ||
219 | { | ||
220 | Iy(2,1,0) = | ||
221 | (2.0*omegaPow[3]/315.0) | ||
222 | *( | ||
223 | sqr(gMagSqr) | ||
224 | + 4.0*gMagSqr*(gPow[2].y() + gPow[2].x()) | ||
225 | + 8.0*gPow[2].y()*gPow[2].x() | ||
226 | ) | ||
227 | - (2.0*omegaPow[2]/35.0) | ||
228 | *( | ||
229 | (gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*vPow[1].y() | ||
230 | + (gMagSqr + 2.0*gPow[2].y())*gPow[1].x()*vPow[1].x() | ||
231 | ) | ||
232 | + (2.0*omegaPow[1]/15.0) | ||
233 | *( | ||
234 | (gMagSqr + 2.0*gPow[2].y())*vPow[2].x() | ||
235 | + 4.0*gPow[1].y()*gPow[1].x()*vPow[1].y()*vPow[1].x() | ||
236 | ); | ||
237 | } | ||
238 | |||
239 | IyFuncHeader(3,0,0) | ||
240 | { | ||
241 | Iy(3) = | ||
242 | (8.0*omegaPow[3]/315.0) | ||
243 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*gPow[1].x() | ||
244 | - (6.0*omegaPow[2]/35.0) | ||
245 | *(gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*vPow[1].x() | ||
246 | + (4.0*omegaPow[1]/5.0)*gPow[1].y()*gPow[1].x()*vPow[2].x(); | ||
247 | } | ||
248 | |||
249 | |||
250 | // Fourth order | ||
251 | IyFuncHeader(0,0,4) | ||
252 | { | ||
253 | Iy(0,0,4) = | ||
254 | - (2.0*omegaPow[4]/693.0) | ||
255 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].z() | ||
256 | + 8.0*gPow[4].z())*gPow[1].y() | ||
257 | + (32.0*omegaPow[3]/315.0) | ||
258 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*gPow[1].z()*vPow[1].z() | ||
259 | - (12.0*omegaPow[2]/35.0) | ||
260 | *(gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*vPow[2].z() | ||
261 | + (16.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z()*pow3(vPow[1].z()); | ||
262 | } | ||
263 | |||
264 | IyFuncHeader(0,4,0) | ||
265 | { | ||
266 | Iy(0,4) = | ||
267 | - (2.0*omegaPow[4]/693.0) | ||
268 | *(15.0*sqr(gMagSqr) + 40.0*gMagSqr*gPow[2].y() + 8.0*gPow[4].y()) | ||
269 | *gPow[1].y() | ||
270 | + (8.0*omegaPow[3]/315.0) | ||
271 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].y() + 8.0*gPow[4].y()) | ||
272 | *vPow[1].y() | ||
273 | - (12.0*omegaPow[2]/35.0) | ||
274 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].y()*vPow[2].y() | ||
275 | + (8.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].y())*vPow[3].y(); | ||
276 | } | ||
277 | |||
278 | IyFuncHeader(4,0,0) | ||
279 | { | ||
280 | Iy(4) = | ||
281 | - (2.0*omegaPow[4]/693.0) | ||
282 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].x() | ||
283 | + 8.0*gPow[4].x())*gPow[1].y() | ||
284 | + (32.0*omegaPow[3]/315.0) | ||
285 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*gPow[1].x()*vPow[1].x() | ||
286 | - (12.0*omegaPow[2]/35.0) | ||
287 | *(gMagSqr + 2.0*gPow[2].x())*gPow[1].y()*vPow[2].x() | ||
288 | + (16.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].x()*vPow[3].x(); | ||
289 | } | ||
290 | |||
291 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/BoltzmannCollision/IzCoefficientFunctions.C added (mode: 100644) (index 0000000..652b0ab) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2019 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 | #include "BoltzmannCollision.H" | ||
26 | |||
27 | // Zero order | ||
28 | IzFuncHeader(0,0,0) | ||
29 | { | ||
30 | Iz(0) = 0.0; | ||
31 | } | ||
32 | |||
33 | // First order | ||
34 | IzFuncHeader(0,0,1) | ||
35 | { | ||
36 | Iz(0,0,1) = -(2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].z()); | ||
37 | } | ||
38 | |||
39 | IzFuncHeader(0,1,0) | ||
40 | { | ||
41 | Iz(0,1) = (4.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z(); | ||
42 | } | ||
43 | |||
44 | IzFuncHeader(1,0,0) | ||
45 | { | ||
46 | Iz(1) = (4.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].z(); | ||
47 | } | ||
48 | |||
49 | // Second order | ||
50 | IzFuncHeader(0,0,2) | ||
51 | { | ||
52 | Iz(0,0,2) = | ||
53 | - (2.0*omegaPow[2]/35.0)*(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z() | ||
54 | + (4.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].z())*vPow[1].z(); | ||
55 | } | ||
56 | |||
57 | IzFuncHeader(0,1,1) | ||
58 | { | ||
59 | Iz(0,1,1) = | ||
60 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].z())*gPow[1].y() | ||
61 | + (4.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z()*vPow[1].z() | ||
62 | + (2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].z())*vPow[1].y(); | ||
63 | } | ||
64 | |||
65 | IzFuncHeader(1,0,1) | ||
66 | { | ||
67 | Iz(1,0,1) = | ||
68 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].z())*gPow[1].x() | ||
69 | + (4.0*omegaPow[1]/15.0)*gPow[1].z()*gPow[1].x()*vPow[1].z() | ||
70 | + (2.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].z())*vPow[1].x(); | ||
71 | } | ||
72 | |||
73 | IzFuncHeader(1,1,0) | ||
74 | { | ||
75 | Iz(1,1) = | ||
76 | - (4.0*omegaPow[2]/35.0)*gPow[1].x()*gPow[1].y()*gPow[1].z() | ||
77 | + (4.0*omegaPow[1]/15.0) | ||
78 | *gPow[1].z()*(gPow[1].x()*vPow[1].y() + gPow[1].y()*vPow[1].x()); | ||
79 | } | ||
80 | |||
81 | IzFuncHeader(0,2,0) | ||
82 | { | ||
83 | Iz(0,2) = | ||
84 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].y())*gPow[1].z() | ||
85 | + (8.0*omegaPow[1]/15.0)*gPow[1].y()*gPow[1].z()*vPow[1].y(); | ||
86 | } | ||
87 | |||
88 | IzFuncHeader(2,0,0) | ||
89 | { | ||
90 | Iz(2) = | ||
91 | - (2.0*omegaPow[2]/35.0)*(gMagSqr + 2.0*gPow[2].x())*gPow[1].z() | ||
92 | + (8.0*omegaPow[1]/15.0)*gPow[1].x()*gPow[1].z()*vPow[1].x(); | ||
93 | } | ||
94 | |||
95 | // Third order | ||
96 | IzFuncHeader(0,0,3) | ||
97 | { | ||
98 | Iz(0,0,3) = | ||
99 | (2.0*omegaPow[2]/315.0) | ||
100 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].z() + 8.0*gPow[4].z()) | ||
101 | - (6.0*omegaPow[2]/35.0) | ||
102 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z()*vPow[1].z() | ||
103 | + (2.0*omegaPow[1]/5.0)*(gMagSqr + 2.0*gPow[2].z())*vPow[2].z(); | ||
104 | } | ||
105 | |||
106 | IzFuncHeader(0,1,2) | ||
107 | { | ||
108 | Iz(0,1,2) = | ||
109 | (8.0*omegaPow[3]/315.0) | ||
110 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z()*gPow[1].y() | ||
111 | - (2.0*omegaPow[2]/35.0) | ||
112 | *( | ||
113 | 2.0*(gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*vPow[1].z() | ||
114 | + (3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z()*vPow[1].y() | ||
115 | ) | ||
116 | + (4.0*omegaPow[1]/15.0) | ||
117 | *( | ||
118 | (gMagSqr + 2.0*gPow[2].z())*vPow[1].z()*vPow[1].y() | ||
119 | + gPow[1].z()*gPow[1].y()*vPow[2].z() | ||
120 | ); | ||
121 | } | ||
122 | |||
123 | IzFuncHeader(0,2,1) | ||
124 | { | ||
125 | Iz(0,2,1) = | ||
126 | (2.0*omegaPow[3]/315.0) | ||
127 | *( | ||
128 | sqr(gMagSqr) | ||
129 | + 4.0*gMagSqr*(gPow[2].z() + gPow[2].y()) | ||
130 | + 8.0*gPow[2].z()*gPow[2].y() | ||
131 | ) | ||
132 | - (2.0*omegaPow[2]/35.0) | ||
133 | *( | ||
134 | (gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*vPow[1].z() | ||
135 | + (gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*vPow[1].y() | ||
136 | ) | ||
137 | + (2.0*omegaPow[1]/15.0) | ||
138 | *( | ||
139 | (gMagSqr + 2.0*gPow[2].z())*vPow[2].y() | ||
140 | + 4.0*gPow[1].z()*gPow[1].y()*vPow[1].z()*vPow[1].y() | ||
141 | ); | ||
142 | } | ||
143 | |||
144 | IzFuncHeader(0,3,0) | ||
145 | { | ||
146 | Iz(0,3) = | ||
147 | (8.0*omegaPow[3]/315.0) | ||
148 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*gPow[1].y() | ||
149 | - (6.0*omegaPow[2]/35.0) | ||
150 | *(gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*vPow[1].y() | ||
151 | + (4.0*omegaPow[1]/5.0)*gPow[1].z()*gPow[1].y()*vPow[2].y(); | ||
152 | } | ||
153 | |||
154 | IzFuncHeader(1,0,2) | ||
155 | { | ||
156 | Iz(1,0,2) = | ||
157 | (8.0*omegaPow[3]/315.0) | ||
158 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z()*gPow[1].x() | ||
159 | - (2.0*omegaPow[2]/35.0) | ||
160 | *( | ||
161 | 2.0*(gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*vPow[1].z() | ||
162 | + (3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z()*vPow[1].x() | ||
163 | ) | ||
164 | + (4.0*omegaPow[1]/15.0) | ||
165 | *( | ||
166 | (gMagSqr + 2.0*gPow[2].z())*vPow[1].z()*vPow[1].x() | ||
167 | + gPow[1].z()*gPow[1].x()*vPow[2].z() | ||
168 | ); | ||
169 | } | ||
170 | |||
171 | IzFuncHeader(1,1,1) | ||
172 | { | ||
173 | Iz(1,1,1) = | ||
174 | (8.0*omegaPow[3]/315.0) | ||
175 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].y()*gPow[1].x() | ||
176 | - (2.0*omegaPow[2]/35.0) | ||
177 | *( | ||
178 | 2.0*gPow[1].z()*gPow[1].y()*gPow[1].x()*vPow[1].z() | ||
179 | + (gMagSqr + 2.0*gPow[2].z()) | ||
180 | *(gPow[1].y()*vPow[1].x() + gPow[1].x()*vPow[1].y()) | ||
181 | ) | ||
182 | + (4.0*omegaPow[1]/15.0) | ||
183 | *( | ||
184 | 2.0*gPow[1].z()*vPow[1].z() | ||
185 | *(gPow[1].y()*vPow[1].x() + gPow[1].x()*vPow[1].y()) | ||
186 | + (gMagSqr + 2.0*gPow[2].z())*vPow[1].y()*vPow[1].x() | ||
187 | ); | ||
188 | } | ||
189 | |||
190 | IzFuncHeader(1,2,0) | ||
191 | { | ||
192 | Iz(1,2,0) = | ||
193 | (8.0*omegaPow[3]/315.0) | ||
194 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*gPow[1].x() | ||
195 | - (2.0*omegaPow[2]/35.0) | ||
196 | *( | ||
197 | (gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*vPow[1].x() | ||
198 | + 4.0*gPow[1].z()*gPow[1].x()*gPow[1].y()*vPow[1].y() | ||
199 | ) | ||
200 | + (4.0*omegaPow[1]/15.0)*gPow[1].z()*vPow[1].y() | ||
201 | *(gPow[1].x()*vPow[1].y() + 2.0*gPow[1].y()*vPow[1].x()); | ||
202 | } | ||
203 | |||
204 | IzFuncHeader(2,0,1) | ||
205 | { | ||
206 | Iz(2,0,1) = | ||
207 | (2.0*omegaPow[3]/315.0) | ||
208 | *( | ||
209 | sqr(gMagSqr) | ||
210 | + 4.0*gMagSqr*(gPow[2].z() + gPow[2].x()) | ||
211 | + 8.0*gPow[2].z()*gPow[2].x() | ||
212 | ) | ||
213 | - (2.0*omegaPow[2]/35.0) | ||
214 | *( | ||
215 | (gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*vPow[1].z() | ||
216 | + (gMagSqr + 2.0*gPow[2].z())*gPow[1].x()*vPow[1].x() | ||
217 | ) | ||
218 | + (2.0*omegaPow[1]/15.0) | ||
219 | *( | ||
220 | (gMagSqr + 2.0*gPow[2].z())*vPow[2].x() | ||
221 | + 4.0*gPow[1].z()*gPow[1].x()*vPow[1].z()*vPow[1].x() | ||
222 | ); | ||
223 | } | ||
224 | |||
225 | IzFuncHeader(2,1,0) | ||
226 | { | ||
227 | Iz(2,1,0) = | ||
228 | (8.0*omegaPow[3]/315.0) | ||
229 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*gPow[1].y() | ||
230 | - (2.0*omegaPow[2]/35.0) | ||
231 | *( | ||
232 | (gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*vPow[1].y() | ||
233 | + 4.0*gPow[1].z()*gPow[1].y()*gPow[1].x()*vPow[1].x() | ||
234 | ) | ||
235 | + (4.0*omegaPow[1]/15.0)*gPow[1].z()*vPow[1].x() | ||
236 | *(gPow[1].y()*vPow[1].x() + 2.0*gPow[1].x()*vPow[1].y()); | ||
237 | } | ||
238 | |||
239 | |||
240 | IzFuncHeader(3,0,0) | ||
241 | { | ||
242 | Iz(3) = | ||
243 | (8.0*omegaPow[3]/315.0) | ||
244 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*gPow[1].x() | ||
245 | - (6.0*omegaPow[2]/35.0) | ||
246 | *(gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*vPow[1].x() | ||
247 | + (4.0*omegaPow[1]/5.0)*gPow[1].x()*gPow[1].z()*vPow[2].x(); | ||
248 | } | ||
249 | |||
250 | // Fourth order | ||
251 | IzFuncHeader(0,0,4) | ||
252 | { | ||
253 | Iz(0,0,4) = | ||
254 | - (2.0*omegaPow[4]/693.0) | ||
255 | *(15.0*sqr(gMagSqr) + 40.0*gMagSqr*gPow[2].z() + 8.0*gPow[4].z()) | ||
256 | *gPow[1].z() | ||
257 | + (8.0*omegaPow[3]/315.0) | ||
258 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].z() + 8.0*gPow[4].z()) | ||
259 | *vPow[1].z() | ||
260 | - (12.0*omegaPow[2]/35.0) | ||
261 | *(3.0*gMagSqr + 2.0*gPow[2].z())*gPow[1].z()*vPow[2].z() | ||
262 | + (8.0*omegaPow[1]/15.0)*(gMagSqr + 2.0*gPow[2].z())*pow3(vPow[1].z()); | ||
263 | } | ||
264 | |||
265 | IzFuncHeader(0,4,0) | ||
266 | { | ||
267 | Iz(0,4) = | ||
268 | - (2.0*omegaPow[4]/693.0) | ||
269 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].y() | ||
270 | + 8.0*gPow[4].y())*gPow[1].z() | ||
271 | + (32.0*omegaPow[3]/315.0) | ||
272 | *(3.0*gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*gPow[1].y()*vPow[1].y() | ||
273 | - (12.0*omegaPow[2]/35.0) | ||
274 | *(gMagSqr + 2.0*gPow[2].y())*gPow[1].z()*vPow[2].y() | ||
275 | + (16.0*omegaPow[1]/15.0)*gPow[1].z()*gPow[1].y()*vPow[3].y(); | ||
276 | } | ||
277 | |||
278 | IzFuncHeader(4,0,0) | ||
279 | { | ||
280 | Iz(4) = | ||
281 | - (2.0*omegaPow[4]/693.0) | ||
282 | *(3.0*sqr(gMagSqr) + 24.0*gMagSqr*gPow[2].x() | ||
283 | + 8.0*gPow[4].x())*gPow[1].z() | ||
284 | + (32.0*omegaPow[3]/315.0) | ||
285 | *(3.0*gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*gPow[1].x()*vPow[1].x() | ||
286 | - (12.0*omegaPow[2]/35.0) | ||
287 | *(gMagSqr + 2.0*gPow[2].x())*gPow[1].z()*vPow[2].x() | ||
288 | + (16.0*omegaPow[1]/15.0)*gPow[1].z()*gPow[1].x()*vPow[3].x(); | ||
289 | } | ||
290 | |||
291 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/collisionKernel/collisionKernel.C changed (mode: 100644) (index 97ff788..b747903) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
40 | 40 | ||
41 | 41 | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // |
42 | 42 | ||
43 | Foam::scalar Foam::populationBalanceSubModels::collisionKernel::meanVelocity | ||
44 | ( | ||
45 | const scalar& m0, | ||
46 | const scalar& m1 | ||
47 | ) const | ||
48 | { | ||
49 | return m1/m0; | ||
50 | } | ||
51 | |||
52 | 43 | Foam::tmp<Foam::volScalarField> | Foam::tmp<Foam::volScalarField> |
53 | Foam::populationBalanceSubModels::collisionKernel::meanVelocity | ||
44 | Foam::populationBalanceSubModels::collisionKernel::lookupOrInitialize | ||
54 | 45 | ( | ( |
55 | const volScalarField& m0, | ||
56 | const volScalarField& m1 | ||
46 | const fvMesh& mesh, | ||
47 | const word& name, | ||
48 | const dictionary& dict, | ||
49 | const word& entryName, | ||
50 | const dimensionSet& dims | ||
57 | 51 | ) | ) |
58 | 52 | { | { |
59 | return m1/m0; | ||
53 | if (mesh.foundObject<volScalarField>(name)) | ||
54 | { | ||
55 | return mesh.lookupObject<volScalarField>(name); | ||
56 | } | ||
57 | |||
58 | return tmp<volScalarField> | ||
59 | ( | ||
60 | new volScalarField | ||
61 | ( | ||
62 | IOobject | ||
63 | ( | ||
64 | name, | ||
65 | mesh.time().timeName(), | ||
66 | mesh | ||
67 | ), | ||
68 | mesh, | ||
69 | dimensionedScalar(entryName, dims, dict) | ||
70 | ) | ||
71 | ); | ||
60 | 72 | } | } |
61 | 73 | ||
62 | Foam::scalar Foam::populationBalanceSubModels::collisionKernel::variance | ||
74 | Foam::scalar | ||
75 | Foam::populationBalanceSubModels::collisionKernel::d | ||
63 | 76 | ( | ( |
64 | const scalar& m0, | ||
65 | const scalar& sqrM1, | ||
66 | const scalar& m2 | ||
77 | const label nodei, | ||
78 | const label celli | ||
67 | 79 | ) const | ) const |
68 | 80 | { | { |
69 | return max(m2/m0 - sqrM1, 0.0); | ||
70 | } | ||
81 | if (sizeIndex_ == -1) | ||
82 | { | ||
83 | return dp_()[celli]; | ||
84 | } | ||
71 | 85 | ||
72 | Foam::tmp<Foam::volScalarField> | ||
73 | Foam::populationBalanceSubModels::collisionKernel::variance | ||
74 | ( | ||
75 | const volScalarField& m0, | ||
76 | const volScalarField& sqrM1, | ||
77 | const volScalarField& m2 | ||
78 | ) | ||
79 | { | ||
80 | return max(m2/m0 - sqrM1, dimensionedScalar("zero", sqr(dimVelocity), 0.0)); | ||
86 | const volVelocityNode& node = quadrature_.nodes()(nodei); | ||
87 | scalar abscissa = node.primaryAbscissae()[sizeIndex_][celli]; | ||
88 | |||
89 | if (node.lengthBased()) | ||
90 | { | ||
91 | return max(abscissa, minD_); | ||
92 | } | ||
93 | else | ||
94 | { | ||
95 | return cbrt(abscissa/rhos_[nodei]/Foam::constant::mathematical::pi*6.0); | ||
96 | } | ||
81 | 97 | } | } |
82 | 98 | ||
99 | |||
83 | 100 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
84 | 101 | ||
85 | 102 | Foam::populationBalanceSubModels::collisionKernel::collisionKernel | Foam::populationBalanceSubModels::collisionKernel::collisionKernel |
86 | 103 | ( | ( |
87 | 104 | const dictionary& dict, | const dictionary& dict, |
88 | 105 | const fvMesh& mesh, | const fvMesh& mesh, |
89 | const velocityQuadratureApproximation& quadrature, | ||
90 | const bool ode | ||
106 | const velocityQuadratureApproximation& quadrature | ||
91 | 107 | ) | ) |
92 | 108 | : | : |
93 | 109 | dict_(dict), | dict_(dict), |
94 | 110 | mesh_(mesh), | mesh_(mesh), |
95 | 111 | quadrature_(quadrature), | quadrature_(quadrature), |
96 | 112 | momentOrders_(quadrature.momentOrders()), | momentOrders_(quadrature.momentOrders()), |
97 | nDimensions_(momentOrders_[0].size()) | ||
98 | {} | ||
113 | nodeIndexes_(quadrature.nodeIndexes()), | ||
114 | velocityIndexes_(quadrature.nodes()[0].velocityIndexes()), | ||
115 | nDimensions_(velocityIndexes_.size()), | ||
116 | sizeIndex_(quadrature.nodes()[0].sizeIndex()), | ||
117 | nSizes_(0), | ||
118 | rhos_(1), | ||
119 | minD_(dict.lookupOrDefault("minD", small)), | ||
120 | implicit_(dict_.lookupOrDefault("implicit", true)) | ||
121 | { | ||
122 | if (sizeIndex_ != -1) | ||
123 | { | ||
124 | forAll(nodeIndexes_, nodei) | ||
125 | { | ||
126 | nSizes_ = max(nSizes_, nodeIndexes_[nodei][sizeIndex_] + 1); | ||
127 | } | ||
128 | |||
129 | rhos_.resize(nSizes_); | ||
130 | } | ||
131 | else | ||
132 | { | ||
133 | dp_= | ||
134 | lookupOrInitialize | ||
135 | ( | ||
136 | mesh, | ||
137 | IOobject::groupName("d", quadrature.moments()[0].group()), | ||
138 | dict, | ||
139 | "d", | ||
140 | dimLength | ||
141 | ).ptr(); | ||
142 | } | ||
143 | |||
144 | scalarList rhos(dict_.lookupOrDefault("rhos", scalarList())); | ||
145 | |||
146 | forAll(rhos, i) | ||
147 | { | ||
148 | rhos_[i] = rhos[i]; | ||
149 | } | ||
150 | |||
151 | if (rhos.size() < nSizes_ || nSizes_ == 0) | ||
152 | { | ||
153 | tmp<volScalarField> rho | ||
154 | ( | ||
155 | lookupOrInitialize | ||
156 | ( | ||
157 | mesh, | ||
158 | IOobject::groupName | ||
159 | ( | ||
160 | "thermo:rho", | ||
161 | quadrature.moments()[0].group() | ||
162 | ), | ||
163 | dict, | ||
164 | "rho", | ||
165 | dimDensity | ||
166 | ) | ||
167 | ); | ||
168 | |||
169 | for (label i = rhos.size(); i < nSizes_; i++) | ||
170 | { | ||
171 | rhos_[i] = rho()[0]; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | |||
176 | forAll(momentOrders_, mi) | ||
177 | { | ||
178 | const labelList& momentOrder = momentOrders_[mi]; | ||
179 | labelList order(nDimensions_, 0); | ||
180 | |||
181 | forAll(velocityIndexes_, cmpt) | ||
182 | { | ||
183 | order[cmpt] = momentOrder[velocityIndexes_[cmpt]]; | ||
184 | } | ||
185 | |||
186 | bool found = false; | ||
187 | |||
188 | forAll(velocityMomentOrders_, vmi) | ||
189 | { | ||
190 | bool same = true; | ||
191 | |||
192 | forAll(velocityMomentOrders_[vmi], cmpt) | ||
193 | { | ||
194 | if (velocityMomentOrders_[vmi][cmpt] != order[cmpt]) | ||
195 | { | ||
196 | same = false; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | if (same) | ||
201 | { | ||
202 | found = true; | ||
203 | } | ||
204 | } | ||
205 | |||
206 | if (!found) | ||
207 | { | ||
208 | velocityMomentOrders_.append(order); | ||
209 | } | ||
210 | } | ||
211 | |||
212 | if (nodeIndexes_[0].size() >= velocityIndexes_.size()) | ||
213 | { | ||
214 | forAll(nodeIndexes_, nodei) | ||
215 | { | ||
216 | const labelList& nodeIndex = nodeIndexes_[nodei]; | ||
217 | labelList index(nDimensions_, 0); | ||
218 | |||
219 | forAll(velocityIndexes_, cmpt) | ||
220 | { | ||
221 | index[cmpt] = nodeIndex[velocityIndexes_[cmpt]]; | ||
222 | } | ||
223 | |||
224 | bool found = false; | ||
225 | |||
226 | forAll(velocityNodeIndexes_, vmi) | ||
227 | { | ||
228 | bool same = true; | ||
229 | |||
230 | forAll(velocityNodeIndexes_[vmi], cmpt) | ||
231 | { | ||
232 | if (velocityNodeIndexes_[vmi][cmpt] != index[cmpt]) | ||
233 | { | ||
234 | same = false; | ||
235 | } | ||
236 | } | ||
237 | |||
238 | if (same) | ||
239 | { | ||
240 | found = true; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | if (!found) | ||
245 | { | ||
246 | velocityNodeIndexes_.append(index); | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | } | ||
99 | 251 | ||
100 | 252 | ||
101 | 253 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
... | ... | Foam::populationBalanceSubModels::collisionKernel::~collisionKernel() | |
104 | 256 | {} | {} |
105 | 257 | ||
106 | 258 | ||
259 | |||
260 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
261 | |||
262 | void Foam::populationBalanceSubModels::collisionKernel::preUpdate() | ||
263 | {} | ||
264 | |||
265 | |||
266 | void Foam::populationBalanceSubModels::collisionKernel::updateFields() | ||
267 | { | ||
268 | if (!implicit_) | ||
269 | { | ||
270 | return; | ||
271 | } | ||
272 | |||
273 | forAll(quadrature_.moments()[0], celli) | ||
274 | { | ||
275 | updateCells(celli); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | |||
107 | 280 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/collisionKernel/collisionKernel.H changed (mode: 100644) (index ff8e057..191f424) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
56 | 56 | ||
57 | 57 | class collisionKernel | class collisionKernel |
58 | 58 | { | { |
59 | // Private member functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | collisionKernel(const collisionKernel&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const collisionKernel&); | ||
66 | |||
67 | |||
68 | 59 | protected: | protected: |
69 | 60 | ||
70 | 61 | // Protected data | // Protected data |
... | ... | protected: | |
79 | 70 | const velocityQuadratureApproximation& quadrature_; | const velocityQuadratureApproximation& quadrature_; |
80 | 71 | ||
81 | 72 | //- Moment indicies ues to map moments | //- Moment indicies ues to map moments |
82 | const labelListList momentOrders_; | ||
73 | const labelListList& momentOrders_; | ||
74 | |||
75 | //- Nodes indexes | ||
76 | const labelListList& nodeIndexes_; | ||
77 | |||
78 | //- Velocity indexes | ||
79 | const labelList& velocityIndexes_; | ||
83 | 80 | ||
84 | 81 | //- Number of dimensions | //- Number of dimensions |
85 | 82 | const label nDimensions_; | const label nDimensions_; |
86 | 83 | ||
84 | //- List of velocity moment orders | ||
85 | labelListList velocityMomentOrders_; | ||
87 | 86 | ||
88 | // Protected functions | ||
87 | //- List of velocity node indexes | ||
88 | labelListList velocityNodeIndexes_; | ||
89 | 89 | ||
90 | //- Variances for a cell | ||
91 | scalar meanVelocity(const scalar& m0, const scalar& m1) const; | ||
90 | //- Size index | ||
91 | label sizeIndex_; | ||
92 | 92 | ||
93 | //- Mean velocities for a field | ||
94 | tmp<volScalarField> meanVelocity | ||
95 | ( | ||
96 | const volScalarField& m0, | ||
97 | const volScalarField& m1 | ||
98 | ); | ||
93 | //- Number of sizes | ||
94 | label nSizes_; | ||
99 | 95 | ||
100 | //- Variances for a cell | ||
101 | scalar variance | ||
102 | ( | ||
103 | const scalar& m0, | ||
104 | const scalar& sqrM1, | ||
105 | const scalar& m2 | ||
106 | ) const; | ||
96 | //- Refrence to particle diameter | ||
97 | tmp<volScalarField> dp_; | ||
98 | |||
99 | //- List of patricle densities | ||
100 | scalarList rhos_; | ||
101 | |||
102 | //- Minimum diameter | ||
103 | scalar minD_; | ||
107 | 104 | ||
108 | //- Variance for a field | ||
109 | tmp<volScalarField> variance | ||
105 | //- Is an implicit solution used | ||
106 | Switch implicit_; | ||
107 | |||
108 | |||
109 | // Protected functions | ||
110 | |||
111 | static tmp<volScalarField> lookupOrInitialize | ||
110 | 112 | ( | ( |
111 | const volScalarField& m0, | ||
112 | const volScalarField& sqrM1, | ||
113 | const volScalarField& m2 | ||
113 | const fvMesh& mesh, | ||
114 | const word& name, | ||
115 | const dictionary& dict, | ||
116 | const word& entryName, | ||
117 | const dimensionSet& dims | ||
114 | 118 | ); | ); |
115 | 119 | ||
120 | //- Return the diameter given a node and cell | ||
121 | scalar d(const label node, const label celli) const; | ||
116 | 122 | ||
117 | 123 | public: | public: |
118 | 124 | ||
... | ... | public: | |
128 | 134 | ( | ( |
129 | 135 | const dictionary& dict, | const dictionary& dict, |
130 | 136 | const fvMesh& mesh, | const fvMesh& mesh, |
131 | const velocityQuadratureApproximation& quadrature, | ||
132 | const bool ode | ||
137 | const velocityQuadratureApproximation& quadrature | ||
133 | 138 | ), | ), |
134 | (dict, mesh, quadrature, ode) | ||
139 | (dict, mesh, quadrature) | ||
135 | 140 | ); | ); |
136 | 141 | ||
137 | 142 | ||
... | ... | public: | |
142 | 147 | ( | ( |
143 | 148 | const dictionary& dict, | const dictionary& dict, |
144 | 149 | const fvMesh& mesh, | const fvMesh& mesh, |
145 | const velocityQuadratureApproximation& quadrature, | ||
146 | const bool ode | ||
150 | const velocityQuadratureApproximation& quadrature | ||
147 | 151 | ); | ); |
148 | 152 | ||
153 | //- Disallow default bitwise copy construct | ||
154 | collisionKernel(const collisionKernel&) = delete; | ||
155 | |||
149 | 156 | ||
150 | 157 | // Selectors | // Selectors |
151 | 158 | ||
... | ... | public: | |
153 | 160 | ( | ( |
154 | 161 | const dictionary& dict, | const dictionary& dict, |
155 | 162 | const fvMesh& mesh, | const fvMesh& mesh, |
156 | const velocityQuadratureApproximation& quadrature, | ||
157 | const bool ode | ||
163 | const velocityQuadratureApproximation& quadrature | ||
158 | 164 | ); | ); |
159 | 165 | ||
160 | 166 | ||
... | ... | public: | |
164 | 170 | ||
165 | 171 | // Member Functions | // Member Functions |
166 | 172 | ||
173 | //- Is an implicit source used | ||
174 | virtual bool implicit() const | ||
175 | { | ||
176 | return implicit_; | ||
177 | } | ||
178 | |||
179 | //- Update unchanged fields before solving ode system | ||
180 | virtual void preUpdate(); | ||
181 | |||
167 | 182 | //- Update collision sources in a cell | //- Update collision sources in a cell |
168 | 183 | virtual void updateCells(const label celli) = 0; | virtual void updateCells(const label celli) = 0; |
169 | 184 | ||
170 | 185 | //- Update collision sources | //- Update collision sources |
171 | virtual void updateFields() = 0; | ||
186 | virtual void updateFields(); | ||
172 | 187 | ||
173 | 188 | //- Return explicit collision source term | //- Return explicit collision source term |
174 | 189 | virtual scalar explicitCollisionSource | virtual scalar explicitCollisionSource |
175 | 190 | ( | ( |
176 | const label mi, | ||
191 | const labelList& momentOrder, | ||
177 | 192 | const label celli | const label celli |
178 | 193 | ) const = 0; | ) const = 0; |
179 | 194 | ||
180 | 195 | //- Return implicit collision source matrix | //- Return implicit collision source matrix |
181 | 196 | virtual tmp<fvScalarMatrix> implicitCollisionSource | virtual tmp<fvScalarMatrix> implicitCollisionSource |
182 | 197 | ( | ( |
183 | const volVectorMoment& m | ||
198 | const volVelocityMoment& m | ||
184 | 199 | ) const = 0; | ) const = 0; |
200 | |||
201 | |||
202 | // Member Operators | ||
203 | |||
204 | //- Disallow default bitwise assignment | ||
205 | void operator=(const collisionKernel&) = delete; | ||
185 | 206 | }; | }; |
186 | 207 | ||
187 | 208 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/collisionKernel/newCollisionKernel.C changed (mode: 100644) (index 46e5163..08906e2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::collisionKernel::New | |
32 | 32 | ( | ( |
33 | 33 | const dictionary& dict, | const dictionary& dict, |
34 | 34 | const fvMesh& mesh, | const fvMesh& mesh, |
35 | const velocityQuadratureApproximation& quadrature, | ||
36 | const bool ode | ||
35 | const velocityQuadratureApproximation& quadrature | ||
37 | 36 | ) | ) |
38 | 37 | { | { |
39 | 38 | word collisionKernelType(dict.lookup("collisionKernel")); | word collisionKernelType(dict.lookup("collisionKernel")); |
... | ... | Foam::populationBalanceSubModels::collisionKernel::New | |
60 | 59 | ( | ( |
61 | 60 | dict, | dict, |
62 | 61 | mesh, | mesh, |
63 | quadrature, | ||
64 | ode | ||
62 | quadrature | ||
65 | 63 | ) | ) |
66 | 64 | ); | ); |
67 | 65 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/esBGKCollision/esBGKCollision.C changed (mode: 100644) (index 7000a50..32eb752) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace collisionKernels | |
46 | 46 | } | } |
47 | 47 | } | } |
48 | 48 | ||
49 | // * * * * * * * * * * * * * Protected Functions * * * * * * * * * * * * * * // | ||
49 | 50 | ||
50 | // * * * * * * * * * * * * * * Static Functions * * * * * * * * * * * * * * // | ||
51 | |||
52 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
53 | ::updateCells1D(const label celli) | ||
51 | Foam::symmTensor | ||
52 | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision::covariance | ||
53 | ( | ||
54 | const label celli, | ||
55 | const scalar& u, | ||
56 | const scalar& v, | ||
57 | const scalar& w | ||
58 | ) | ||
54 | 59 | { | { |
55 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
60 | symmTensor sigma(Zero); | ||
56 | 61 | ||
62 | const volVelocityMomentFieldSet& moments = quadrature_.moments(); | ||
57 | 63 | scalar m0 = max(moments(0)[celli], SMALL); | scalar m0 = max(moments(0)[celli], SMALL); |
58 | 64 | ||
59 | // Mean velocity | ||
60 | scalar u = meanVelocity(m0, moments(1)[celli]); | ||
61 | scalar uSqr = sqr(u); | ||
62 | |||
63 | 65 | // Variances of velocities | // Variances of velocities |
64 | scalar sigma = max(moments(2)[celli]/m0 - uSqr, 0.0); | ||
65 | scalar sigma1 = (a1_ + b1_)*sigma; | ||
66 | scalar sigma1 = max(moments(2)[celli]/m0 - sqr(u), 0.0); | ||
67 | scalar sigma2 = 0.0; | ||
68 | scalar sigma3 = 0.0; | ||
66 | 69 | Theta_[celli] = sigma1; | Theta_[celli] = sigma1; |
67 | 70 | ||
68 | Meq_(0) = moments(0)[celli]; | ||
69 | Meq_(1) = moments(1)[celli]; | ||
70 | Meq_(2) = m0*(sigma1 + uSqr); | ||
71 | Meq_(3) = m0*(3.0*sigma1*u + u*uSqr); | ||
72 | Meq_(4) = m0*(6.0*uSqr*sigma1 + 3.0*sqr(sigma1) + uSqr*uSqr); | ||
73 | } | ||
74 | |||
75 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
76 | ::updateCells2D(const label celli) | ||
77 | { | ||
78 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
79 | scalar m00 = max(moments(0,0)[celli], SMALL); | ||
71 | if (nDimensions_ > 1) | ||
72 | { | ||
73 | sigma2 = max(moments(0,2)[celli]/m0 - sqr(v), 0.0); | ||
74 | Theta_[celli] += sigma2; | ||
75 | } | ||
80 | 76 | ||
81 | // Mean velocity | ||
82 | scalar u = meanVelocity(m00, moments(1,0)[celli]); | ||
83 | scalar v = meanVelocity(m00, moments(0,1)[celli]); | ||
84 | scalar uSqr = sqr(u); | ||
85 | scalar vSqr = sqr(v); | ||
77 | if (nDimensions_ > 2) | ||
78 | { | ||
79 | sigma3 = max(moments(0,0,2)[celli]/m0 - sqr(w), 0.0); | ||
80 | Theta_[celli] += sigma3; | ||
81 | } | ||
86 | 82 | ||
87 | // Variances of velocities | ||
88 | scalar sigma1 = max(moments(2,0)[celli]/m00 - uSqr, 0.0); | ||
89 | scalar sigma2 = max(moments(0,2)[celli]/m00 - vSqr, 0.0); | ||
90 | Theta_[celli] = (sigma1 + sigma2)/2.0; | ||
91 | |||
92 | scalar sigma11 = a1_*Theta_[celli] + b1_*sigma1; | ||
93 | scalar sigma22 = a1_*Theta_[celli] + b1_*sigma2; | ||
94 | scalar sigma12 = b1_*(moments(1,1)[celli]/m00 - u*v); | ||
95 | |||
96 | Meq_(0,0) = moments(0,0)[celli]; | ||
97 | Meq_(1,0) = moments(1,0)[celli]; | ||
98 | Meq_(0,1) = moments(0,1)[celli]; | ||
99 | Meq_(2,0) = m00*(sigma11 + uSqr); | ||
100 | Meq_(1,1) = m00*(sigma12 + u*v); | ||
101 | Meq_(0,2) = m00*(sigma22 + vSqr); | ||
102 | Meq_(3,0) = m00*(3.0*sigma11*u + u*uSqr); | ||
103 | Meq_(0,3) = m00*(3.0*sigma22*v + v*vSqr); | ||
104 | Meq_(4,0) = m00*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
105 | Meq_(0,4) = m00*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
106 | } | ||
83 | Theta_[celli] /= nDimensions_; | ||
84 | sigma.xx() = a1_*Theta_[celli] + b1_*sigma1; | ||
107 | 85 | ||
108 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
109 | ::updateCells3D(const label celli) | ||
110 | { | ||
111 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
112 | scalar m000 = max(moments(0,0,0)[celli], SMALL); | ||
86 | if (nDimensions_ > 1) | ||
87 | { | ||
88 | sigma.yy() = a1_*Theta_[celli] + b1_*sigma2; | ||
89 | sigma.xy() = b1_*(moments(1,1)[celli]/m0 - u*v); | ||
90 | } | ||
113 | 91 | ||
114 | // Mean velocity | ||
115 | scalar u = meanVelocity(m000, moments(1,0,0)[celli]); | ||
116 | scalar v = meanVelocity(m000, moments(0,1,0)[celli]); | ||
117 | scalar w = meanVelocity(m000, moments(0,0,1)[celli]); | ||
118 | scalar uSqr = sqr(u); | ||
119 | scalar vSqr = sqr(v); | ||
120 | scalar wSqr = sqr(w); | ||
92 | if (nDimensions_ > 2) | ||
93 | { | ||
94 | sigma.zz() = a1_*Theta_[celli] + b1_*sigma3; | ||
95 | sigma.xz() = b1_*(moments(1,0,1)[celli]/m0 - u*w); | ||
96 | sigma.yz() = b1_*(moments(0,1,1)[celli]/m0 - v*w); | ||
97 | } | ||
121 | 98 | ||
122 | // Variances of velocities | ||
123 | scalar sigma1 = max(moments(2,0,0)[celli]/m000 - uSqr, 0.0); | ||
124 | scalar sigma2 = max(moments(0,2,0)[celli]/m000 - vSqr, 0.0); | ||
125 | scalar sigma3 = max(moments(0,0,2)[celli]/m000 - wSqr, 0.0); | ||
126 | Theta_[celli] = (sigma1 + sigma2 + sigma3)/3.0; | ||
127 | |||
128 | scalar sigma11 = a1_*Theta_[celli] + b1_*sigma1; | ||
129 | scalar sigma22 = a1_*Theta_[celli] + b1_*sigma2; | ||
130 | scalar sigma33 = a1_*Theta_[celli] + b1_*sigma3; | ||
131 | scalar sigma12 = b1_*(moments(1,1,0)[celli]/m000 - u*v); | ||
132 | scalar sigma13 = b1_*(moments(1,0,1)[celli]/m000 - u*w); | ||
133 | scalar sigma23 = b1_*(moments(0,1,1)[celli]/m000 - v*w); | ||
134 | |||
135 | Meq_(0,0,0) = moments(0,0,0)[celli]; | ||
136 | Meq_(1,0,0) = moments(1,0,0)[celli]; | ||
137 | Meq_(0,1,0) = moments(0,1,0)[celli]; | ||
138 | Meq_(0,0,1) = moments(0,0,1)[celli]; | ||
139 | Meq_(2,0,0) = m000*(sigma11 + uSqr); | ||
140 | Meq_(1,1,0) = m000*(sigma12 + u*v); | ||
141 | Meq_(1,0,1) = m000*(sigma13 + u*w); | ||
142 | Meq_(0,2,0) = m000*(sigma22 + vSqr); | ||
143 | Meq_(0,1,1) = m000*(sigma23 + v*w); | ||
144 | Meq_(0,0,2) = m000*(sigma33 + wSqr); | ||
145 | Meq_(3,0,0) = m000*(3.0*sigma11*u + u*uSqr); | ||
146 | Meq_(0,3,0) = m000*(3.0*sigma22*v + v*vSqr); | ||
147 | Meq_(0,0,3) = m000*(3.0*sigma33*w + w*wSqr); | ||
148 | Meq_(4,0,0) = m000*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
149 | Meq_(0,4,0) = m000*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
150 | Meq_(0,0,4) = m000*(6.0*wSqr*sigma33 + 3.0*sqr(sigma33) + wSqr*wSqr); | ||
99 | return sigma; | ||
151 | 100 | } | } |
152 | 101 | ||
153 | 102 | ||
154 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
155 | ::updateFields1D() | ||
103 | Foam::symmTensor | ||
104 | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision::covariance | ||
105 | ( | ||
106 | const mappedScalarList& moments, | ||
107 | const scalar& u, | ||
108 | const scalar& v, | ||
109 | const scalar& w | ||
110 | ) | ||
156 | 111 | { | { |
157 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
158 | volScalarField m0(max(moments(0), SMALL)); | ||
159 | |||
160 | // Mean velocity | ||
161 | volScalarField u(meanVelocity(m0, moments(1))); | ||
162 | volScalarField uSqr(sqr(u)); | ||
112 | symmTensor sigma(Zero); | ||
113 | scalar m0 = max(moments(0), SMALL); | ||
163 | 114 | ||
164 | 115 | // Variances of velocities | // Variances of velocities |
165 | dimensionedScalar zeroVar("zero", sqr(dimVelocity), 0.0); | ||
166 | volScalarField sigma(max(moments(2)/m0 - uSqr, zeroVar)); | ||
167 | volScalarField sigma1((a1_ + b1_)*sigma); | ||
168 | Theta_ = sigma1; | ||
169 | |||
170 | Meqf_(0) = moments(0); | ||
171 | Meqf_(1) = moments(1); | ||
172 | Meqf_(2) = m0*(sigma1 + uSqr); | ||
173 | Meqf_(3) = m0*(3.0*sigma1*u + u*uSqr); | ||
174 | Meqf_(4) = m0*(6.0*uSqr*sigma1 + 3.0*sqr(sigma1) + uSqr*uSqr); | ||
175 | } | ||
116 | scalar sigma1 = max(moments(2)/m0 - sqr(u), 0.0); | ||
117 | scalar sigma2 = 0.0; | ||
118 | scalar sigma3 = 0.0; | ||
119 | scalar Theta = sigma1; | ||
176 | 120 | ||
177 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
178 | ::updateFields2D() | ||
179 | { | ||
180 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
181 | volScalarField m00(max(moments(0,0), SMALL)); | ||
121 | if (nDimensions_ > 1) | ||
122 | { | ||
123 | sigma2 = max(moments(0,2)/m0 - sqr(v), 0.0); | ||
124 | Theta += sigma2; | ||
125 | } | ||
182 | 126 | ||
183 | // Mean velocity | ||
184 | volScalarField u(meanVelocity(m00, moments(1,0))); | ||
185 | volScalarField v(meanVelocity(m00, moments(0,1))); | ||
186 | volScalarField uSqr(sqr(u)); | ||
187 | volScalarField vSqr(sqr(v)); | ||
127 | if (nDimensions_ > 2) | ||
128 | { | ||
129 | sigma3 = max(moments(0,0,2)/m0 - sqr(w), 0.0); | ||
130 | Theta += sigma3; | ||
131 | } | ||
188 | 132 | ||
189 | // Variances of velocities | ||
190 | dimensionedScalar zeroVar("zero", sqr(dimVelocity), 0.0); | ||
191 | volScalarField sigma1(max(moments(2,0)/m00 - uSqr, zeroVar)); | ||
192 | volScalarField sigma2(max(moments(0,2)/m00 - vSqr, zeroVar)); | ||
193 | Theta_ = (sigma1 + sigma2)/2.0; | ||
194 | |||
195 | volScalarField sigma11(a1_*Theta_ + b1_*sigma1); | ||
196 | volScalarField sigma22(a1_*Theta_ + b1_*sigma2); | ||
197 | volScalarField sigma12(b1_*(moments(1,1)/m00 - u*v)); | ||
198 | |||
199 | Meqf_(0,0) = moments(0,0); | ||
200 | Meqf_(1,0) = moments(1,0); | ||
201 | Meqf_(0,1) = moments(0,1); | ||
202 | Meqf_(2,0) = m00*(sigma11 + uSqr); | ||
203 | Meqf_(1,1) = m00*(sigma12 + u*v); | ||
204 | Meqf_(0,2) = m00*(sigma22 + vSqr); | ||
205 | Meqf_(3,0) = m00*(3.0*sigma11*u + u*uSqr); | ||
206 | Meqf_(0,3) = m00*(3.0*sigma22*v + v*vSqr); | ||
207 | Meqf_(4,0) = m00*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
208 | Meqf_(0,4) = m00*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
209 | } | ||
133 | Theta /= nDimensions_; | ||
134 | sigma.xx() = a1_*Theta + b1_*sigma1; | ||
210 | 135 | ||
211 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
212 | ::updateFields3D() | ||
213 | { | ||
214 | const volVectorMomentFieldSet& moments = quadrature_.moments(); | ||
215 | volScalarField m000(max(moments(0,0,0), SMALL)); | ||
136 | if (nDimensions_ > 1) | ||
137 | { | ||
138 | sigma.yy() = a1_*Theta + b1_*sigma2; | ||
139 | sigma.xy() = b1_*(moments(1,1)/m0 - u*v); | ||
140 | } | ||
216 | 141 | ||
217 | // Mean velocity | ||
218 | volScalarField u(meanVelocity(m000, moments(1,0,0))); | ||
219 | volScalarField v(meanVelocity(m000, moments(0,1,0))); | ||
220 | volScalarField w(meanVelocity(m000, moments(0,0,1))); | ||
221 | volScalarField uSqr(sqr(u)); | ||
222 | volScalarField vSqr(sqr(v)); | ||
223 | volScalarField wSqr(sqr(w)); | ||
142 | if (nDimensions_ > 2) | ||
143 | { | ||
144 | sigma.zz() = a1_*Theta + b1_*sigma3; | ||
145 | sigma.xz() = b1_*(moments(1,0,1)/m0 - u*w); | ||
146 | sigma.yz() = b1_*(moments(0,1,1)/m0 - v*w); | ||
147 | } | ||
224 | 148 | ||
225 | // Variances of velocities | ||
226 | dimensionedScalar zeroVar("zero", sqr(dimVelocity), 0.0); | ||
227 | volScalarField sigma1(max(moments(2,0,0)/m000 - uSqr, zeroVar)); | ||
228 | volScalarField sigma2(max(moments(0,2,0)/m000 - vSqr, zeroVar)); | ||
229 | volScalarField sigma3(max(moments(0,0,2)/m000 - wSqr, zeroVar)); | ||
230 | Theta_ = (sigma1 + sigma2 + sigma3)/3.0; | ||
231 | |||
232 | volScalarField sigma11(a1_*Theta_ + b1_*sigma1); | ||
233 | volScalarField sigma22(a1_*Theta_ + b1_*sigma2); | ||
234 | volScalarField sigma33(a1_*Theta_ + b1_*sigma3); | ||
235 | volScalarField sigma12(b1_*(moments(1,1,0)/m000 - u*v)); | ||
236 | volScalarField sigma13(b1_*(moments(1,0,1)/m000 - u*w)); | ||
237 | volScalarField sigma23(b1_*(moments(0,1,1)/m000 - v*w)); | ||
238 | |||
239 | Meqf_(0,0,0) = moments(0,0,0); | ||
240 | Meqf_(1,0,0) = moments(1,0,0); | ||
241 | Meqf_(0,1,0) = moments(0,1,0); | ||
242 | Meqf_(0,0,1) = moments(0,0,1); | ||
243 | Meqf_(2,0,0) = m000*(sigma11 + uSqr); | ||
244 | Meqf_(1,1,0) = m000*(sigma12 + u*v); | ||
245 | Meqf_(1,0,1) = m000*(sigma13 + u*w); | ||
246 | Meqf_(0,2,0) = m000*(sigma22 + vSqr); | ||
247 | Meqf_(0,1,1) = m000*(sigma23 + v*w); | ||
248 | Meqf_(0,0,2) = m000*(sigma33 + wSqr); | ||
249 | Meqf_(3,0,0) = m000*(3.0*sigma11*u + u*uSqr); | ||
250 | Meqf_(0,3,0) = m000*(3.0*sigma22*v + v*vSqr); | ||
251 | Meqf_(0,0,3) = m000*(3.0*sigma33*w + w*wSqr); | ||
252 | Meqf_(4,0,0) = m000*(6.0*uSqr*sigma11 + 3.0*sqr(sigma11) + uSqr*uSqr); | ||
253 | Meqf_(0,4,0) = m000*(6.0*vSqr*sigma22 + 3.0*sqr(sigma22) + vSqr*vSqr); | ||
254 | Meqf_(0,0,4) = m000*(6.0*wSqr*sigma33 + 3.0*sqr(sigma33) + wSqr*wSqr); | ||
149 | return sigma; | ||
255 | 150 | } | } |
256 | 151 | ||
257 | |||
258 | 152 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
259 | 153 | ||
260 | 154 | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision |
... | ... | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | |
262 | 156 | ( | ( |
263 | 157 | const dictionary& dict, | const dictionary& dict, |
264 | 158 | const fvMesh& mesh, | const fvMesh& mesh, |
265 | const velocityQuadratureApproximation& quadrature, | ||
266 | const bool ode | ||
159 | const velocityQuadratureApproximation& quadrature | ||
267 | 160 | ) | ) |
268 | 161 | : | : |
269 | collisionKernel(dict, mesh, quadrature, ode), | ||
162 | BGKCollision(dict, mesh, quadrature), | ||
270 | 163 | e_(dict.lookupType<scalar>("e")), | e_(dict.lookupType<scalar>("e")), |
271 | 164 | b_(dict.lookupOrDefault<scalar>("b", 0)), | b_(dict.lookupOrDefault<scalar>("b", 0)), |
272 | 165 | Theta_ | Theta_ |
... | ... | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | |
280 | 173 | mesh, | mesh, |
281 | 174 | dimensionedScalar("0", sqr(dimVelocity), 0.0) | dimensionedScalar("0", sqr(dimVelocity), 0.0) |
282 | 175 | ), | ), |
283 | dp_("d", dimLength, dict), | ||
284 | zeta_(dict_.lookupOrDefault("zeta", 1.0)), | ||
285 | Meqf_(quadrature.moments().size(), momentOrders_), | ||
286 | Meq_(quadrature.moments().size(), momentOrders_) | ||
176 | zeta_(dict_.lookupOrDefault("zeta", 1.0)) | ||
287 | 177 | { | { |
288 | 178 | scalar omega = (1.0 + e_)/2.0; | scalar omega = (1.0 + e_)/2.0; |
289 | 179 | scalar gamma = 1.0 - b_; | scalar gamma = 1.0 - b_; |
290 | 180 | a1_ = gamma*sqr(omega); | a1_ = gamma*sqr(omega); |
291 | 181 | b1_ = a1_ - 2.0*gamma*omega + 1.0; | b1_ = a1_ - 2.0*gamma*omega + 1.0; |
292 | |||
293 | if (!ode) | ||
294 | { | ||
295 | forAll(Meqf_, mi) | ||
296 | { | ||
297 | const labelList& momentOrder = momentOrders_[mi]; | ||
298 | Meqf_.set | ||
299 | ( | ||
300 | momentOrder, | ||
301 | new volScalarField | ||
302 | ( | ||
303 | IOobject | ||
304 | ( | ||
305 | "Meq" + mappedList<scalar>::listToWord(momentOrder), | ||
306 | mesh_.time().timeName(), | ||
307 | mesh_ | ||
308 | ), | ||
309 | mesh_, | ||
310 | dimensionedScalar | ||
311 | ( | ||
312 | "zero", | ||
313 | quadrature.moments()[mi].dimensions(), | ||
314 | 0.0 | ||
315 | ) | ||
316 | ) | ||
317 | ); | ||
318 | } | ||
319 | } | ||
320 | 182 | } | } |
321 | 183 | ||
322 | 184 | ||
... | ... | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | |
329 | 191 | ||
330 | 192 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
331 | 193 | ||
332 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
333 | ::updateCells | ||
194 | Foam::scalar | ||
195 | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
196 | ::explicitCollisionSource | ||
334 | 197 | ( | ( |
198 | const labelList& momentOrder, | ||
335 | 199 | const label celli | const label celli |
336 | ) | ||
337 | { | ||
338 | if (nDimensions_ == 1) | ||
339 | { | ||
340 | updateCells1D(celli); | ||
341 | } | ||
342 | else if (nDimensions_ == 2) | ||
343 | { | ||
344 | updateCells2D(celli); | ||
345 | } | ||
346 | else if (nDimensions_ == 3) | ||
347 | { | ||
348 | updateCells3D(celli); | ||
349 | } | ||
350 | } | ||
351 | |||
352 | void Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
353 | ::updateFields() | ||
200 | ) const | ||
354 | 201 | { | { |
355 | if (nDimensions_ == 1) | ||
202 | if (implicit_) | ||
356 | 203 | { | { |
357 | updateFields1D(); | ||
204 | return 0.0; | ||
358 | 205 | } | } |
359 | else if (nDimensions_ == 2) | ||
206 | |||
207 | if (nSizes_ > 0) | ||
360 | 208 | { | { |
361 | updateFields2D(); | ||
209 | return Meq_(momentOrder)[celli]; | ||
362 | 210 | } | } |
363 | else if (nDimensions_ == 3) | ||
364 | { | ||
365 | updateFields3D(); | ||
366 | } | ||
367 | } | ||
368 | 211 | ||
369 | Foam::scalar | ||
370 | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | ||
371 | ::explicitCollisionSource(const label mi, const label celli) const | ||
372 | { | ||
373 | scalar c = quadrature_.moments()[0][celli]/0.63; | ||
212 | scalar c = quadrature_.moments()(0)[celli]/0.63; | ||
374 | 213 | scalar gs0 = (2.0 - c)/(2.0*pow3(1.0 - c)) + 1.1603*c; | scalar gs0 = (2.0 - c)/(2.0*pow3(1.0 - c)) + 1.1603*c; |
214 | |||
375 | 215 | scalar tauC = | scalar tauC = |
376 | zeta_*sqrt(Foam::constant::mathematical::pi)*dp_.value() | ||
216 | zeta_*sqrt(Foam::constant::mathematical::pi)*dp_()[celli] | ||
377 | 217 | /max | /max |
378 | 218 | ( | ( |
379 | 219 | 12.0*gs0*quadrature_.moments()[0][celli]*sqrt(Theta_[celli]), | 12.0*gs0*quadrature_.moments()[0][celli]*sqrt(Theta_[celli]), |
380 | 220 | 1e-10 | 1e-10 |
381 | 221 | ); | ); |
382 | 222 | ||
383 | return (Meq_[mi] - quadrature_.moments()[mi][celli])/tauC; | ||
223 | return | ||
224 | ( | ||
225 | Meq_(momentOrder)[celli] | ||
226 | - quadrature_.moments()(momentOrder)[celli] | ||
227 | )/tauC; | ||
384 | 228 | } | } |
385 | 229 | ||
386 | 230 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
387 | 231 | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision |
388 | ::implicitCollisionSource(const volVectorMoment& m) const | ||
232 | ::implicitCollisionSource(const volVelocityMoment& m) const | ||
389 | 233 | { | { |
234 | if (!implicit_) | ||
235 | { | ||
236 | return tmp<fvScalarMatrix> | ||
237 | ( | ||
238 | new fvScalarMatrix | ||
239 | ( | ||
240 | m, | ||
241 | m.dimensions()*dimVolume/dimTime | ||
242 | ) | ||
243 | ); | ||
244 | } | ||
245 | |||
390 | 246 | volScalarField c(quadrature_.moments()[0]/0.63); | volScalarField c(quadrature_.moments()[0]/0.63); |
391 | 247 | volScalarField gs0((2.0 - c)/(2.0*pow3(1.0 - c)) + 1.1603*c); | volScalarField gs0((2.0 - c)/(2.0*pow3(1.0 - c)) + 1.1603*c); |
392 | 248 | volScalarField tauC | volScalarField tauC |
393 | 249 | ( | ( |
394 | zeta_*sqrt(Foam::constant::mathematical::pi)*dp_ | ||
250 | zeta_*sqrt(Foam::constant::mathematical::pi)*dp_() | ||
395 | 251 | /max | /max |
396 | 252 | ( | ( |
397 | 253 | 12.0*gs0*quadrature_.moments()[0]*sqrt(Theta_), | 12.0*gs0*quadrature_.moments()[0]*sqrt(Theta_), |
... | ... | Foam::populationBalanceSubModels::collisionKernels::esBGKCollision | |
401 | 257 | ||
402 | 258 | return | return |
403 | 259 | ( | ( |
404 | Meqf_(m.cmptOrders())/tauC | ||
260 | Meq_(m.cmptOrders())/tauC | ||
405 | 261 | - fvm::Sp(1/tauC, m) | - fvm::Sp(1/tauC, m) |
406 | 262 | ); | ); |
407 | 263 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/esBGKCollision/esBGKCollision.H changed (mode: 100644) (index ada6e4f..a5a1e0a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
36 | 36 | #ifndef esBGKCollision_H | #ifndef esBGKCollision_H |
37 | 37 | #define esBGKCollision_H | #define esBGKCollision_H |
38 | 38 | ||
39 | #include "collisionKernel.H" | ||
39 | #include "BGKCollision.H" | ||
40 | 40 | #include "mappedPtrList.H" | #include "mappedPtrList.H" |
41 | 41 | ||
42 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
... | ... | namespace collisionKernels | |
54 | 54 | ||
55 | 55 | class esBGKCollision | class esBGKCollision |
56 | 56 | : | : |
57 | public collisionKernel | ||
57 | public BGKCollision | ||
58 | 58 | { | { |
59 | 59 | // Private data | // Private data |
60 | 60 | ||
... | ... | class esBGKCollision | |
73 | 73 | //- Reference to radial distribution | //- Reference to radial distribution |
74 | 74 | // autoPtr<radialDistributionModel> radialModel_; | // autoPtr<radialDistributionModel> radialModel_; |
75 | 75 | ||
76 | //- Diameter | ||
77 | dimensionedScalar dp_; | ||
78 | |||
79 | 76 | //- Coefficient related to Prandtl number | //- Coefficient related to Prandtl number |
80 | 77 | scalar zeta_; | scalar zeta_; |
81 | 78 | ||
82 | 79 | ||
83 | 80 | protected: | protected: |
84 | // Protected data | ||
85 | |||
86 | //- Equilibrium moments (fields) | ||
87 | mappedPtrList<volScalarField> Meqf_; | ||
88 | |||
89 | //- Equilibrium moments (fields) | ||
90 | mappedList<scalar> Meq_; | ||
91 | |||
92 | |||
93 | // Protected functions | ||
94 | |||
95 | //- Update equilibrium moments for a cell (1D) | ||
96 | void updateCells1D(const label celli); | ||
97 | |||
98 | //- Update equilibrium moments for a cell (2D) | ||
99 | void updateCells2D(const label celli); | ||
100 | 81 | ||
101 | //- Update equilibrium moments for a cell (3D) | ||
102 | void updateCells3D(const label celli); | ||
82 | // Protected Functions | ||
103 | 83 | ||
104 | //- Update equilibrium moments for fields (1D) | ||
105 | void updateFields1D(); | ||
84 | //- Return the covariance tensor using quadrature moments | ||
85 | virtual symmTensor covariance | ||
86 | ( | ||
87 | const label celli, | ||
88 | const scalar& u, | ||
89 | const scalar& v, | ||
90 | const scalar& w | ||
91 | ); | ||
106 | 92 | ||
107 | //- Update equilibrium moments for fields (2D) | ||
108 | void updateFields2D(); | ||
93 | //- Return the covariance tensor given a list of moments | ||
94 | virtual symmTensor covariance | ||
95 | ( | ||
96 | const mappedScalarList& moments, | ||
97 | const scalar& u, | ||
98 | const scalar& v, | ||
99 | const scalar& w | ||
100 | ); | ||
109 | 101 | ||
110 | //- Update equilibrium moments for fields (3D) | ||
111 | void updateFields3D(); | ||
102 | //- Return the coefficient of restitution | ||
103 | virtual scalar e() const | ||
104 | { | ||
105 | return e_; | ||
106 | } | ||
112 | 107 | ||
113 | 108 | ||
114 | 109 | public: | public: |
... | ... | public: | |
124 | 119 | ( | ( |
125 | 120 | const dictionary& dict, | const dictionary& dict, |
126 | 121 | const fvMesh& mesh, | const fvMesh& mesh, |
127 | const velocityQuadratureApproximation& quadrature, | ||
128 | const bool ode | ||
122 | const velocityQuadratureApproximation& quadrature | ||
129 | 123 | ); | ); |
130 | 124 | ||
131 | 125 | ||
... | ... | public: | |
135 | 129 | ||
136 | 130 | // Member Functions | // Member Functions |
137 | 131 | ||
138 | //- Update equilibrium moments | ||
139 | virtual void updateCells(const label celli); | ||
140 | |||
141 | //- Update equilibrium moments | ||
142 | virtual void updateFields(); | ||
143 | |||
144 | 132 | //- Return explicit collision source term | //- Return explicit collision source term |
145 | 133 | virtual scalar explicitCollisionSource | virtual scalar explicitCollisionSource |
146 | 134 | ( | ( |
147 | const label mi, | ||
135 | const labelList& momentOrder, | ||
148 | 136 | const label celli | const label celli |
149 | 137 | ) const; | ) const; |
150 | 138 | ||
151 | 139 | //- Return implicit collision source matrix | //- Return implicit collision source matrix |
152 | 140 | virtual tmp<fvScalarMatrix> implicitCollisionSource | virtual tmp<fvScalarMatrix> implicitCollisionSource |
153 | 141 | ( | ( |
154 | const volVectorMoment& m | ||
142 | const volVelocityMoment& m | ||
155 | 143 | ) const; | ) const; |
156 | 144 | ||
157 | 145 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/noCollision/noCollision.C changed (mode: 100644) (index 3295fc1..455225f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::collisionKernels::noCollision::noCollision | |
54 | 54 | ( | ( |
55 | 55 | const dictionary& dict, | const dictionary& dict, |
56 | 56 | const fvMesh& mesh, | const fvMesh& mesh, |
57 | const velocityQuadratureApproximation& quadrature, | ||
58 | const bool ode | ||
57 | const velocityQuadratureApproximation& quadrature | ||
59 | 58 | ) | ) |
60 | 59 | : | : |
61 | collisionKernel(dict, mesh, quadrature, ode) | ||
60 | collisionKernel(dict, mesh, quadrature) | ||
62 | 61 | {} | {} |
63 | 62 | ||
64 | 63 | ||
... | ... | void Foam::populationBalanceSubModels::collisionKernels::noCollision | |
74 | 73 | ::updateCells(const label celli) | ::updateCells(const label celli) |
75 | 74 | {} | {} |
76 | 75 | ||
77 | void | ||
78 | Foam::populationBalanceSubModels::collisionKernels::noCollision::updateFields() | ||
79 | {} | ||
80 | 76 | ||
81 | 77 | Foam::scalar | Foam::scalar |
82 | 78 | Foam::populationBalanceSubModels::collisionKernels::noCollision | Foam::populationBalanceSubModels::collisionKernels::noCollision |
83 | ::explicitCollisionSource(const label mi, const label celli) const | ||
79 | ::explicitCollisionSource(const labelList&, const label) const | ||
84 | 80 | { | { |
85 | 81 | return 0.0; | return 0.0; |
86 | 82 | } | } |
87 | 83 | ||
84 | |||
88 | 85 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
89 | 86 | Foam::populationBalanceSubModels::collisionKernels::noCollision | Foam::populationBalanceSubModels::collisionKernels::noCollision |
90 | ::implicitCollisionSource(const volVectorMoment& m) const | ||
87 | ::implicitCollisionSource(const volVelocityMoment& m) const | ||
91 | 88 | { | { |
92 | 89 | return tmp<fvScalarMatrix> | return tmp<fvScalarMatrix> |
93 | 90 | ( | ( |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/collisionKernels/noCollision/noCollision.H changed (mode: 100644) (index efa1164..4b18901) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
69 | 69 | ( | ( |
70 | 70 | const dictionary& dict, | const dictionary& dict, |
71 | 71 | const fvMesh& mesh, | const fvMesh& mesh, |
72 | const velocityQuadratureApproximation& quadrature, | ||
73 | const bool ode | ||
72 | const velocityQuadratureApproximation& quadrature | ||
74 | 73 | ); | ); |
75 | 74 | ||
76 | 75 | ||
... | ... | public: | |
83 | 82 | //- Update equilibrium moments | //- Update equilibrium moments |
84 | 83 | virtual void updateCells(const label celli); | virtual void updateCells(const label celli); |
85 | 84 | ||
86 | //- Update equilibrium moments | ||
87 | virtual void updateFields(); | ||
88 | |||
89 | 85 | //- Return explicit collision source term | //- Return explicit collision source term |
90 | 86 | virtual scalar explicitCollisionSource | virtual scalar explicitCollisionSource |
91 | 87 | ( | ( |
92 | const label mi, | ||
88 | const labelList& momentOrder, | ||
93 | 89 | const label celli | const label celli |
94 | 90 | ) const; | ) const; |
95 | 91 | ||
96 | 92 | //- Return implicit collision source matrix | //- Return implicit collision source matrix |
97 | 93 | virtual tmp<fvScalarMatrix> implicitCollisionSource | virtual tmp<fvScalarMatrix> implicitCollisionSource |
98 | 94 | ( | ( |
99 | const volVectorMoment& m | ||
95 | const volVelocityMoment& m | ||
100 | 96 | ) const; | ) const; |
101 | 97 | ||
102 | 98 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.C changed (mode: 100644) (index cc7d8a1..014fbe2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.H changed (mode: 100644) (index 6777b3d..77fd919) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
54 | 54 | ||
55 | 55 | class daughterDistribution | class daughterDistribution |
56 | 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 | 57 | protected: | protected: |
67 | 58 | ||
68 | 59 | // Protected data | // Protected data |
... | ... | public: | |
93 | 84 | //- Construct from components | //- Construct from components |
94 | 85 | daughterDistribution(const dictionary& dict); | daughterDistribution(const dictionary& dict); |
95 | 86 | ||
87 | //- Disallow default bitwise copy construct | ||
88 | daughterDistribution(const daughterDistribution&) = delete; | ||
89 | |||
96 | 90 | ||
97 | 91 | // Selectors | // Selectors |
98 | 92 | ||
... | ... | public: | |
121 | 115 | const label& order, | const label& order, |
122 | 116 | const scalar& abscissa | const scalar& abscissa |
123 | 117 | ) const = 0; | ) const = 0; |
118 | |||
119 | |||
120 | // Member Operators | ||
121 | |||
122 | //- Disallow default bitwise assignment | ||
123 | void operator=(const daughterDistribution&) = delete; | ||
124 | 124 | }; | }; |
125 | 125 | ||
126 | 126 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/newDaughterDistribution.C changed (mode: 100644) (index 47a327f..07b7dfe) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::daughterDistribution::New | |
33 | 33 | const dictionary& dict | const dictionary& dict |
34 | 34 | ) | ) |
35 | 35 | { | { |
36 | word daughterDistributionType(dict.lookup("daughterDistribution")); | ||
36 | word daughterDistributionType | ||
37 | ( | ||
38 | dict.lookup("daughterDistribution") | ||
39 | ); | ||
37 | 40 | ||
38 | 41 | Info<< "Selecting daughterDistribution " | Info<< "Selecting daughterDistribution " |
39 | 42 | << daughterDistributionType << endl; | << daughterDistributionType << endl; |
... | ... | Foam::populationBalanceSubModels::daughterDistribution::New | |
51 | 54 | << abort(FatalError); | << abort(FatalError); |
52 | 55 | } | } |
53 | 56 | ||
54 | return autoPtr<daughterDistribution>(cstrIter()(dict)); | ||
57 | return | ||
58 | autoPtr<daughterDistribution> | ||
59 | ( | ||
60 | cstrIter()(dict) | ||
61 | ); | ||
55 | 62 | } | } |
56 | 63 | ||
57 | 64 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/erosion/erosion.C changed (mode: 100644) (index d4e894f..f624355) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/erosion/erosion.H changed (mode: 100644) (index 941924d..fdbc1ec) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.C changed (mode: 100644) (index 3a0ba38..699193f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.H changed (mode: 100644) (index ce0c054..0102e63) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.C changed (mode: 100644) (index 8b028fb..368a189) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.H changed (mode: 100644) (index fd2aae4..56d140d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.C changed (mode: 100644) (index 080a425..6303e8b) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.H changed (mode: 100644) (index de1f761..ef68ac2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/uniform/uniform.C changed (mode: 100644) (index 949c2cf..8545952) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/uniform/uniform.H changed (mode: 100644) (index c82c2b9..910a972) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.C changed (mode: 100644) (index f1adc0f..8e15a0d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.H changed (mode: 100644) (index d55cd78..ff7e41e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
54 | 54 | ||
55 | 55 | class diffusionModel | class diffusionModel |
56 | 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 | 57 | protected: | protected: |
67 | 58 | ||
68 | 59 | // Protected data | // Protected data |
... | ... | public: | |
93 | 84 | //- Construct from components | //- Construct from components |
94 | 85 | diffusionModel(const dictionary& dict); | diffusionModel(const dictionary& dict); |
95 | 86 | ||
87 | //- Disallow default bitwise copy construct | ||
88 | diffusionModel(const diffusionModel&) = delete; | ||
89 | |||
96 | 90 | ||
97 | 91 | // Selectors | // Selectors |
98 | 92 | ||
... | ... | public: | |
113 | 107 | ( | ( |
114 | 108 | const volScalarField& moment | const volScalarField& moment |
115 | 109 | ) const = 0; | ) const = 0; |
110 | |||
111 | |||
112 | // Member Operators | ||
113 | |||
114 | //- Disallow default bitwise assignment | ||
115 | void operator=(const diffusionModel&) = delete; | ||
116 | 116 | }; | }; |
117 | 117 | ||
118 | 118 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/newDiffusionModel.C changed (mode: 100644) (index df298ee..6cd1b52) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.C changed (mode: 100644) (index 1437979..17d047f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.H changed (mode: 100644) (index a1ec9d9..ae673aa) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C changed (mode: 100644) (index e3f6e81..2189bc6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion | |
59 | 59 | ) | ) |
60 | 60 | : | : |
61 | 61 | diffusionModel(dict), | diffusionModel(dict), |
62 | continuousPhase_(dict.lookupOrDefault("continuousPhase", word::null)), | ||
62 | 63 | gammaLam_(dict.lookup("gammaLam")), | gammaLam_(dict.lookup("gammaLam")), |
63 | 64 | Sc_(readScalar(dict.lookup("Sc"))) | Sc_(readScalar(dict.lookup("Sc"))) |
64 | 65 | {} | {} |
... | ... | Foam::tmp<Foam::volScalarField> | |
89 | 90 | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion | Foam::populationBalanceSubModels::diffusionModels::turbulentDiffusion |
90 | 91 | ::turbViscosity(const volScalarField& moment) const | ::turbViscosity(const volScalarField& moment) const |
91 | 92 | { | { |
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 | ) | ||
93 | word turbName = IOobject::groupName | ||
94 | ( | ||
95 | turbulenceModel::propertiesName, | ||
96 | continuousPhase_ | ||
97 | ); | ||
98 | |||
99 | if (moment.mesh().foundObject<turbulenceModel>(turbName)) | ||
109 | 100 | { | { |
110 | const incompressible::turbulenceModel& turb = | ||
111 | moment.mesh().lookupObject<icoTurbModel> | ||
112 | ( | ||
113 | icoTurbModel::propertiesName | ||
114 | ); | ||
101 | const turbulenceModel& turb = | ||
102 | moment.mesh().lookupObject<turbulenceModel>(turbName); | ||
115 | 103 | ||
116 | 104 | return turb.nut(); | return turb.nut(); |
117 | 105 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.H changed (mode: 100644) (index 53ce8d5..84eb21d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | class turbulentDiffusion | |
76 | 76 | ||
77 | 77 | //- Private data | //- Private data |
78 | 78 | ||
79 | //- Continuous phase name | ||
80 | const word continuousPhase_; | ||
81 | |||
79 | 82 | //- Laminar diffusivity | //- Laminar diffusivity |
80 | 83 | dimensionedScalar gammaLam_; | dimensionedScalar gammaLam_; |
81 | 84 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/environmentMixingModels/IEM/IEM.C changed (mode: 100644) (index 6afdbf9..99d42f3) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/environmentMixingModels/IEM/IEM.H changed (mode: 100644) (index e4a5562..8126b45) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/environmentMixingModels/environmentMixingModel/environmentMixingModel.C changed (mode: 100644) (index d93f0e0..54ea3cd) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/environmentMixingModels/environmentMixingModel/environmentMixingModel.H changed (mode: 100644) (index bfdbc2a..a3e5722) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
56 | 56 | ||
57 | 57 | class environmentMixingModel | class environmentMixingModel |
58 | 58 | { | { |
59 | // Private member functions | ||
60 | |||
61 | //- Disallow default bitwise copy construct | ||
62 | environmentMixingModel(const environmentMixingModel&); | ||
63 | |||
64 | //- Disallow default bitwise assignment | ||
65 | void operator=(const environmentMixingModel&); | ||
66 | |||
67 | |||
68 | 59 | protected: | protected: |
69 | 60 | ||
70 | 61 | // Protected data | // Protected data |
... | ... | public: | |
107 | 98 | const fvMesh& mesh | const fvMesh& mesh |
108 | 99 | ); | ); |
109 | 100 | ||
101 | //- Disallow default bitwise copy construct | ||
102 | environmentMixingModel(const environmentMixingModel&) = delete; | ||
103 | |||
110 | 104 | ||
111 | 105 | // Selectors | // Selectors |
112 | 106 | ||
... | ... | public: | |
130 | 124 | const volScalarField& meanMomentVariance, | const volScalarField& meanMomentVariance, |
131 | 125 | const volScalarField& meanMixtureFraction | const volScalarField& meanMixtureFraction |
132 | 126 | ) const = 0; | ) const = 0; |
127 | |||
128 | |||
129 | // Member Operators | ||
130 | |||
131 | //- Disallow default bitwise assignment | ||
132 | void operator=(const environmentMixingModel&) = delete; | ||
133 | 133 | }; | }; |
134 | 134 | ||
135 | 135 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/environmentMixingModels/environmentMixingModel/newEnvironmentMixingModel.C changed (mode: 100644) (index 9f8d613..631d93c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C changed (mode: 100644) (index 0111168..01fd3cd) | |||
... | ... | Foam::populationBalanceSubModels::growthModels::constantGrowth | |
58 | 58 | ) | ) |
59 | 59 | : | : |
60 | 60 | growthModel(dict), | growthModel(dict), |
61 | minAbscissa_(dict.lookup("minAbscissa")), | ||
62 | maxAbscissa_(dict.lookup("maxAbscissa")) | ||
61 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 0.0)), | ||
62 | maxAbscissa_(dict.lookupOrDefault("maxAbscissa", great)) | ||
63 | 63 | {} | {} |
64 | 64 | ||
65 | 65 | ||
... | ... | Foam::scalar | |
76 | 76 | Foam::populationBalanceSubModels::growthModels::constantGrowth::Kg | Foam::populationBalanceSubModels::growthModels::constantGrowth::Kg |
77 | 77 | ( | ( |
78 | 78 | const scalar& abscissa, | const scalar& abscissa, |
79 | const bool lengthBased, | ||
79 | 80 | const label environment | const label environment |
80 | 81 | ) const | ) const |
81 | 82 | { | { |
82 | return Cg_.value()*pos0(-abscissa + maxAbscissa_.value()) | ||
83 | *pos0(abscissa - minAbscissa_.value()); | ||
83 | return Cg_.value()*pos0(-abscissa + maxAbscissa_) | ||
84 | *pos0(abscissa - minAbscissa_); | ||
84 | 85 | } | } |
85 | 86 | ||
86 | 87 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.H changed (mode: 100644) (index ae595cf..f4de1d6) | |||
... | ... | private: | |
64 | 64 | // Private data | // Private data |
65 | 65 | ||
66 | 66 | //- Minimum value of the abscissa to apply the model | //- Minimum value of the abscissa to apply the model |
67 | dimensionedScalar minAbscissa_; | ||
67 | scalar minAbscissa_; | ||
68 | 68 | ||
69 | 69 | //- Maximum value of the abscissa to apply the model | //- Maximum value of the abscissa to apply the model |
70 | dimensionedScalar maxAbscissa_; | ||
70 | scalar maxAbscissa_; | ||
71 | 71 | ||
72 | 72 | public: | public: |
73 | 73 | ||
... | ... | public: | |
91 | 91 | virtual scalar Kg | virtual scalar Kg |
92 | 92 | ( | ( |
93 | 93 | const scalar& abscissa, | const scalar& abscissa, |
94 | const bool lengthBased, | ||
94 | 95 | const label environment = 0 | const label environment = 0 |
95 | 96 | ) const; | ) const; |
96 | 97 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/growthModel.C changed (mode: 100644) (index 6a1bb1e..a11d373) | |||
... | ... | Foam::populationBalanceSubModels::growthModel::growthModel | |
48 | 48 | dict_(dict), | dict_(dict), |
49 | 49 | Cg_ | Cg_ |
50 | 50 | ( | ( |
51 | dict.lookupOrDefault | ||
51 | dimensionedScalar::lookupOrDefault | ||
52 | 52 | ( | ( |
53 | 53 | "Cg", | "Cg", |
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
54 | dict, | ||
55 | inv(dimTime), | ||
56 | 1.0 | ||
55 | 57 | ) | ) |
56 | 58 | ) | ) |
57 | 59 | {} | {} |
... | ... | Foam::populationBalanceSubModels::growthModel::~growthModel() | |
63 | 65 | {} | {} |
64 | 66 | ||
65 | 67 | ||
68 | Foam::scalar | ||
69 | Foam::populationBalanceSubModels::growthModel::phaseSpaceConvection | ||
70 | ( | ||
71 | const labelList& momentOrder, | ||
72 | const label celli, | ||
73 | const scalarQuadratureApproximation& quadrature | ||
74 | ) | ||
75 | { | ||
76 | scalar gSource = 0.0; | ||
77 | |||
78 | const PtrList<volScalarNode>& nodes = quadrature.nodes(); | ||
79 | label sizeIndex = nodes[0].sizeIndex(); | ||
80 | |||
81 | if (sizeIndex == -1) | ||
82 | { | ||
83 | return gSource; | ||
84 | } | ||
85 | label sizeOrder = momentOrder[sizeIndex]; | ||
86 | |||
87 | |||
88 | bool lengthBased = nodes[0].lengthBased(); | ||
89 | bool volumeFraction = nodes[0].useVolumeFraction(); | ||
90 | if (volumeFraction) | ||
91 | { | ||
92 | if (lengthBased) | ||
93 | { | ||
94 | sizeOrder += 3; | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | sizeOrder += 1; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | if (sizeOrder < 1) | ||
103 | { | ||
104 | return gSource; | ||
105 | } | ||
106 | |||
107 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
108 | |||
109 | if (!nodes[0].extended()) | ||
110 | { | ||
111 | forAll(nodes, pNodeI) | ||
112 | { | ||
113 | const volScalarNode& node = nodes[pNodeI]; | ||
114 | |||
115 | scalar bAbscissa = | ||
116 | max(node.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
117 | scalar d = node.d(celli, bAbscissa); | ||
118 | scalar n = | ||
119 | node.n(celli, node.primaryWeight()[celli], bAbscissa); | ||
120 | |||
121 | scalar gSourcei = | ||
122 | n | ||
123 | *Kg(d, lengthBased) | ||
124 | *sizeOrder | ||
125 | *pow(bAbscissa, sizeOrder - 1); | ||
126 | |||
127 | forAll(scalarIndexes, nodei) | ||
128 | { | ||
129 | if (scalarIndexes[nodei] != sizeIndex) | ||
130 | { | ||
131 | gSourcei *= | ||
132 | pow | ||
133 | ( | ||
134 | node.primaryAbscissae()[nodei][celli], | ||
135 | momentOrder[scalarIndexes[nodei]] | ||
136 | ); | ||
137 | } | ||
138 | } | ||
139 | gSource += gSourcei; | ||
140 | } | ||
141 | |||
142 | return gSource; | ||
143 | } | ||
144 | |||
145 | forAll(nodes, pNodeI) | ||
146 | { | ||
147 | const volScalarNode& node = nodes[pNodeI]; | ||
148 | |||
149 | forAll(node.secondaryWeights()[sizeIndex], sNodei) | ||
150 | { | ||
151 | scalar bAbscissa = | ||
152 | max(node.secondaryAbscissae()[sizeIndex][sNodei][celli], 0.0); | ||
153 | scalar d = node.d(celli, bAbscissa); | ||
154 | scalar n = | ||
155 | node.n(celli, node.primaryWeight()[celli], bAbscissa) | ||
156 | *node.secondaryWeights()[sizeIndex][sNodei][celli]; | ||
157 | |||
158 | scalar gSourcei = | ||
159 | n | ||
160 | *Kg(d, lengthBased) | ||
161 | *sizeOrder | ||
162 | *pow(bAbscissa, sizeOrder - 1); | ||
163 | |||
164 | forAll(scalarIndexes, cmpt) | ||
165 | { | ||
166 | if (scalarIndexes[cmpt] != sizeIndex) | ||
167 | { | ||
168 | gSourcei *= | ||
169 | node.secondaryWeights()[cmpt][sNodei][celli] | ||
170 | *pow | ||
171 | ( | ||
172 | node.secondaryAbscissae()[cmpt][sNodei][celli], | ||
173 | momentOrder[scalarIndexes[cmpt]] | ||
174 | ); | ||
175 | } | ||
176 | } | ||
177 | gSource += gSourcei; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | return gSource; | ||
182 | } | ||
183 | |||
184 | Foam::scalar | ||
185 | Foam::populationBalanceSubModels::growthModel::phaseSpaceConvection | ||
186 | ( | ||
187 | const labelList& momentOrder, | ||
188 | const label celli, | ||
189 | const velocityQuadratureApproximation& quadrature | ||
190 | ) | ||
191 | { | ||
192 | scalar gSource = 0.0; | ||
193 | |||
194 | const PtrList<volVelocityNode>& nodes = quadrature.nodes(); | ||
195 | label sizeIndex = nodes[0].sizeIndex(); | ||
196 | |||
197 | if (sizeIndex == -1) | ||
198 | { | ||
199 | return gSource; | ||
200 | } | ||
201 | label sizeOrder = momentOrder[sizeIndex]; | ||
202 | |||
203 | bool lengthBased = nodes[0].lengthBased(); | ||
204 | bool volumeFraction = nodes[0].useVolumeFraction(); | ||
205 | if (volumeFraction) | ||
206 | { | ||
207 | if (lengthBased) | ||
208 | { | ||
209 | sizeOrder += 3; | ||
210 | } | ||
211 | else | ||
212 | { | ||
213 | sizeOrder += 1; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | if (sizeOrder < 1) | ||
218 | { | ||
219 | return gSource; | ||
220 | } | ||
221 | |||
222 | const labelList& scalarIndexes = nodes[0].scalarIndexes(); | ||
223 | const labelList& velocityIndexes = nodes[0].velocityIndexes(); | ||
224 | |||
225 | forAll(nodes, pNodeI) | ||
226 | { | ||
227 | const volVelocityNode& node = nodes[pNodeI]; | ||
228 | |||
229 | scalar bAbscissa = | ||
230 | max(node.primaryAbscissae()[sizeIndex][celli], 0.0); | ||
231 | scalar d = node.d(celli, bAbscissa); | ||
232 | scalar n = | ||
233 | node.n(celli, node.primaryWeight()[celli], bAbscissa); | ||
234 | |||
235 | scalar gSourcei = | ||
236 | n*Kg(d, lengthBased)*sizeOrder*pow(bAbscissa, sizeOrder - 1); | ||
237 | |||
238 | forAll(scalarIndexes, nodei) | ||
239 | { | ||
240 | if (scalarIndexes[nodei] != sizeIndex) | ||
241 | { | ||
242 | gSourcei *= | ||
243 | pow | ||
244 | ( | ||
245 | node.primaryAbscissae()[nodei][celli], | ||
246 | momentOrder[scalarIndexes[nodei]] | ||
247 | ); | ||
248 | } | ||
249 | } | ||
250 | forAll(velocityIndexes, cmpt) | ||
251 | { | ||
252 | gSourcei *= | ||
253 | pow | ||
254 | ( | ||
255 | node.velocityAbscissae()[celli][cmpt], | ||
256 | momentOrder[velocityIndexes[cmpt]] | ||
257 | ); | ||
258 | } | ||
259 | gSource += gSourcei; | ||
260 | } | ||
261 | |||
262 | return gSource; | ||
263 | } | ||
264 | |||
265 | |||
66 | 266 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/growthModel.H changed (mode: 100644) (index b15d994..a0b0478) | |||
... | ... | SourceFiles | |
39 | 39 | #include "volFields.H" | #include "volFields.H" |
40 | 40 | #include "dimensionedTypes.H" | #include "dimensionedTypes.H" |
41 | 41 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
42 | #include "quadratureApproximations.H" | ||
42 | 43 | ||
43 | 44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 45 | ||
... | ... | namespace populationBalanceSubModels | |
53 | 54 | ||
54 | 55 | class growthModel | class growthModel |
55 | 56 | { | { |
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 | 57 | protected: | protected: |
66 | 58 | ||
67 | 59 | // Protected data | // Protected data |
... | ... | public: | |
95 | 87 | //- Construct from components | //- Construct from components |
96 | 88 | growthModel(const dictionary& dict); | growthModel(const dictionary& dict); |
97 | 89 | ||
90 | //- Disallow default bitwise copy construct | ||
91 | growthModel(const growthModel&) = delete; | ||
92 | |||
98 | 93 | ||
99 | 94 | // Selectors | // Selectors |
100 | 95 | ||
... | ... | public: | |
108 | 103 | virtual ~growthModel(); | virtual ~growthModel(); |
109 | 104 | ||
110 | 105 | ||
106 | //- Return the derivative of length with respect to volume | ||
107 | static scalar dDdV(const scalar& d) | ||
108 | { | ||
109 | return | ||
110 | 2.0 | ||
111 | /max(Foam::constant::mathematical::pi*sqr(d), small); | ||
112 | } | ||
113 | |||
111 | 114 | // Member Functions | // Member Functions |
112 | 115 | ||
113 | 116 | //- Growth model | //- Growth model |
114 | 117 | virtual scalar Kg | virtual scalar Kg |
115 | 118 | ( | ( |
116 | 119 | const scalar& abscissa, | const scalar& abscissa, |
120 | const bool lengthBased, | ||
117 | 121 | const label environment = 0 | const label environment = 0 |
118 | 122 | ) const = 0; | ) const = 0; |
123 | |||
124 | //- Return phase space convection | ||
125 | scalar phaseSpaceConvection | ||
126 | ( | ||
127 | const labelList& momentOrder, | ||
128 | const label celli, | ||
129 | const scalarQuadratureApproximation& quadrature | ||
130 | ); | ||
131 | |||
132 | //- Return phase space convection | ||
133 | scalar phaseSpaceConvection | ||
134 | ( | ||
135 | const labelList& momentOrder, | ||
136 | const label celli, | ||
137 | const velocityQuadratureApproximation& quadrature | ||
138 | ); | ||
139 | |||
140 | |||
141 | // Member Operators | ||
142 | |||
143 | //- Disallow default bitwise assignment | ||
144 | void operator=(const growthModel&) = delete; | ||
119 | 145 | }; | }; |
120 | 146 | ||
121 | 147 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/linearEvaporation/linearEvaporation.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.C (similarity 70%) (mode: 100644) (index d59309b..1ac0c2e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "constantAggregation.H" | ||
26 | #include "linearEvaporation.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "fundamentalConstants.H" | ||
28 | 29 | ||
29 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
30 | 31 | ||
... | ... | namespace Foam | |
32 | 33 | { | { |
33 | 34 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
34 | 35 | { | { |
35 | namespace aggregationKernels | ||
36 | namespace growthModels | ||
36 | 37 | { | { |
37 | defineTypeNameAndDebug(constantAggregation, 0); | ||
38 | defineTypeNameAndDebug(linearEvaporation, 0); | ||
38 | 39 | ||
39 | 40 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
40 | 41 | ( | ( |
41 | aggregationKernel, | ||
42 | constantAggregation, | ||
42 | growthModel, | ||
43 | linearEvaporation, | ||
43 | 44 | dictionary | dictionary |
44 | 45 | ); | ); |
45 | 46 | } | } |
... | ... | namespace aggregationKernels | |
49 | 50 | ||
50 | 51 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
51 | 52 | ||
52 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
53 | ::constantAggregation | ||
53 | Foam::populationBalanceSubModels::growthModels::linearEvaporation | ||
54 | ::linearEvaporation | ||
54 | 55 | ( | ( |
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | const dictionary& dict | ||
57 | 57 | ) | ) |
58 | 58 | : | : |
59 | aggregationKernel(dict, mesh) | ||
59 | growthModel(dict) | ||
60 | 60 | {} | {} |
61 | 61 | ||
62 | 62 | ||
63 | 63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
64 | 64 | ||
65 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
66 | ::~constantAggregation() | ||
65 | Foam::populationBalanceSubModels::growthModels::linearEvaporation:: | ||
66 | ~linearEvaporation() | ||
67 | 67 | {} | {} |
68 | 68 | ||
69 | 69 | ||
70 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
71 | 71 | ||
72 | 72 | Foam::scalar | Foam::scalar |
73 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka | ||
73 | Foam::populationBalanceSubModels::growthModels::linearEvaporation::Kg | ||
74 | 74 | ( | ( |
75 | const scalar& abscissa1, | ||
76 | const scalar& abscissa2, | ||
77 | const label celli, | ||
75 | const scalar& d, | ||
76 | const bool lengthBased, | ||
78 | 77 | const label environment | const label environment |
79 | 78 | ) const | ) const |
80 | 79 | { | { |
81 | return Ca_.value(); | ||
80 | |||
81 | return | ||
82 | -Cg_.value() | ||
83 | *Foam::constant::mathematical::pi/6.0 | ||
84 | *pow3(d) | ||
85 | *(lengthBased ? dDdV(d) : 1.0); | ||
82 | 86 | } | } |
83 | 87 | ||
84 | 88 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/linearEvaporation/linearEvaporation.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.H (similarity 68%) (mode: 100644) (index a1ec9d9..ca9c492) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::diffusionModels::noDiffusion | ||
25 | Foam::populationBalanceSubModels::growthModels::linearEvaporation | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | No diffusion model. | ||
28 | linear evaporation model. | ||
29 | |||
30 | \f[ | ||
31 | C_g = -E_v \frac{\pi d_i^3}{6} | ||
32 | \f] | ||
33 | |||
34 | where | ||
35 | |||
36 | \vartable | ||
37 | E_v | Evaporation coefficient [m^2/s] | ||
38 | d_i | Diameter of droplet i [m^3] | ||
39 | \endvartable | ||
29 | 40 | ||
30 | 41 | SourceFiles | SourceFiles |
31 | noDiffusion.C | ||
42 | linearEvaporation.C | ||
32 | 43 | ||
33 | 44 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 45 | ||
35 | #ifndef noDiffusion_H | ||
36 | #define noDiffusion_H | ||
46 | #ifndef linearEvaporation_H | ||
47 | #define linearEvaporation_H | ||
48 | |||
49 | #include "growthModel.H" | ||
37 | 50 | ||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
40 | 51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 52 | ||
42 | 53 | namespace Foam | namespace Foam |
43 | 54 | { | { |
44 | 55 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
45 | 56 | { | { |
46 | namespace diffusionModels | ||
57 | namespace growthModels | ||
47 | 58 | { | { |
48 | 59 | ||
49 | 60 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
50 | Class noDiffusion Declaration | ||
61 | Class linear Declaration | ||
51 | 62 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
52 | 63 | ||
53 | class noDiffusion | ||
64 | class linearEvaporation | ||
54 | 65 | : | : |
55 | public diffusionModel | ||
66 | public growthModel | ||
56 | 67 | { | { |
57 | 68 | public: | public: |
58 | 69 | ||
59 | 70 | //- Runtime type information | //- Runtime type information |
60 | TypeName("none"); | ||
71 | TypeName("linearEvaporation"); | ||
61 | 72 | ||
62 | 73 | ||
63 | 74 | // Constructors | // Constructors |
64 | 75 | ||
65 | 76 | //- Construct from components | //- Construct from components |
66 | noDiffusion(const dictionary& dict); | ||
77 | linearEvaporation(const dictionary& dict); | ||
67 | 78 | ||
68 | 79 | ||
69 | 80 | //- Destructor | //- Destructor |
70 | virtual ~noDiffusion(); | ||
81 | virtual ~linearEvaporation(); | ||
71 | 82 | ||
72 | 83 | ||
73 | 84 | // Member Functions | // Member Functions |
74 | 85 | ||
75 | //- Moments of the daughter distribution | ||
76 | virtual tmp<fvScalarMatrix> momentDiff | ||
86 | //- Aggregation kernel | ||
87 | virtual scalar Kg | ||
77 | 88 | ( | ( |
78 | const volScalarField& moment | ||
89 | const scalar& d, | ||
90 | const bool lengthBased, | ||
91 | const label environment | ||
79 | 92 | ) const; | ) const; |
80 | 93 | ||
81 | 94 | }; | }; |
... | ... | public: | |
83 | 96 | ||
84 | 97 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
85 | 98 | ||
86 | } // End namespace diffusionModels | ||
99 | } // End namespace growthModels | ||
87 | 100 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
88 | 101 | } // End namespace Foam | } // End namespace Foam |
89 | 102 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/nonLinearEvaporation/nonLinearEvaporation.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C (similarity 71%) (mode: 100644) (index cce0288..f774901) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noNucleation.H" | ||
26 | #include "nonLinearEvaporation.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | |||
28 | #include "fundamentalConstants.H" | ||
29 | 29 | ||
30 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
31 | 31 | ||
... | ... | namespace Foam | |
33 | 33 | { | { |
34 | 34 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
35 | 35 | { | { |
36 | namespace nucleationModels | ||
36 | namespace growthModels | ||
37 | 37 | { | { |
38 | defineTypeNameAndDebug(noNucleation, 0); | ||
38 | defineTypeNameAndDebug(nonLinearEvaporation, 0); | ||
39 | 39 | ||
40 | 40 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
41 | 41 | ( | ( |
42 | nucleationModel, | ||
43 | noNucleation, | ||
42 | growthModel, | ||
43 | nonLinearEvaporation, | ||
44 | 44 | dictionary | dictionary |
45 | 45 | ); | ); |
46 | 46 | } | } |
... | ... | namespace nucleationModels | |
50 | 50 | ||
51 | 51 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
52 | 52 | ||
53 | Foam::populationBalanceSubModels::nucleationModels::noNucleation::noNucleation | ||
53 | Foam::populationBalanceSubModels::growthModels::nonLinearEvaporation:: | ||
54 | nonLinearEvaporation | ||
54 | 55 | ( | ( |
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | const dictionary& dict | ||
57 | 57 | ) | ) |
58 | 58 | : | : |
59 | nucleationModel(dict, mesh) | ||
59 | growthModel(dict) | ||
60 | 60 | {} | {} |
61 | 61 | ||
62 | 62 | ||
63 | 63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
64 | 64 | ||
65 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | ||
66 | ::~noNucleation() | ||
65 | Foam::populationBalanceSubModels::growthModels::nonLinearEvaporation:: | ||
66 | ~nonLinearEvaporation() | ||
67 | 67 | {} | {} |
68 | 68 | ||
69 | 69 | ||
70 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
71 | 71 | ||
72 | 72 | Foam::scalar | Foam::scalar |
73 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | ||
74 | ::nucleationSource | ||
73 | Foam::populationBalanceSubModels::growthModels::nonLinearEvaporation::Kg | ||
75 | 74 | ( | ( |
76 | const label& momentOrder, | ||
77 | const label celli, | ||
75 | const scalar& d, | ||
76 | const bool lengthBased, | ||
78 | 77 | const label environment | const label environment |
79 | 78 | ) const | ) const |
80 | 79 | { | { |
81 | return 0.0; | ||
80 | return -Cg_.value()/4.0*d*(lengthBased ? dDdV(d) : 1.0); | ||
82 | 81 | } | } |
83 | 82 | ||
84 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/nonLinearEvaporation/nonLinearEvaporation.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.H (similarity 66%) (mode: 100644) (index 32fc357..62d0b7e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | ||
25 | Foam::populationBalanceSubModels::growthModels::nonLinearEvaporation | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | No nucleation model. | ||
28 | nonLinear evaporation model. | ||
29 | |||
30 | \f[ | ||
31 | K_g = -\frac{E_v}{2} \left( \frac{3 V_i}{4 \pi} \right) ^{1/3} | ||
32 | \f] | ||
33 | |||
34 | where | ||
35 | |||
36 | \vartable | ||
37 | E_v | Evaporation coefficient [1/s] | ||
38 | V_i | Volume of droplet i [m^3] | ||
39 | \endvartable | ||
29 | 40 | ||
30 | 41 | SourceFiles | SourceFiles |
31 | noNucleation.C | ||
42 | nonLinearEvaporation.C | ||
32 | 43 | ||
33 | 44 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 45 | ||
35 | #ifndef noNucleation_H | ||
36 | #define noNucleation_H | ||
46 | #ifndef nonLinearEvaporation_H | ||
47 | #define nonLinearEvaporation_H | ||
37 | 48 | ||
38 | #include "nucleationModel.H" | ||
49 | #include "growthModel.H" | ||
39 | 50 | ||
40 | 51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 52 | ||
... | ... | namespace Foam | |
43 | 54 | { | { |
44 | 55 | namespace populationBalanceSubModels | namespace populationBalanceSubModels |
45 | 56 | { | { |
46 | namespace nucleationModels | ||
57 | namespace growthModels | ||
47 | 58 | { | { |
48 | 59 | ||
49 | 60 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
50 | Class noNucleation Declaration | ||
61 | Class nonLinearEvaporation Declaration | ||
51 | 62 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
52 | 63 | ||
53 | class noNucleation | ||
64 | class nonLinearEvaporation | ||
54 | 65 | : | : |
55 | public nucleationModel | ||
66 | public growthModel | ||
56 | 67 | { | { |
57 | 68 | public: | public: |
58 | 69 | ||
59 | 70 | //- Runtime type information | //- Runtime type information |
60 | TypeName("none"); | ||
71 | TypeName("nonLinearEvaporation"); | ||
61 | 72 | ||
62 | 73 | ||
63 | 74 | // Constructors | // Constructors |
64 | 75 | ||
65 | 76 | //- Construct from components | //- Construct from components |
66 | noNucleation | ||
67 | ( | ||
68 | const dictionary& dict, | ||
69 | const fvMesh& mesh | ||
70 | ); | ||
77 | nonLinearEvaporation(const dictionary& dict); | ||
71 | 78 | ||
72 | 79 | ||
73 | 80 | //- Destructor | //- Destructor |
74 | virtual ~noNucleation(); | ||
81 | virtual ~nonLinearEvaporation(); | ||
75 | 82 | ||
76 | 83 | ||
77 | 84 | // Member Functions | // Member Functions |
78 | 85 | ||
79 | //- Growth model | ||
80 | virtual scalar nucleationSource | ||
86 | //- Growth kernel | ||
87 | virtual scalar Kg | ||
81 | 88 | ( | ( |
82 | const label& momentOrder, | ||
83 | const label celli, | ||
84 | const label environment = 0 | ||
89 | const scalar& d, | ||
90 | const bool lengthBased, | ||
91 | const label environment | ||
85 | 92 | ) const; | ) const; |
93 | |||
86 | 94 | }; | }; |
87 | 95 | ||
88 | 96 | ||
89 | 97 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
90 | 98 | ||
91 | } // End namespace nucleationModels | ||
99 | } // End namespace growthModels | ||
92 | 100 | } // End namespace populationBalanceSubModels | } // End namespace populationBalanceSubModels |
93 | 101 | } // End namespace Foam | } // End namespace Foam |
94 | 102 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/Miller/Miller.C changed (mode: 100644) (index 0dd6663..4992924) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/Miller/Miller.H changed (mode: 100644) (index ecb6158..623ec4d) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C changed (mode: 100644) (index cce0288..b55f4a2) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.H changed (mode: 100644) (index 32fc357..4ce24c5) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C changed (mode: 100644) (index 08a1796..aecffc8) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C changed (mode: 100644) (index 38f9456..232a610) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.H changed (mode: 100644) (index b902d23..658385a) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2016-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2016-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
54 | 54 | ||
55 | 55 | class nucleationModel | class nucleationModel |
56 | 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 | 57 | protected: | protected: |
67 | 58 | ||
68 | 59 | // Protected data | // Protected data |
... | ... | public: | |
101 | 92 | const fvMesh& mesh | const fvMesh& mesh |
102 | 93 | ); | ); |
103 | 94 | ||
95 | //- Disallow default bitwise copy construct | ||
96 | nucleationModel(const nucleationModel&) = delete; | ||
97 | |||
104 | 98 | ||
105 | 99 | // Selectors | // Selectors |
106 | 100 | ||
... | ... | public: | |
124 | 118 | const label celli, | const label celli, |
125 | 119 | const label environment = 0 | const label environment = 0 |
126 | 120 | ) const = 0; | ) const = 0; |
121 | |||
122 | |||
123 | // Member Operators | ||
124 | |||
125 | //- Disallow default bitwise assignment | ||
126 | void operator=(const nucleationModel&) = delete; | ||
127 | 127 | }; | }; |
128 | 128 | ||
129 | 129 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/sizeVelocityPopulationBalance/sizeVelocityPopulationBalance.C added (mode: 100644) (index 0000000..fa7c5dd) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2018-2019 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 "sizeVelocityPopulationBalance.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(sizeVelocityPopulationBalance, 0); | ||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | populationBalanceModel, | ||
41 | sizeVelocityPopulationBalance, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
49 | |||
50 | Foam::PDFTransportModels::populationBalanceModels::sizeVelocityPopulationBalance | ||
51 | ::sizeVelocityPopulationBalance | ||
52 | ( | ||
53 | const word& name, | ||
54 | const dictionary& dict, | ||
55 | const surfaceScalarField& phi | ||
56 | ) | ||
57 | : | ||
58 | velocityPopulationBalance(name, dict, phi), | ||
59 | aggregation_(dict.lookupOrDefault("aggregation", false)), | ||
60 | breakup_(dict.lookupOrDefault("breakup", false)), | ||
61 | growth_(dict.lookupOrDefault("growth", false)), | ||
62 | nucleation_(dict.lookupOrDefault("nucleation", false)), | ||
63 | aggregationKernel_(), | ||
64 | breakupKernel_(), | ||
65 | growthModel_(), | ||
66 | nucleationModel_() | ||
67 | { | ||
68 | if (aggregation_) | ||
69 | { | ||
70 | aggregationKernel_ = | ||
71 | Foam::populationBalanceSubModels::aggregationKernel::New | ||
72 | ( | ||
73 | dict.subDict("aggregationKernel"), | ||
74 | phi_.mesh() | ||
75 | ); | ||
76 | } | ||
77 | |||
78 | if (breakup_) | ||
79 | { | ||
80 | breakupKernel_ = | ||
81 | Foam::populationBalanceSubModels::breakupKernel::New | ||
82 | ( | ||
83 | dict.subDict("breakupKernel"), | ||
84 | phi_.mesh() | ||
85 | ); | ||
86 | } | ||
87 | |||
88 | if (growth_) | ||
89 | { | ||
90 | growthModel_ = | ||
91 | Foam::populationBalanceSubModels::growthModel::New | ||
92 | ( | ||
93 | dict.subDict("growthModel") | ||
94 | ); | ||
95 | } | ||
96 | |||
97 | if (dict.found("diffusionModel")) | ||
98 | { | ||
99 | diffusionModel_ = | ||
100 | Foam::populationBalanceSubModels::diffusionModel::New | ||
101 | ( | ||
102 | dict.subDict("diffusionModel") | ||
103 | ); | ||
104 | } | ||
105 | |||
106 | if (nucleation_) | ||
107 | { | ||
108 | nucleationModel_ = | ||
109 | Foam::populationBalanceSubModels::nucleationModel::New | ||
110 | ( | ||
111 | dict.subDict("nucleationModel"), | ||
112 | phi_.mesh() | ||
113 | ); | ||
114 | } | ||
115 | } | ||
116 | |||
117 | |||
118 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
119 | |||
120 | Foam::PDFTransportModels::populationBalanceModels::sizeVelocityPopulationBalance | ||
121 | ::~sizeVelocityPopulationBalance() | ||
122 | {} | ||
123 | |||
124 | |||
125 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
126 | |||
127 | Foam::tmp<Foam::fvScalarMatrix> | ||
128 | Foam::PDFTransportModels::populationBalanceModels::sizeVelocityPopulationBalance | ||
129 | ::implicitMomentSource | ||
130 | ( | ||
131 | const volVelocityMoment& moment | ||
132 | ) | ||
133 | { | ||
134 | tmp<fvScalarMatrix> momentEqn | ||
135 | ( | ||
136 | velocityPopulationBalance::implicitMomentSource(moment) | ||
137 | ); | ||
138 | |||
139 | if (diffusionModel_.valid()) | ||
140 | { | ||
141 | return momentEqn + diffusionModel_->momentDiff(moment); | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | return momentEqn; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | void | ||
150 | Foam::PDFTransportModels::populationBalanceModels::sizeVelocityPopulationBalance | ||
151 | ::explicitMomentSource() | ||
152 | { | ||
153 | if | ||
154 | ( | ||
155 | (collision_ && !collisionKernel_->implicit()) | ||
156 | || aggregation_ || breakup_ || growth_ || nucleation_ | ||
157 | ) | ||
158 | { | ||
159 | odeType::solve(quadrature_, 0); | ||
160 | } | ||
161 | |||
162 | return; | ||
163 | } | ||
164 | |||
165 | Foam::scalar | ||
166 | Foam::PDFTransportModels::populationBalanceModels | ||
167 | ::sizeVelocityPopulationBalance::cellMomentSource | ||
168 | ( | ||
169 | const labelList& momentOrder, | ||
170 | const label celli, | ||
171 | const velocityQuadratureApproximation& quadrature, | ||
172 | const label environment | ||
173 | ) | ||
174 | { | ||
175 | scalar source = 0.0; | ||
176 | |||
177 | // if (nucleation_) | ||
178 | // { | ||
179 | // source += nucleationModel_->nucleationSource(momentOrder[0], celli); | ||
180 | // } | ||
181 | |||
182 | // Collision source term | ||
183 | if (collision_) | ||
184 | { | ||
185 | source += collisionKernel_->explicitCollisionSource(momentOrder, celli); | ||
186 | } | ||
187 | |||
188 | // Aggregation source term | ||
189 | if (aggregation_) | ||
190 | { | ||
191 | source += | ||
192 | aggregationKernel_->aggregationSource | ||
193 | ( | ||
194 | momentOrder, | ||
195 | celli, | ||
196 | quadrature, | ||
197 | environment | ||
198 | ); | ||
199 | } | ||
200 | |||
201 | // Breaku source term | ||
202 | if (breakup_) | ||
203 | { | ||
204 | source += | ||
205 | breakupKernel_->breakupSource | ||
206 | ( | ||
207 | momentOrder, | ||
208 | celli, | ||
209 | quadrature | ||
210 | ); | ||
211 | } | ||
212 | |||
213 | // Phase space convection/growth source term | ||
214 | if (growth_) | ||
215 | { | ||
216 | source += | ||
217 | growthModel_->phaseSpaceConvection | ||
218 | ( | ||
219 | momentOrder, | ||
220 | celli, | ||
221 | quadrature | ||
222 | ); | ||
223 | } | ||
224 | |||
225 | return source; | ||
226 | } | ||
227 | |||
228 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/sizeVelocityPopulationBalance/sizeVelocityPopulationBalance.H copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.H (similarity 62%) (mode: 100644) (index bb9d71d..4a37173) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::populationBalanceModels::univariatePopulationBalance | ||
25 | Foam::populationBalanceModels::velocityPopulationBalance | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Solve a univariate population balance equation with the extended quadrature | ||
29 | method of moments. | ||
28 | Solve a velocity population balance equation with the hyperbolic | ||
29 | conditional quadrature method of moments with collisions. | ||
30 | 30 | ||
31 | 31 | SourceFiles | SourceFiles |
32 | univariatePopulationBalance.C | ||
32 | sizeVelocityPopulationBalance.C | ||
33 | 33 | ||
34 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
35 | 35 | ||
36 | #ifndef univariatePopulationBalance_H | ||
37 | #define univariatePopulationBalance_H | ||
36 | #ifndef sizeVelocityPopulationBalance_H | ||
37 | #define sizeVelocityPopulationBalance_H | ||
38 | 38 | ||
39 | #include "univariatePDFTransportModel.H" | ||
40 | #include "populationBalanceModel.H" | ||
39 | #include "velocityPopulationBalance.H" | ||
40 | #include "collisionKernel.H" | ||
41 | 41 | #include "aggregationKernel.H" | #include "aggregationKernel.H" |
42 | 42 | #include "breakupKernel.H" | #include "breakupKernel.H" |
43 | #include "daughterDistribution.H" | ||
44 | 43 | #include "growthModel.H" | #include "growthModel.H" |
45 | 44 | #include "diffusionModel.H" | #include "diffusionModel.H" |
46 | 45 | #include "nucleationModel.H" | #include "nucleationModel.H" |
... | ... | namespace populationBalanceModels | |
55 | 54 | { | { |
56 | 55 | ||
57 | 56 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
58 | Class univariatePopulationBalance Declaration | ||
57 | Class velocityPopulationBalance Declaration | ||
59 | 58 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
60 | 59 | ||
61 | class univariatePopulationBalance | ||
60 | class sizeVelocityPopulationBalance | ||
62 | 61 | : | : |
63 | public univariatePDFTransportModel, public populationBalanceModel | ||
62 | public velocityPopulationBalance | ||
64 | 63 | { | { |
65 | 64 | // Private data | // Private data |
66 | 65 | ||
67 | //- Name of the univariatePopulationBalance | ||
68 | const word name_; | ||
69 | |||
70 | 66 | //- Switch indicating the status of the aggregation model | //- Switch indicating the status of the aggregation model |
71 | 67 | Switch aggregation_; | Switch aggregation_; |
72 | 68 | ||
... | ... | class univariatePopulationBalance | |
76 | 72 | //- Switch indicating the status of the growth model | //- Switch indicating the status of the growth model |
77 | 73 | Switch growth_; | Switch growth_; |
78 | 74 | ||
75 | //- Switch indicating the status of the nucleation model | ||
76 | Switch nucleation_; | ||
77 | |||
79 | 78 | //- Aggregation kernel model | //- Aggregation kernel model |
80 | 79 | autoPtr | autoPtr |
81 | 80 | < | < |
... | ... | class univariatePopulationBalance | |
88 | 87 | Foam::populationBalanceSubModels::breakupKernel | Foam::populationBalanceSubModels::breakupKernel |
89 | 88 | > breakupKernel_; | > breakupKernel_; |
90 | 89 | ||
91 | //- Daughter distribution function | ||
92 | autoPtr | ||
93 | < | ||
94 | Foam::populationBalanceSubModels::daughterDistribution | ||
95 | > daughterDistribution_; | ||
96 | |||
97 | 90 | //- Growth model function | //- Growth model function |
98 | 91 | autoPtr | autoPtr |
99 | 92 | < | < |
... | ... | class univariatePopulationBalance | |
114 | 107 | ||
115 | 108 | // Private member functions | // Private member functions |
116 | 109 | ||
117 | //- Calculate aggregation source terms | ||
118 | scalar aggregationSource | ||
119 | ( | ||
120 | const label& momentOrder, | ||
121 | const label& celli | ||
122 | ); | ||
123 | |||
124 | //- Calculate Breakup source term | ||
125 | scalar breakupSource | ||
126 | ( | ||
127 | const label& momentOrder, | ||
128 | const label& celli | ||
129 | ); | ||
130 | |||
131 | //- Diffusion term | ||
132 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
133 | ( | ||
134 | const volUnivariateMoment& moment | ||
135 | ); | ||
136 | |||
137 | //- Convect moments in phase space | ||
138 | virtual scalar phaseSpaceConvection | ||
139 | ( | ||
140 | const label& momentOrder, | ||
141 | const label& celli | ||
142 | ); | ||
110 | // //- Update explicit collison source terms | ||
111 | // virtual void updateCellMomentSource(const label celli); | ||
143 | 112 | ||
144 | 113 | //- Calculate implicit source terms | //- Calculate implicit source terms |
145 | 114 | virtual tmp<fvScalarMatrix> implicitMomentSource | virtual tmp<fvScalarMatrix> implicitMomentSource |
146 | 115 | ( | ( |
147 | const volUnivariateMoment& moment | ||
116 | const volVelocityMoment& moment | ||
148 | 117 | ); | ); |
149 | 118 | ||
119 | //- Calculate explicit source terms with realizable ODE solver | ||
120 | virtual void explicitMomentSource(); | ||
121 | |||
150 | 122 | //- Calculate source term for moment equation in the specified cell | //- Calculate source term for moment equation in the specified cell |
151 | 123 | virtual scalar cellMomentSource | virtual scalar cellMomentSource |
152 | 124 | ( | ( |
153 | label& momentOrder, | ||
154 | label& celli | ||
125 | const labelList& momentOrder, | ||
126 | const label celli, | ||
127 | const velocityQuadratureApproximation& quadrature, | ||
128 | const label enviroment = 0 | ||
155 | 129 | ); | ); |
156 | 130 | ||
131 | |||
157 | 132 | public: | public: |
158 | 133 | ||
159 | 134 | //- Runtime type information | //- Runtime type information |
160 | TypeName("univariate"); | ||
135 | TypeName("sizeVelocity"); | ||
161 | 136 | ||
162 | 137 | ||
163 | 138 | // Constructors | // Constructors |
164 | 139 | ||
165 | 140 | //- Construct from components | //- Construct from components |
166 | univariatePopulationBalance | ||
141 | sizeVelocityPopulationBalance | ||
167 | 142 | ( | ( |
168 | 143 | const word& name, | const word& name, |
169 | 144 | const dictionary& dict, | const dictionary& dict, |
... | ... | public: | |
172 | 147 | ||
173 | 148 | ||
174 | 149 | //- Destructor | //- Destructor |
175 | virtual ~univariatePopulationBalance(); | ||
176 | |||
177 | // Member Functions | ||
178 | |||
179 | //- Return the maximum Courant number ensuring moment realizability | ||
180 | virtual scalar realizableCo() const; | ||
181 | |||
182 | //- Return the courant number based on abscissae | ||
183 | virtual scalar CoNum() const; | ||
184 | |||
185 | //- Solve population balance equation | ||
186 | void solve(); | ||
150 | virtual ~sizeVelocityPopulationBalance(); | ||
187 | 151 | }; | }; |
188 | 152 | ||
189 | 153 | ||
190 | 154 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
191 | 155 | ||
192 | 156 | } // End namespace populationBalanceModels | } // End namespace populationBalanceModels |
193 | } // End namespace univariatePDFTransportModel | ||
157 | } // End namespace velocityPDFTransportModel | ||
194 | 158 | } // End namespace Foam | } // End namespace Foam |
195 | 159 | ||
196 | 160 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.C changed (mode: 100644) (index 77f22aa..1efe356) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceModels | |
45 | 45 | } | } |
46 | 46 | } | } |
47 | 47 | ||
48 | |||
48 | 49 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
49 | 50 | ||
50 | 51 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
57 | 58 | : | : |
58 | 59 | univariatePDFTransportModel(name, dict, phi.mesh(), phi, "RPlus"), | univariatePDFTransportModel(name, dict, phi.mesh(), phi, "RPlus"), |
59 | 60 | populationBalanceModel(name, dict, phi), | populationBalanceModel(name, dict, phi), |
60 | name_(name), | ||
61 | aggregation_(dict.lookup("aggregation")), | ||
62 | breakup_(dict.lookup("breakup")), | ||
63 | growth_(dict.lookup("growth")), | ||
64 | aggregationKernel_ | ||
65 | ( | ||
66 | Foam::populationBalanceSubModels::aggregationKernel::New | ||
67 | ( | ||
68 | dict.subDict("aggregationKernel"), | ||
69 | phi_.mesh() | ||
70 | ) | ||
71 | ), | ||
72 | breakupKernel_ | ||
73 | ( | ||
74 | Foam::populationBalanceSubModels::breakupKernel::New | ||
75 | ( | ||
76 | dict.subDict("breakupKernel"), | ||
77 | phi_.mesh() | ||
78 | ) | ||
79 | ), | ||
80 | daughterDistribution_ | ||
81 | ( | ||
82 | Foam::populationBalanceSubModels::daughterDistribution::New | ||
83 | ( | ||
84 | dict.subDict("daughterDistribution") | ||
85 | ) | ||
86 | ), | ||
87 | growthModel_ | ||
88 | ( | ||
89 | Foam::populationBalanceSubModels::growthModel::New | ||
90 | ( | ||
91 | dict.subDict("growthModel") | ||
92 | ) | ||
93 | ), | ||
61 | odeType(phi.mesh(), dict), | ||
62 | aggregation_(dict.lookupOrDefault("aggregation", false)), | ||
63 | breakup_(dict.lookupOrDefault("breakup", false)), | ||
64 | growth_(dict.lookupOrDefault("growth", false)), | ||
65 | nucleation_(dict.lookupOrDefault("nucleation", false)), | ||
66 | aggregationKernel_(), | ||
67 | breakupKernel_(), | ||
68 | growthModel_(), | ||
94 | 69 | diffusionModel_ | diffusionModel_ |
95 | 70 | ( | ( |
96 | 71 | Foam::populationBalanceSubModels::diffusionModel::New | Foam::populationBalanceSubModels::diffusionModel::New |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
98 | 73 | dict.subDict("diffusionModel") | dict.subDict("diffusionModel") |
99 | 74 | ) | ) |
100 | 75 | ), | ), |
101 | nucleationModel_ | ||
102 | ( | ||
103 | Foam::populationBalanceSubModels::nucleationModel::New | ||
104 | ( | ||
105 | dict.subDict("nucleationModel"), | ||
106 | phi_.mesh() | ||
107 | ) | ||
108 | ) | ||
109 | {} | ||
76 | nucleationModel_() | ||
77 | { | ||
78 | if (aggregation_) | ||
79 | { | ||
80 | aggregationKernel_ = | ||
81 | Foam::populationBalanceSubModels::aggregationKernel::New | ||
82 | ( | ||
83 | dict.subDict("aggregationKernel"), | ||
84 | phi_.mesh() | ||
85 | ); | ||
86 | } | ||
87 | |||
88 | if (breakup_) | ||
89 | { | ||
90 | breakupKernel_ = | ||
91 | Foam::populationBalanceSubModels::breakupKernel::New | ||
92 | ( | ||
93 | dict.subDict("breakupKernel"), | ||
94 | phi_.mesh() | ||
95 | ); | ||
96 | } | ||
97 | |||
98 | if (growth_) | ||
99 | { | ||
100 | growthModel_ = | ||
101 | Foam::populationBalanceSubModels::growthModel::New | ||
102 | ( | ||
103 | dict.subDict("growthModel") | ||
104 | ); | ||
105 | } | ||
106 | |||
107 | if (nucleation_) | ||
108 | { | ||
109 | nucleationModel_ = | ||
110 | Foam::populationBalanceSubModels::nucleationModel::New | ||
111 | ( | ||
112 | dict.subDict("nucleationModel"), | ||
113 | phi_.mesh() | ||
114 | ); | ||
115 | } | ||
116 | } | ||
110 | 117 | ||
111 | 118 | ||
112 | 119 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
118 | 125 | ||
119 | 126 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
120 | 127 | ||
121 | Foam::scalar | ||
128 | Foam::tmp<Foam::fvScalarMatrix> | ||
122 | 129 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
123 | ::aggregationSource | ||
130 | ::implicitMomentSource | ||
124 | 131 | ( | ( |
125 | const label& momentOrder, | ||
126 | const label& celli | ||
132 | const volScalarMoment& moment | ||
127 | 133 | ) | ) |
128 | 134 | { | { |
129 | scalar aSource = 0.0; | ||
130 | |||
131 | if (!aggregation_) | ||
132 | { | ||
133 | return aSource; | ||
134 | } | ||
135 | |||
136 | const PtrList<volScalarNode>& nodes = quadrature_.nodes(); | ||
135 | return diffusionModel_->momentDiff(moment); | ||
136 | } | ||
137 | 137 | ||
138 | if (!nodes[0].extended()) // Non-extended quadrature case | ||
139 | { | ||
140 | forAll(nodes, pNode1i) | ||
141 | { | ||
142 | const volScalarNode& node1 = nodes[pNode1i]; | ||
143 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
144 | const volScalarField& pAbscissa1 = node1.primaryAbscissa(); | ||
145 | |||
146 | forAll(nodes, pNode2i) | ||
147 | { | ||
148 | const volScalarNode& node2 = nodes[pNode2i]; | ||
149 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
150 | const volScalarField& pAbscissa2 = node2.primaryAbscissa(); | ||
151 | |||
152 | // Remove small negative values in abscissae | ||
153 | scalar bAbscissa1 = max(pAbscissa1[celli], 0.0); | ||
154 | scalar bAbscissa2 = max(pAbscissa2[celli], 0.0); | ||
155 | |||
156 | aSource += | ||
157 | pWeight1[celli]* | ||
158 | ( | ||
159 | pWeight2[celli]* | ||
160 | ( | ||
161 | 0.5*pow // Birth | ||
162 | ( | ||
163 | pow3(bAbscissa1) + pow3(bAbscissa2), | ||
164 | momentOrder/3.0 | ||
165 | ) | ||
166 | - pow(bAbscissa1, momentOrder) | ||
167 | )*aggregationKernel_->Ka | ||
168 | ( | ||
169 | bAbscissa1, bAbscissa2, celli | ||
170 | ) | ||
171 | ); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | return aSource; | ||
176 | } | ||
177 | 138 | ||
178 | forAll(nodes, pNode1i) // Extended quadrature case | ||
179 | { | ||
180 | const volScalarNode& node1 = nodes[pNode1i]; | ||
181 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
182 | |||
183 | forAll(node1.secondaryWeights(), sNode1i) | ||
184 | { | ||
185 | const volScalarField& sWeight1 = node1.secondaryWeights()[sNode1i]; | ||
186 | |||
187 | const volScalarField& sAbscissa1 | ||
188 | = node1.secondaryAbscissae()[sNode1i]; | ||
189 | |||
190 | forAll(nodes, pNode2i) | ||
191 | { | ||
192 | const volScalarNode& node2 = nodes[pNode2i]; | ||
193 | const volScalarField& pWeight2 = node2.primaryWeight(); | ||
194 | |||
195 | forAll(node2.secondaryWeights(), sNode2i) | ||
196 | { | ||
197 | const volScalarField& sWeight2 | ||
198 | = node2.secondaryWeights()[sNode2i]; | ||
199 | |||
200 | const volScalarField& sAbscissa2 | ||
201 | = node2.secondaryAbscissae()[sNode2i]; | ||
202 | |||
203 | // Remove small negative values in abscissae | ||
204 | scalar bAbscissa1 = max(sAbscissa1[celli], 0.0); | ||
205 | scalar bAbscissa2 = max(sAbscissa2[celli], 0.0); | ||
206 | |||
207 | aSource += | ||
208 | pWeight1[celli]*sWeight1[celli]* | ||
209 | ( | ||
210 | pWeight2[celli]*sWeight2[celli]* | ||
211 | ( | ||
212 | 0.5*pow // Birth | ||
213 | ( | ||
214 | pow3(bAbscissa1) + pow3(bAbscissa2), | ||
215 | momentOrder/3.0 | ||
216 | ) | ||
217 | - pow(bAbscissa1, momentOrder) | ||
218 | )*aggregationKernel_->Ka | ||
219 | ( | ||
220 | bAbscissa1, bAbscissa2, celli | ||
221 | ) | ||
222 | ); | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | } | ||
139 | void | ||
140 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
141 | ::updateCellMomentSource(const label) | ||
142 | {} | ||
227 | 143 | ||
228 | return aSource; | ||
229 | } | ||
230 | 144 | ||
231 | 145 | Foam::scalar | Foam::scalar |
232 | 146 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
233 | ::breakupSource | ||
147 | ::cellMomentSource | ||
234 | 148 | ( | ( |
235 | const label& momentOrder, | ||
236 | const label& celli | ||
149 | const labelList& momentOrder, | ||
150 | const label celli, | ||
151 | const scalarQuadratureApproximation& quadrature, | ||
152 | const label environment | ||
237 | 153 | ) | ) |
238 | 154 | { | { |
239 | scalar bSource = 0.0; | ||
155 | scalar source = 0.0; | ||
240 | 156 | ||
241 | if (!breakup_) | ||
157 | if (aggregation_) | ||
242 | 158 | { | { |
243 | return bSource; | ||
159 | source += | ||
160 | aggregationKernel_->aggregationSource | ||
161 | ( | ||
162 | momentOrder, | ||
163 | celli, | ||
164 | quadrature, | ||
165 | environment | ||
166 | ); | ||
244 | 167 | } | } |
245 | 168 | ||
246 | const PtrList<volScalarNode>& nodes = quadrature_.nodes(); | ||
247 | |||
248 | if (!nodes[0].extended()) | ||
169 | if (breakup_) | ||
249 | 170 | { | { |
250 | forAll(nodes, pNodeI) | ||
251 | { | ||
252 | const volScalarNode& node = nodes[pNodeI]; | ||
253 | |||
254 | scalar bAbscissa = max(node.primaryAbscissa()[celli], 0.0); | ||
255 | |||
256 | bSource += node.primaryWeight()[celli] | ||
257 | *breakupKernel_->Kb(bAbscissa, celli) | ||
258 | *( | ||
259 | daughterDistribution_->mD(momentOrder, bAbscissa)//Birth | ||
260 | - pow(bAbscissa, momentOrder) //Death | ||
261 | ); | ||
262 | } | ||
171 | source += | ||
172 | breakupKernel_->breakupSource | ||
173 | ( | ||
174 | momentOrder, | ||
175 | celli, | ||
176 | quadrature | ||
177 | ); | ||
178 | } | ||
263 | 179 | ||
264 | return bSource; | ||
180 | if (growth_) | ||
181 | { | ||
182 | source += | ||
183 | growthModel_->phaseSpaceConvection | ||
184 | ( | ||
185 | momentOrder, | ||
186 | celli, | ||
187 | quadrature | ||
188 | ); | ||
265 | 189 | } | } |
266 | 190 | ||
267 | forAll(nodes, pNodeI) | ||
191 | if (nucleation_) | ||
268 | 192 | { | { |
269 | const volScalarNode& node = nodes[pNodeI]; | ||
270 | |||
271 | forAll(node.secondaryWeights(), sNodei) | ||
272 | { | ||
273 | scalar bAbscissa | ||
274 | = max(node.secondaryAbscissae()[sNodei][celli], 0.0); | ||
275 | |||
276 | bSource += node.primaryWeight()[celli] | ||
277 | *node.secondaryWeights()[sNodei][celli] | ||
278 | *breakupKernel_->Kb(bAbscissa, celli) | ||
279 | *( | ||
280 | daughterDistribution_->mD(momentOrder, bAbscissa) //Birth | ||
281 | - pow(bAbscissa, momentOrder) //Death | ||
282 | ); | ||
283 | } | ||
193 | source += nucleationModel_->nucleationSource(momentOrder[0], celli); | ||
284 | 194 | } | } |
285 | 195 | ||
286 | return bSource; | ||
196 | return source; | ||
287 | 197 | } | } |
288 | 198 | ||
289 | Foam::tmp<fvScalarMatrix> Foam::PDFTransportModels::populationBalanceModels | ||
290 | ::univariatePopulationBalance::momentDiffusion | ||
291 | ( | ||
292 | const volUnivariateMoment& moment | ||
293 | ) | ||
294 | { | ||
295 | return diffusionModel_->momentDiff(moment); | ||
296 | } | ||
297 | 199 | ||
298 | 200 | Foam::scalar | Foam::scalar |
299 | 201 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
300 | ::phaseSpaceConvection | ||
301 | ( | ||
302 | const label& momentOrder, | ||
303 | const label& celli | ||
304 | ) | ||
202 | ::realizableCo() const | ||
305 | 203 | { | { |
306 | scalar gSource = 0.0; | ||
307 | |||
308 | if (!growth_ || momentOrder < 1) | ||
309 | { | ||
310 | return gSource; | ||
311 | } | ||
312 | |||
313 | const PtrList<volScalarNode>& nodes = quadrature_.nodes(); | ||
314 | |||
315 | if (!nodes[0].extended()) | ||
316 | { | ||
317 | forAll(nodes, pNodeI) | ||
318 | { | ||
319 | const volScalarNode& node = nodes[pNodeI]; | ||
204 | return univariatePDFTransportModel::realizableCo(); | ||
205 | } | ||
320 | 206 | ||
321 | scalar bAbscissa = max(node.primaryAbscissa()[celli], 0.0); | ||
322 | 207 | ||
323 | gSource += node.primaryWeight()[celli] | ||
324 | *growthModel_->Kg(node.primaryAbscissa()[celli]) | ||
325 | *momentOrder*pow(bAbscissa, momentOrder - 1); | ||
326 | } | ||
208 | Foam::scalar | ||
209 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
210 | ::CoNum() const | ||
211 | { | ||
212 | return 0.0; | ||
213 | } | ||
327 | 214 | ||
328 | return gSource; | ||
329 | } | ||
330 | 215 | ||
331 | forAll(nodes, pNodeI) | ||
216 | bool | ||
217 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
218 | ::solveMomentSources() const | ||
219 | { | ||
220 | if (aggregation_ || breakup_ || growth_ || nucleation_) | ||
332 | 221 | { | { |
333 | const volScalarNode& node = nodes[pNodeI]; | ||
334 | |||
335 | forAll(node.secondaryWeights(), sNodei) | ||
336 | { | ||
337 | scalar bAbscissa | ||
338 | = max(node.secondaryAbscissae()[sNodei][celli], 0.0); | ||
339 | |||
340 | gSource += node.primaryWeight()[celli] | ||
341 | *node.secondaryWeights()[sNodei][celli] | ||
342 | *growthModel_->Kg(bAbscissa) | ||
343 | *momentOrder*pow | ||
344 | ( | ||
345 | bAbscissa, | ||
346 | momentOrder - 1 | ||
347 | ); | ||
348 | } | ||
222 | return odeType::solveSources_; | ||
349 | 223 | } | } |
350 | 224 | ||
351 | return gSource; | ||
225 | return false; | ||
352 | 226 | } | } |
353 | 227 | ||
354 | Foam::tmp<Foam::fvScalarMatrix> | ||
355 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
356 | ::implicitMomentSource | ||
357 | ( | ||
358 | const volUnivariateMoment& moment | ||
359 | ) | ||
360 | { | ||
361 | tmp<fvScalarMatrix> impSource | ||
362 | ( | ||
363 | new fvScalarMatrix | ||
364 | ( | ||
365 | moment, | ||
366 | moment.dimensions()*dimVol/dimTime | ||
367 | ) | ||
368 | ); | ||
369 | |||
370 | return impSource; | ||
371 | } | ||
372 | 228 | ||
373 | Foam::scalar | ||
229 | bool | ||
374 | 230 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
375 | ::cellMomentSource | ||
376 | ( | ||
377 | label& momentOrder, | ||
378 | label& celli | ||
379 | ) | ||
231 | ::solveMomentOde() const | ||
380 | 232 | { | { |
381 | return aggregationSource(momentOrder, celli) | ||
382 | + breakupSource(momentOrder, celli) | ||
383 | + nucleationModel_->nucleationSource(momentOrder, celli) | ||
384 | + phaseSpaceConvection(momentOrder, celli); | ||
233 | return odeType::solveOde_; | ||
385 | 234 | } | } |
386 | 235 | ||
387 | Foam::scalar | ||
236 | |||
237 | void | ||
388 | 238 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
389 | ::realizableCo() const | ||
239 | ::explicitMomentSource() | ||
390 | 240 | { | { |
391 | return univariatePDFTransportModel::realizableCo(); | ||
241 | odeType::solve(quadrature_, 0); | ||
392 | 242 | } | } |
393 | 243 | ||
394 | Foam::scalar | ||
244 | |||
245 | void | ||
395 | 246 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
396 | ::CoNum() const | ||
247 | ::solve() | ||
397 | 248 | { | { |
398 | return 0.0; | ||
249 | univariatePDFTransportModel::solve(); | ||
399 | 250 | } | } |
400 | 251 | ||
401 | void | ||
252 | |||
253 | bool | ||
402 | 254 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
403 | ::solve() | ||
255 | ::readIfModified() | ||
404 | 256 | { | { |
405 | univariatePDFTransportModel::solve(); | ||
257 | odeType::read | ||
258 | ( | ||
259 | populationBalanceProperties_.subDict(type() + "Coeffs") | ||
260 | ); | ||
261 | |||
262 | return true; | ||
406 | 263 | } | } |
407 | 264 | ||
265 | |||
408 | 266 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.H changed (mode: 100644) (index bb9d71d..d6d0160) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
40 | 40 | #include "populationBalanceModel.H" | #include "populationBalanceModel.H" |
41 | 41 | #include "aggregationKernel.H" | #include "aggregationKernel.H" |
42 | 42 | #include "breakupKernel.H" | #include "breakupKernel.H" |
43 | #include "daughterDistribution.H" | ||
44 | 43 | #include "growthModel.H" | #include "growthModel.H" |
45 | 44 | #include "diffusionModel.H" | #include "diffusionModel.H" |
46 | 45 | #include "nucleationModel.H" | #include "nucleationModel.H" |
46 | #include "realizableOdeSolver.H" | ||
47 | 47 | ||
48 | 48 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
49 | 49 | ||
... | ... | namespace populationBalanceModels | |
60 | 60 | ||
61 | 61 | class univariatePopulationBalance | class univariatePopulationBalance |
62 | 62 | : | : |
63 | public univariatePDFTransportModel, public populationBalanceModel | ||
63 | public univariatePDFTransportModel, | ||
64 | public populationBalanceModel, | ||
65 | private realizableOdeSolver<volScalarMoment, volScalarNode> | ||
64 | 66 | { | { |
65 | // Private data | ||
67 | typedef realizableOdeSolver<volScalarMoment, volScalarNode> odeType; | ||
66 | 68 | ||
67 | //- Name of the univariatePopulationBalance | ||
68 | const word name_; | ||
69 | // Private data | ||
69 | 70 | ||
70 | 71 | //- Switch indicating the status of the aggregation model | //- Switch indicating the status of the aggregation model |
71 | 72 | Switch aggregation_; | Switch aggregation_; |
... | ... | class univariatePopulationBalance | |
76 | 77 | //- Switch indicating the status of the growth model | //- Switch indicating the status of the growth model |
77 | 78 | Switch growth_; | Switch growth_; |
78 | 79 | ||
80 | //- Switch indicating the status of the nucleation model | ||
81 | Switch nucleation_; | ||
82 | |||
79 | 83 | //- Aggregation kernel model | //- Aggregation kernel model |
80 | 84 | autoPtr | autoPtr |
81 | 85 | < | < |
... | ... | class univariatePopulationBalance | |
88 | 92 | Foam::populationBalanceSubModels::breakupKernel | Foam::populationBalanceSubModels::breakupKernel |
89 | 93 | > breakupKernel_; | > breakupKernel_; |
90 | 94 | ||
91 | //- Daughter distribution function | ||
92 | autoPtr | ||
93 | < | ||
94 | Foam::populationBalanceSubModels::daughterDistribution | ||
95 | > daughterDistribution_; | ||
96 | |||
97 | 95 | //- Growth model function | //- Growth model function |
98 | 96 | autoPtr | autoPtr |
99 | 97 | < | < |
... | ... | class univariatePopulationBalance | |
114 | 112 | ||
115 | 113 | // Private member functions | // Private member functions |
116 | 114 | ||
117 | //- Calculate aggregation source terms | ||
118 | scalar aggregationSource | ||
115 | //- Calculate implicit source terms | ||
116 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
119 | 117 | ( | ( |
120 | const label& momentOrder, | ||
121 | const label& celli | ||
118 | const volScalarMoment& moment | ||
122 | 119 | ); | ); |
123 | 120 | ||
124 | //- Calculate Breakup source term | ||
125 | scalar breakupSource | ||
126 | ( | ||
127 | const label& momentOrder, | ||
128 | const label& celli | ||
129 | ); | ||
121 | //- Calculate explicit source terms with realizable ODE solver | ||
122 | virtual void explicitMomentSource(); | ||
130 | 123 | ||
131 | //- Diffusion term | ||
132 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
133 | ( | ||
134 | const volUnivariateMoment& moment | ||
135 | ); | ||
124 | //- Are moments updated due to sources | ||
125 | virtual bool solveMomentSources() const; | ||
136 | 126 | ||
137 | //- Convect moments in phase space | ||
138 | virtual scalar phaseSpaceConvection | ||
139 | ( | ||
140 | const label& momentOrder, | ||
141 | const label& celli | ||
142 | ); | ||
127 | //- Is the realizable ode solver used to solve sources | ||
128 | virtual bool solveMomentOde() const; | ||
143 | 129 | ||
144 | //- Calculate implicit source terms | ||
145 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
146 | ( | ||
147 | const volUnivariateMoment& moment | ||
148 | ); | ||
130 | //- Update explicit collison source terms | ||
131 | virtual void updateCellMomentSource(const label celli); | ||
149 | 132 | ||
150 | 133 | //- Calculate source term for moment equation in the specified cell | //- Calculate source term for moment equation in the specified cell |
151 | 134 | virtual scalar cellMomentSource | virtual scalar cellMomentSource |
152 | 135 | ( | ( |
153 | label& momentOrder, | ||
154 | label& celli | ||
136 | const labelList& momentOrder, | ||
137 | const label celli, | ||
138 | const scalarQuadratureApproximation& nodes, | ||
139 | const label environment | ||
155 | 140 | ); | ); |
156 | 141 | ||
142 | |||
157 | 143 | public: | public: |
158 | 144 | ||
159 | 145 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
184 | 170 | ||
185 | 171 | //- Solve population balance equation | //- Solve population balance equation |
186 | 172 | void solve(); | void solve(); |
173 | |||
174 | //- Read | ||
175 | virtual bool readIfModified(); | ||
187 | 176 | }; | }; |
188 | 177 | ||
189 | 178 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/velocityPopulationBalance/velocityPopulationBalance.C changed (mode: 100644) (index 965464f..8dd29f6) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | |
57 | 57 | : | : |
58 | 58 | velocityPDFTransportModel(name, dict, phi.mesh(), "R"), | velocityPDFTransportModel(name, dict, phi.mesh(), "R"), |
59 | 59 | populationBalanceModel(name, dict, phi), | populationBalanceModel(name, dict, phi), |
60 | name_(name), | ||
60 | odeType(phi.mesh(), dict), | ||
61 | 61 | collision_(dict.lookup("collision")), | collision_(dict.lookup("collision")), |
62 | 62 | collisionKernel_ | collisionKernel_ |
63 | 63 | ( | ( |
... | ... | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | |
65 | 65 | ( | ( |
66 | 66 | dict.subDict("collisionKernel"), | dict.subDict("collisionKernel"), |
67 | 67 | phi_.mesh(), | phi_.mesh(), |
68 | quadrature_, | ||
69 | dict.subDict("odeCoeffs").lookupOrDefault("solveODESource", false) | ||
68 | quadrature_ | ||
70 | 69 | ) | ) |
71 | 70 | ) | ) |
72 | 71 | {} | {} |
... | ... | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | |
81 | 80 | ||
82 | 81 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
83 | 82 | ||
84 | bool | ||
85 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
86 | ::collision() const | ||
87 | { | ||
88 | return collision_; | ||
89 | } | ||
90 | |||
91 | 83 | void | void |
92 | 84 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance |
93 | ::updateImplicitCollisionSource() | ||
85 | ::updateImplicitMomentSource() | ||
94 | 86 | { | { |
95 | 87 | if (!collision_) | if (!collision_) |
96 | 88 | { | { |
97 | 89 | return; | return; |
98 | 90 | } | } |
91 | |||
99 | 92 | return collisionKernel_->updateFields(); | return collisionKernel_->updateFields(); |
100 | 93 | } | } |
101 | 94 | ||
102 | void | ||
103 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
104 | ::updateExplicitCollisionSource(const label celli) | ||
105 | { | ||
106 | if (!collision_) | ||
107 | { | ||
108 | return; | ||
109 | } | ||
110 | return collisionKernel_->updateCells(celli); | ||
111 | } | ||
112 | 95 | ||
113 | 96 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
114 | 97 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance |
115 | ::implicitCollisionSource | ||
98 | ::implicitMomentSource | ||
116 | 99 | ( | ( |
117 | const volVectorMoment& moment | ||
100 | const volVelocityMoment& moment | ||
118 | 101 | ) | ) |
119 | 102 | { | { |
120 | 103 | if (!collision_) | if (!collision_) |
... | ... | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | |
128 | 111 | ) | ) |
129 | 112 | ); | ); |
130 | 113 | } | } |
114 | |||
131 | 115 | return collisionKernel_->implicitCollisionSource(moment); | return collisionKernel_->implicitCollisionSource(moment); |
132 | 116 | } | } |
133 | 117 | ||
134 | Foam::scalar | ||
118 | |||
119 | void Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
120 | ::explicitMomentSource() | ||
121 | { | ||
122 | if (!collision_ || collisionKernel_->implicit()) | ||
123 | { | ||
124 | return; | ||
125 | } | ||
126 | |||
127 | return odeType::solve(quadrature_, 0); | ||
128 | } | ||
129 | |||
130 | |||
131 | void | ||
135 | 132 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance |
136 | ::explicitCollisionSource | ||
137 | ( | ||
138 | const label momenti, | ||
139 | const label celli | ||
140 | ) | ||
133 | ::updateCellMomentSource(const label celli) | ||
141 | 134 | { | { |
142 | 135 | if (!collision_) | if (!collision_) |
143 | 136 | { | { |
144 | return 0.0; | ||
137 | return; | ||
145 | 138 | } | } |
146 | return collisionKernel_->explicitCollisionSource(momenti, celli); | ||
139 | |||
140 | return collisionKernel_->updateCells(celli); | ||
147 | 141 | } | } |
148 | 142 | ||
143 | |||
149 | 144 | Foam::scalar Foam::PDFTransportModels::populationBalanceModels | Foam::scalar Foam::PDFTransportModels::populationBalanceModels |
150 | 145 | ::velocityPopulationBalance::cellMomentSource | ::velocityPopulationBalance::cellMomentSource |
151 | 146 | ( | ( |
152 | const label momenti, | ||
153 | const label celli | ||
147 | const labelList& momentOrder, | ||
148 | const label celli, | ||
149 | const velocityQuadratureApproximation&, | ||
150 | const label | ||
154 | 151 | ) | ) |
155 | 152 | { | { |
156 | return explicitCollisionSource(momenti, celli); | ||
153 | return collisionKernel_->explicitCollisionSource(momentOrder, celli); | ||
157 | 154 | } | } |
158 | 155 | ||
156 | |||
159 | 157 | Foam::scalar Foam::PDFTransportModels::populationBalanceModels | Foam::scalar Foam::PDFTransportModels::populationBalanceModels |
160 | 158 | ::velocityPopulationBalance::realizableCo() const | ::velocityPopulationBalance::realizableCo() const |
161 | 159 | { | { |
162 | 160 | return velocityPDFTransportModel::realizableCo(); | return velocityPDFTransportModel::realizableCo(); |
163 | 161 | } | } |
164 | 162 | ||
163 | |||
165 | 164 | Foam::scalar Foam::PDFTransportModels::populationBalanceModels | Foam::scalar Foam::PDFTransportModels::populationBalanceModels |
166 | 165 | ::velocityPopulationBalance::CoNum() const | ::velocityPopulationBalance::CoNum() const |
167 | 166 | { | { |
168 | 167 | return velocityPDFTransportModel::CoNum(); | return velocityPDFTransportModel::CoNum(); |
169 | 168 | } | } |
170 | 169 | ||
171 | void Foam::PDFTransportModels::populationBalanceModels | ||
172 | ::velocityPopulationBalance::solve() | ||
170 | |||
171 | bool | ||
172 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
173 | ::solveMomentSources() const | ||
173 | 174 | { | { |
174 | velocityPDFTransportModel::solve(); | ||
175 | return odeType::solveSources_; | ||
175 | 176 | } | } |
176 | 177 | ||
177 | void Foam::PDFTransportModels::populationBalanceModels | ||
178 | ::velocityPopulationBalance::meanTransport | ||
179 | ( | ||
180 | const surfaceScalarField& phi, | ||
181 | const bool wallCollisions | ||
182 | ) | ||
178 | |||
179 | bool | ||
180 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
181 | ::solveMomentOde() const | ||
183 | 182 | { | { |
184 | velocityPDFTransportModel::meanTransport(phi, wallCollisions); | ||
183 | return odeType::solveOde_; | ||
185 | 184 | } | } |
186 | 185 | ||
187 | void Foam::PDFTransportModels::populationBalanceModels | ||
188 | ::velocityPopulationBalance::relativeTransport | ||
189 | ( | ||
190 | const mappedPtrList<volVectorField>& Vs, | ||
191 | const bool wallCollisions | ||
192 | ) | ||
186 | |||
187 | void | ||
188 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
189 | ::solve() | ||
190 | { | ||
191 | collisionKernel_->preUpdate(); | ||
192 | velocityPDFTransportModel::solve(); | ||
193 | } | ||
194 | |||
195 | |||
196 | bool | ||
197 | Foam::PDFTransportModels::populationBalanceModels::velocityPopulationBalance | ||
198 | ::readIfModified() | ||
193 | 199 | { | { |
194 | velocityPDFTransportModel::relativeTransport(Vs, wallCollisions); | ||
200 | odeType::read | ||
201 | ( | ||
202 | populationBalanceProperties_.subDict(type() + "Coeffs") | ||
203 | ); | ||
204 | |||
205 | return true; | ||
195 | 206 | } | } |
196 | 207 | ||
208 | |||
197 | 209 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/velocityPopulationBalance/velocityPopulationBalance.H changed (mode: 100644) (index d10a6c9..2c685ef) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2018-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
39 | 39 | #include "velocityPDFTransportModel.H" | #include "velocityPDFTransportModel.H" |
40 | 40 | #include "populationBalanceModel.H" | #include "populationBalanceModel.H" |
41 | 41 | #include "collisionKernel.H" | #include "collisionKernel.H" |
42 | #include "realizableOdeSolver.H" | ||
42 | 43 | ||
43 | 44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 45 | ||
... | ... | namespace populationBalanceModels | |
55 | 56 | ||
56 | 57 | class velocityPopulationBalance | class velocityPopulationBalance |
57 | 58 | : | : |
58 | public velocityPDFTransportModel, public populationBalanceModel | ||
59 | public velocityPDFTransportModel, | ||
60 | public populationBalanceModel, | ||
61 | public realizableOdeSolver<volVelocityMoment, volVelocityNode> | ||
59 | 62 | { | { |
60 | // Private data | ||
63 | protected: | ||
61 | 64 | ||
62 | //- Name of the velocityPopulationBalance | ||
63 | const word name_; | ||
65 | typedef realizableOdeSolver<volVelocityMoment, volVelocityNode> odeType; | ||
66 | |||
67 | // protected data | ||
64 | 68 | ||
65 | 69 | //- Switch indicating the status of the aggregation model | //- Switch indicating the status of the aggregation model |
66 | 70 | Switch collision_; | Switch collision_; |
... | ... | class velocityPopulationBalance | |
74 | 78 | ||
75 | 79 | // Private member functions | // Private member functions |
76 | 80 | ||
77 | //- Return if collisions are on | ||
78 | virtual bool collision() const; | ||
79 | |||
80 | 81 | //- Update implicit collison source terms | //- Update implicit collison source terms |
81 | virtual void updateImplicitCollisionSource(); | ||
82 | |||
83 | //- Update explicit collison source terms | ||
84 | virtual void updateExplicitCollisionSource(const label celli); | ||
82 | virtual void updateImplicitMomentSource(); | ||
85 | 83 | ||
86 | 84 | //- Calculate implicit source terms | //- Calculate implicit source terms |
87 | virtual tmp<fvScalarMatrix> implicitCollisionSource | ||
85 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
88 | 86 | ( | ( |
89 | const volVectorMoment& moment | ||
87 | const volVelocityMoment& moment | ||
90 | 88 | ); | ); |
91 | 89 | ||
92 | virtual scalar explicitCollisionSource | ||
93 | ( | ||
94 | const label momenti, | ||
95 | const label celli | ||
96 | ); | ||
90 | //- Calculate explicit source terms with realizable ODE solver | ||
91 | virtual void explicitMomentSource(); | ||
92 | |||
93 | //- Are moments updated due to sources | ||
94 | virtual bool solveMomentSources() const; | ||
95 | |||
96 | //- Is the realizable ode solver used to solve sources | ||
97 | virtual bool solveMomentOde() const; | ||
98 | |||
99 | //- Update explicit collison source terms | ||
100 | virtual void updateCellMomentSource(const label celli); | ||
97 | 101 | ||
98 | 102 | //- Calculate source term for moment equation in the specified cell | //- Calculate source term for moment equation in the specified cell |
99 | 103 | virtual scalar cellMomentSource | virtual scalar cellMomentSource |
100 | 104 | ( | ( |
101 | const label momentOrder, | ||
102 | const label celli | ||
105 | const labelList& momentOrder, | ||
106 | const label celli, | ||
107 | const velocityQuadratureApproximation& quadrature, | ||
108 | const label enviroment = 0 | ||
103 | 109 | ); | ); |
104 | 110 | ||
111 | |||
105 | 112 | public: | public: |
106 | 113 | ||
107 | 114 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
133 | 140 | //- Solve population balance equation | //- Solve population balance equation |
134 | 141 | virtual void solve(); | virtual void solve(); |
135 | 142 | ||
136 | //- Solve mean tranport | ||
137 | virtual void meanTransport | ||
138 | ( | ||
139 | const surfaceScalarField& phi, | ||
140 | const bool wallCollisions | ||
141 | ); | ||
142 | |||
143 | //- Solve relative transport | ||
144 | virtual void relativeTransport | ||
145 | ( | ||
146 | const mappedPtrList<volVectorField>& Vs, | ||
147 | const bool wallCollisions | ||
148 | ); | ||
143 | //- Read | ||
144 | virtual bool readIfModified(); | ||
149 | 145 | }; | }; |
150 | 146 | ||
151 | 147 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/Make/options changed (mode: 100644) (index dbdec2d..a9b411a) | |||
... | ... | EXE_INC = \ | |
13 | 13 | -I../../mappedList \ | -I../../mappedList \ |
14 | 14 | -I../../mappedPtrList \ | -I../../mappedPtrList \ |
15 | 15 | -I../momentSets/lnInclude \ | -I../momentSets/lnInclude \ |
16 | -I../quadratureNode \ | ||
16 | -I../quadratureNode/lnInclude \ | ||
17 | 17 | -I../moments \ | -I../moments \ |
18 | 18 | -I../momentInversion/univariate/basic/lnInclude \ | -I../momentInversion/univariate/basic/lnInclude \ |
19 | 19 | -I../fieldMomentInversion/lnInclude | -I../fieldMomentInversion/lnInclude |
... | ... | LIB_LIBS = \ | |
31 | 31 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
32 | 32 | -leigenSolver \ | -leigenSolver \ |
33 | 33 | -lvandermonde \ | -lvandermonde \ |
34 | -lquadratureNode \ | ||
34 | 35 | -lmomentSets \ | -lmomentSets \ |
35 | 36 | -lmomentInversion \ | -lmomentInversion \ |
36 | 37 | -lfieldMomentInversion | -lfieldMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/monoKineticQuadratureApproximation/monoKineticQuadratureApproximation.C changed (mode: 100755) (index 3e3ca56..fedde4e) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | |
100 | 100 | IOobject::groupName | IOobject::groupName |
101 | 101 | ( | ( |
102 | 102 | Foam::name(mi), | Foam::name(mi), |
103 | "air" | ||
103 | name_ | ||
104 | 104 | ) | ) |
105 | 105 | ), | ), |
106 | 106 | mesh_.time().timeName(), | mesh_.time().timeName(), |
... | ... | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | |
108 | 108 | IOobject::NO_READ, | IOobject::NO_READ, |
109 | 109 | IOobject::AUTO_WRITE | IOobject::AUTO_WRITE |
110 | 110 | ), | ), |
111 | volScalarField(moments_[mi])*U_, | ||
111 | this->moments_(mi)*U_, | ||
112 | 112 | UTypes | UTypes |
113 | 113 | ) | ) |
114 | 114 | ); | ); |
115 | 115 | } | } |
116 | |||
116 | 117 | nodesNei_ = autoPtr<PtrList<surfaceScalarNode>> | nodesNei_ = autoPtr<PtrList<surfaceScalarNode>> |
117 | 118 | ( | ( |
118 | 119 | new PtrList<surfaceScalarNode>(nNodes_) | new PtrList<surfaceScalarNode>(nNodes_) |
119 | 120 | ); | ); |
121 | |||
120 | 122 | nodesOwn_ = autoPtr<PtrList<surfaceScalarNode>> | nodesOwn_ = autoPtr<PtrList<surfaceScalarNode>> |
121 | 123 | ( | ( |
122 | 124 | new PtrList<surfaceScalarNode>(nNodes_) | new PtrList<surfaceScalarNode>(nNodes_) |
... | ... | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | |
125 | 127 | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); |
126 | 128 | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); |
127 | 129 | ||
130 | PtrList<dimensionSet> abscissaeDimensions(momentOrders_[0].size()); | ||
131 | labelList zeroOrder(momentOrders_[0].size(), 0); | ||
132 | |||
133 | forAll(abscissaeDimensions, dimi) | ||
134 | { | ||
135 | labelList firstOrder(zeroOrder); | ||
136 | firstOrder[dimi] = 1; | ||
137 | |||
138 | abscissaeDimensions.set | ||
139 | ( | ||
140 | dimi, | ||
141 | new dimensionSet | ||
142 | ( | ||
143 | moments_(firstOrder).dimensions()/moments_(0).dimensions() | ||
144 | ) | ||
145 | ); | ||
146 | } | ||
128 | 147 | ||
129 | 148 | // Populating interpolated nodes | // Populating interpolated nodes |
130 | 149 | forAll(nodes_(), nodei) | forAll(nodes_(), nodei) |
... | ... | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | |
154 | 173 | U_.boundaryField().types() | U_.boundaryField().types() |
155 | 174 | ) | ) |
156 | 175 | ); | ); |
176 | |||
157 | 177 | nodesNei.set | nodesNei.set |
158 | 178 | ( | ( |
159 | 179 | nodei, | nodei, |
... | ... | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | |
163 | 183 | name_, | name_, |
164 | 184 | mesh_, | mesh_, |
165 | 185 | moments_[0].dimensions(), | moments_[0].dimensions(), |
166 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
186 | abscissaeDimensions, | ||
167 | 187 | false, | false, |
168 | 188 | 0 | 0 |
169 | 189 | ) | ) |
170 | 190 | ); | ); |
191 | |||
171 | 192 | velocitiesNei_.set | velocitiesNei_.set |
172 | 193 | ( | ( |
173 | 194 | nodei, | nodei, |
... | ... | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | |
202 | 223 | name_, | name_, |
203 | 224 | mesh_, | mesh_, |
204 | 225 | moments_[0].dimensions(), | moments_[0].dimensions(), |
205 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
226 | abscissaeDimensions, | ||
206 | 227 | false, | false, |
207 | 228 | 0 | 0 |
208 | 229 | ) | ) |
209 | 230 | ); | ); |
231 | |||
210 | 232 | velocitiesOwn_.set | velocitiesOwn_.set |
211 | 233 | ( | ( |
212 | 234 | nodei, | nodei, |
... | ... | void Foam::monoKineticQuadratureApproximation::interpolateNodes() | |
283 | 305 | surfaceScalarNode& nodeOwn(nodesOwn[nodei]); | surfaceScalarNode& nodeOwn(nodesOwn[nodei]); |
284 | 306 | ||
285 | 307 | nodes_()[nodei].primaryWeight().correctBoundaryConditions(); | nodes_()[nodei].primaryWeight().correctBoundaryConditions(); |
286 | nodes_()[nodei].primaryAbscissa().correctBoundaryConditions(); | ||
308 | nodes_()[nodei].primaryAbscissae()[0].correctBoundaryConditions(); | ||
287 | 309 | ||
288 | 310 | nodeOwn.primaryWeight() = | nodeOwn.primaryWeight() = |
289 | 311 | fvc::interpolate(node.primaryWeight(), own, "reconstruct(weight)"); | fvc::interpolate(node.primaryWeight(), own, "reconstruct(weight)"); |
290 | 312 | ||
291 | nodeOwn.primaryAbscissa() = | ||
313 | nodeOwn.primaryAbscissae()[0] = | ||
292 | 314 | fvc::interpolate | fvc::interpolate |
293 | 315 | ( | ( |
294 | node.primaryAbscissa(), | ||
316 | node.primaryAbscissae()[0], | ||
295 | 317 | own, | own, |
296 | 318 | "reconstruct(abscissa)" | "reconstruct(abscissa)" |
297 | 319 | ); | ); |
... | ... | void Foam::monoKineticQuadratureApproximation::interpolateNodes() | |
303 | 325 | nodeNei.primaryWeight() = | nodeNei.primaryWeight() = |
304 | 326 | fvc::interpolate(node.primaryWeight(), nei, "reconstruct(weight)"); | fvc::interpolate(node.primaryWeight(), nei, "reconstruct(weight)"); |
305 | 327 | ||
306 | nodeNei.primaryAbscissa() = | ||
328 | nodeNei.primaryAbscissae()[0] = | ||
307 | 329 | fvc::interpolate | fvc::interpolate |
308 | 330 | ( | ( |
309 | node.primaryAbscissa(), | ||
331 | node.primaryAbscissae()[0], | ||
310 | 332 | nei, | nei, |
311 | 333 | "reconstruct(abscissa)" | "reconstruct(abscissa)" |
312 | 334 | ); | ); |
... | ... | void Foam::monoKineticQuadratureApproximation::updateBoundaryVelocities() | |
348 | 370 | nodes_()[nodei].primaryWeight().boundaryField()[patchi][facei] | nodes_()[nodei].primaryWeight().boundaryField()[patchi][facei] |
349 | 371 | > minM0_ | > minM0_ |
350 | 372 | && | && |
351 | nodes_()[nodei].primaryAbscissa().boundaryField()[patchi][facei] | ||
373 | nodes_()[nodei].primaryAbscissae()[0].boundaryField()[patchi][facei] | ||
352 | 374 | > SMALL | > SMALL |
353 | 375 | ) | ) |
354 | 376 | { | { |
... | ... | void Foam::monoKineticQuadratureApproximation::updateBoundaryVelocities() | |
373 | 395 | velocityMoments_[1].boundaryField()[patchi][facei] | velocityMoments_[1].boundaryField()[patchi][facei] |
374 | 396 | /( | /( |
375 | 397 | nodes_()[index].primaryWeight().boundaryField()[patchi][facei] | nodes_()[index].primaryWeight().boundaryField()[patchi][facei] |
376 | *nodes_()[index].primaryAbscissa().boundaryField()[patchi][facei] | ||
398 | *nodes_()[index].primaryAbscissae()[0].boundaryField()[patchi][facei] | ||
377 | 399 | ); | ); |
378 | 400 | } | } |
379 | 401 | else if (nNonZeroNodes > 1) | else if (nNonZeroNodes > 1) |
... | ... | void Foam::monoKineticQuadratureApproximation::updateBoundaryVelocities() | |
387 | 409 | if (nonZeroNodes[nodei]) | if (nonZeroNodes[nodei]) |
388 | 410 | { | { |
389 | 411 | x[nodej] = | x[nodej] = |
390 | nodes_()[nodei].primaryAbscissa().boundaryField()[patchi][facei]; | ||
412 | nodes_()[nodei].primaryAbscissae()[0].boundaryField()[patchi][facei]; | ||
391 | 413 | ||
392 | 414 | invR[nodej][nodej] = | invR[nodej][nodej] = |
393 | 415 | 1.0 | 1.0 |
... | ... | void Foam::monoKineticQuadratureApproximation::updateBoundaryVelocities() | |
424 | 446 | { | { |
425 | 447 | if (nonZeroNodes[nodei]) | if (nonZeroNodes[nodei]) |
426 | 448 | { | { |
427 | velocityAbscissae_[nodei].boundaryFieldRef()[patchi][facei].component(cmpti) = Ucmpt[nodej][0]; | ||
449 | velocityAbscissae_[nodei].boundaryFieldRef()[patchi][facei].component(cmpti) | ||
450 | = Ucmpt[nodej][0]; | ||
451 | |||
428 | 452 | nodej++; | nodej++; |
429 | 453 | } | } |
430 | 454 | } | } |
... | ... | void Foam::monoKineticQuadratureApproximation::updateBoundaryVelocities() | |
437 | 461 | if (!nonZeroNodes[nodei]) | if (!nonZeroNodes[nodei]) |
438 | 462 | { | { |
439 | 463 | velocityAbscissae_[nodei].boundaryFieldRef()[patchi][facei] | velocityAbscissae_[nodei].boundaryFieldRef()[patchi][facei] |
440 | = U_.boundaryField()[patchi][facei]; | ||
464 | = U_.boundaryField()[patchi][facei]; | ||
441 | 465 | } | } |
442 | 466 | } | } |
443 | 467 | } | } |
... | ... | void Foam::monoKineticQuadratureApproximation::updateAllQuadrature() | |
509 | 533 | } | } |
510 | 534 | ||
511 | 535 | updateQuadrature(); | updateQuadrature(); |
512 | |||
513 | 536 | updateVelocities(); | updateVelocities(); |
514 | 537 | updateBoundaryVelocities(); | updateBoundaryVelocities(); |
515 | |||
516 | 538 | updateAllMoments(); | updateAllMoments(); |
517 | 539 | } | } |
518 | 540 | ||
... | ... | bool Foam::monoKineticQuadratureApproximation::updateAllLocalQuadrature | |
551 | 573 | } | } |
552 | 574 | ||
553 | 575 | bool realizable = updateLocalQuadrature(celli, failOnRealizability); | bool realizable = updateLocalQuadrature(celli, failOnRealizability); |
554 | updateLocalVelocities(celli); | ||
555 | 576 | ||
577 | updateLocalVelocities(celli); | ||
556 | 578 | updateAllLocalMoments(celli); | updateAllLocalMoments(celli); |
557 | 579 | ||
558 | 580 | return realizable; | return realizable; |
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocities | |
589 | 611 | if | if |
590 | 612 | ( | ( |
591 | 613 | nodes_()[nodei].primaryWeight()[celli] > minM0_ | nodes_()[nodei].primaryWeight()[celli] > minM0_ |
592 | && nodes_()[nodei].primaryAbscissa()[celli] > SMALL | ||
614 | && nodes_()[nodei].primaryAbscissae()[0][celli] > SMALL | ||
593 | 615 | ) | ) |
594 | 616 | { | { |
595 | 617 | nonZeroNodes[nodei] = true; | nonZeroNodes[nodei] = true; |
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocities | |
601 | 623 | if (nNonZeroNodes == 1) | if (nNonZeroNodes == 1) |
602 | 624 | { | { |
603 | 625 | label index = -1; | label index = -1; |
626 | |||
604 | 627 | forAll(nonZeroNodes, nodei) | forAll(nonZeroNodes, nodei) |
605 | 628 | { | { |
606 | 629 | if (nonZeroNodes[nodei]) | if (nonZeroNodes[nodei]) |
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocities | |
609 | 632 | break; | break; |
610 | 633 | } | } |
611 | 634 | } | } |
635 | |||
612 | 636 | velocityAbscissae_[index][celli] = | velocityAbscissae_[index][celli] = |
613 | 637 | velocityMoments_[1][celli] | velocityMoments_[1][celli] |
614 | 638 | /( | /( |
615 | 639 | nodes_()[index].primaryWeight()[celli] | nodes_()[index].primaryWeight()[celli] |
616 | *nodes_()[index].primaryAbscissa()[celli] | ||
640 | *nodes_()[index].primaryAbscissae()[0][celli] | ||
617 | 641 | ); | ); |
618 | 642 | } | } |
619 | 643 | else if (nNonZeroNodes > 1) | else if (nNonZeroNodes > 1) |
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocities | |
622 | 646 | scalarSquareMatrix invR(nNonZeroNodes, 0.0); | scalarSquareMatrix invR(nNonZeroNodes, 0.0); |
623 | 647 | scalarDiagonalMatrix x(nNonZeroNodes, 0.0); | scalarDiagonalMatrix x(nNonZeroNodes, 0.0); |
624 | 648 | label nodej = 0; | label nodej = 0; |
649 | |||
625 | 650 | for (label nodei = 0; nodei < nNodes_; nodei++) | for (label nodei = 0; nodei < nNodes_; nodei++) |
626 | 651 | { | { |
627 | 652 | if (nonZeroNodes[nodei]) | if (nonZeroNodes[nodei]) |
628 | 653 | { | { |
629 | 654 | x[nodej] = | x[nodej] = |
630 | nodes_()[nodei].primaryAbscissa()[celli]; | ||
655 | nodes_()[nodei].primaryAbscissae()[0][celli]; | ||
631 | 656 | ||
632 | 657 | invR[nodej][nodej] = | invR[nodej][nodej] = |
633 | 658 | 1.0/nodes_()[nodei].primaryWeight()[celli]; | 1.0/nodes_()[nodei].primaryWeight()[celli]; |
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocities | |
645 | 670 | { | { |
646 | 671 | scalarRectangularMatrix Upcmpt(nNonZeroNodes, 1, 0.0); | scalarRectangularMatrix Upcmpt(nNonZeroNodes, 1, 0.0); |
647 | 672 | label nodej = 0; | label nodej = 0; |
673 | |||
648 | 674 | for (label nodei = 0; nodei < nNodes_; nodei++) | for (label nodei = 0; nodei < nNodes_; nodei++) |
649 | 675 | { | { |
650 | 676 | if (nonZeroNodes[nodei]) | if (nonZeroNodes[nodei]) |
651 | 677 | { | { |
652 | 678 | Upcmpt[nodej][0] = | Upcmpt[nodej][0] = |
653 | 679 | velocityMoments_[nodei][celli].component(cmpti); | velocityMoments_[nodei][celli].component(cmpti); |
680 | |||
654 | 681 | nodej++; | nodej++; |
655 | 682 | } | } |
656 | 683 | } | } |
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocities | |
658 | 685 | // Compute U_{\alpha} cmptI component using invVR matrix | // Compute U_{\alpha} cmptI component using invVR matrix |
659 | 686 | scalarRectangularMatrix Ucmpt = invVR*Upcmpt; | scalarRectangularMatrix Ucmpt = invVR*Upcmpt; |
660 | 687 | nodej = 0; | nodej = 0; |
688 | |||
661 | 689 | for (label nodei = 0; nodei < nNodes_; nodei++) | for (label nodei = 0; nodei < nNodes_; nodei++) |
662 | 690 | { | { |
663 | 691 | if (nonZeroNodes[nodei]) | if (nonZeroNodes[nodei]) |
664 | 692 | { | { |
665 | 693 | velocityAbscissae_[nodei][celli].component(cmpti) = | velocityAbscissae_[nodei][celli].component(cmpti) = |
666 | 694 | Ucmpt[nodej][0]; | Ucmpt[nodej][0]; |
695 | |||
667 | 696 | nodej++; | nodej++; |
668 | 697 | } | } |
669 | 698 | } | } |
... | ... | void Foam::monoKineticQuadratureApproximation::updateVelocityMoments() | |
710 | 739 | { | { |
711 | 740 | velocityMoments_[mi] += | velocityMoments_[mi] += |
712 | 741 | nodes_()[nodei].primaryWeight() | nodes_()[nodei].primaryWeight() |
713 | *pow(nodes_()[nodei].primaryAbscissa(), mi) | ||
742 | *pow(nodes_()[nodei].primaryAbscissae()[0], mi) | ||
714 | 743 | *velocityAbscissae_[nodei]; | *velocityAbscissae_[nodei]; |
715 | 744 | } | } |
716 | 745 | ||
... | ... | void Foam::monoKineticQuadratureApproximation::updateLocalVelocityMoments | |
744 | 773 | { | { |
745 | 774 | velocityMoments_[mi][celli] += | velocityMoments_[mi][celli] += |
746 | 775 | nodes_()[nodei].primaryWeight()[celli] | nodes_()[nodei].primaryWeight()[celli] |
747 | *pow(nodes_()[nodei].primaryAbscissa()[celli], mi) | ||
776 | *pow(nodes_()[nodei].primaryAbscissae()[0][celli], mi) | ||
748 | 777 | *velocityAbscissae_[nodei][celli]; | *velocityAbscissae_[nodei][celli]; |
749 | 778 | } | } |
750 | 779 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/monoKineticQuadratureApproximation/monoKineticQuadratureApproximation.H changed (mode: 100755) (index 2c8f2ea..55ab1bb) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace Foam | |
60 | 60 | ||
61 | 61 | class monoKineticQuadratureApproximation | class monoKineticQuadratureApproximation |
62 | 62 | : | : |
63 | public quadratureApproximation<volUnivariateMomentFieldSet, volScalarNode> | ||
63 | public quadratureApproximation<volScalarMoment, volScalarNode> | ||
64 | 64 | { | { |
65 | 65 | // Private data | // Private data |
66 | 66 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/monoKineticQuadratureApproximation/monoKineticQuadratureApproximationI.H changed (mode: 100755) (index c43724e..fcbd844) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximation.C changed (mode: 100755) (index e138a61..e788f36) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // |
29 | 29 | ||
30 | template<class momentFieldSetType, class nodeType> | ||
31 | const Foam::word Foam::quadratureApproximation<momentFieldSetType, nodeType>:: | ||
30 | template<class momentType, class nodeType> | ||
31 | const Foam::word Foam::quadratureApproximation<momentType, nodeType>:: | ||
32 | 32 | propertiesName("quadratureProperties"); | propertiesName("quadratureProperties"); |
33 | 33 | ||
34 | 34 | ||
35 | 35 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
36 | 36 | ||
37 | template<class momentFieldSetType, class nodeType> | ||
38 | Foam::quadratureApproximation<momentFieldSetType, nodeType>:: | ||
37 | template<class momentType, class nodeType> | ||
38 | Foam::quadratureApproximation<momentType, nodeType>:: | ||
39 | 39 | quadratureApproximation | quadratureApproximation |
40 | 40 | ( | ( |
41 | 41 | const word& name, | const word& name, |
... | ... | quadratureApproximation | |
61 | 61 | ( | ( |
62 | 62 | const_cast | const_cast |
63 | 63 | < | < |
64 | const quadratureApproximation<momentFieldSetType, nodeType>& | ||
64 | const quadratureApproximation<momentType, nodeType>& | ||
65 | 65 | >(*this).lookup("moments") | >(*this).lookup("moments") |
66 | 66 | ), | ), |
67 | 67 | nodeIndexes_ | nodeIndexes_ |
68 | 68 | ( | ( |
69 | 69 | const_cast | const_cast |
70 | 70 | < | < |
71 | const quadratureApproximation<momentFieldSetType, nodeType>& | ||
71 | const quadratureApproximation<momentType, nodeType>& | ||
72 | 72 | >(*this).lookup("nodes") | >(*this).lookup("nodes") |
73 | 73 | ), | ), |
74 | nNodes_(momentOrders_[0].size(), 1), | ||
74 | 75 | nodes_(), | nodes_(), |
75 | 76 | moments_(name_, *this, mesh_, nodes_, support), | moments_(name_, *this, mesh_, nodes_, support), |
76 | 77 | nDimensions_(moments_[0].cmptOrders().size()), | nDimensions_(moments_[0].cmptOrders().size()), |
... | ... | quadratureApproximation | |
80 | 81 | lookupOrDefault<label>("nSecondaryNodes", nMoments_ + 1) | lookupOrDefault<label>("nSecondaryNodes", nMoments_ + 1) |
81 | 82 | ), | ), |
82 | 83 | support_(support), | support_(support), |
83 | momentFieldInverter_ | ||
84 | ( | ||
84 | momentFieldInverter_() | ||
85 | { | ||
86 | forAll(nodeIndexes_, nodei) | ||
87 | { | ||
88 | forAll(nNodes_, dimi) | ||
89 | { | ||
90 | nNodes_[dimi] = max(nNodes_[dimi], nodeIndexes_[nodei][dimi] + 1); | ||
91 | } | ||
92 | } | ||
93 | |||
94 | PtrList<dimensionSet> abscissaeDimensions(momentOrders_[0].size()); | ||
95 | labelList zeroOrder(momentOrders_[0].size(), 0); | ||
96 | labelList velocityIndexes; | ||
97 | |||
98 | forAll(abscissaeDimensions, dimi) | ||
99 | { | ||
100 | labelList firstOrder(zeroOrder); | ||
101 | firstOrder[dimi] = 1; | ||
102 | |||
103 | abscissaeDimensions.set | ||
104 | ( | ||
105 | dimi, | ||
106 | new dimensionSet | ||
107 | ( | ||
108 | moments_(firstOrder).dimensions()/moments_(0).dimensions() | ||
109 | ) | ||
110 | ); | ||
111 | |||
112 | if (abscissaeDimensions[dimi] == dimVelocity) | ||
113 | { | ||
114 | velocityIndexes.append(dimi); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | if (velocityIndexes.size() == 0) | ||
119 | { | ||
120 | velocityIndexes.append(-1); | ||
121 | } | ||
122 | |||
123 | momentFieldInverter_ = | ||
85 | 124 | fieldMomentInversion::New | fieldMomentInversion::New |
86 | 125 | ( | ( |
87 | 126 | (*this), | (*this), |
88 | 127 | mesh_, | mesh_, |
89 | 128 | momentOrders_, | momentOrders_, |
90 | 129 | nodeIndexes_, | nodeIndexes_, |
130 | velocityIndexes, | ||
91 | 131 | nSecondaryNodes_ | nSecondaryNodes_ |
92 | ) | ||
93 | ) | ||
94 | { | ||
132 | ); | ||
133 | |||
95 | 134 | // Allocating nodes | // Allocating nodes |
96 | 135 | nodes_ = autoPtr<mappedPtrList<nodeType>> | nodes_ = autoPtr<mappedPtrList<nodeType>> |
97 | 136 | ( | ( |
... | ... | quadratureApproximation | |
103 | 142 | name_, | name_, |
104 | 143 | mesh_, | mesh_, |
105 | 144 | moments_[0].dimensions(), | moments_[0].dimensions(), |
106 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
145 | abscissaeDimensions, | ||
107 | 146 | moments_[0].boundaryField().types(), | moments_[0].boundaryField().types(), |
108 | 147 | momentFieldInverter_().extended(), | momentFieldInverter_().extended(), |
109 | 148 | nSecondaryNodes_ | nSecondaryNodes_ |
... | ... | quadratureApproximation | |
117 | 156 | } | } |
118 | 157 | ||
119 | 158 | ||
120 | template<class momentFieldSetType, class nodeType> | ||
121 | Foam::quadratureApproximation<momentFieldSetType, nodeType>:: | ||
159 | template<class momentType, class nodeType> | ||
160 | Foam::quadratureApproximation<momentType, nodeType>:: | ||
122 | 161 | quadratureApproximation | quadratureApproximation |
123 | 162 | ( | ( |
124 | 163 | const word& dictName, | const word& dictName, |
... | ... | quadratureApproximation | |
146 | 185 | ( | ( |
147 | 186 | const_cast | const_cast |
148 | 187 | < | < |
149 | const quadratureApproximation<momentFieldSetType, nodeType>& | ||
188 | const quadratureApproximation<momentType, nodeType>& | ||
150 | 189 | >(*this).lookup("moments") | >(*this).lookup("moments") |
151 | 190 | ), | ), |
152 | 191 | nodeIndexes_ | nodeIndexes_ |
153 | 192 | ( | ( |
154 | 193 | const_cast | const_cast |
155 | 194 | < | < |
156 | const quadratureApproximation<momentFieldSetType, nodeType>& | ||
195 | const quadratureApproximation<momentType, nodeType>& | ||
157 | 196 | >(*this).lookup("nodes") | >(*this).lookup("nodes") |
158 | 197 | ), | ), |
198 | nNodes_(momentOrders_[0].size(), 1), | ||
159 | 199 | nodes_(), | nodes_(), |
160 | 200 | moments_ | moments_ |
161 | 201 | ( | ( |
... | ... | quadratureApproximation | |
173 | 213 | lookupOrDefault<label>("nSecondaryNodes", nMoments_ + 1) | lookupOrDefault<label>("nSecondaryNodes", nMoments_ + 1) |
174 | 214 | ), | ), |
175 | 215 | support_(mFieldSet.support()), | support_(mFieldSet.support()), |
176 | momentFieldInverter_ | ||
177 | ( | ||
178 | fieldMomentInversion::New | ||
179 | ( | ||
180 | (*this), | ||
181 | mesh_, | ||
182 | momentOrders_, | ||
183 | nodeIndexes_, | ||
184 | nSecondaryNodes_ | ||
185 | ) | ||
186 | ) | ||
216 | momentFieldInverter_() | ||
187 | 217 | { | { |
188 | if (nSecondaryNodes_ != 0 && !momentFieldInverter_().extended()) | ||
218 | forAll(nodeIndexes_, nodei) | ||
189 | 219 | { | { |
190 | WarningInFunction | ||
191 | << "The number of secondary nodes in the quadrature" << nl | ||
192 | << " approximation is not zero, but the selected" << nl | ||
193 | << " inversion algorithm is not of extended type." << nl | ||
194 | << " Proceeding with nSecondaryNodes = 0." << nl | ||
195 | << " No extended quadrature will be computed." << nl; | ||
220 | forAll(nNodes_, dimi) | ||
221 | { | ||
222 | nNodes_[dimi] = max(nNodes_[dimi], nodeIndexes_[nodei][dimi] + 1); | ||
223 | } | ||
196 | 224 | } | } |
197 | 225 | ||
198 | 226 | forAll(moments_, mi) | forAll(moments_, mi) |
... | ... | quadratureApproximation | |
200 | 228 | moments_.set | moments_.set |
201 | 229 | ( | ( |
202 | 230 | mi, | mi, |
203 | new volUnivariateMoment | ||
231 | new momentType | ||
204 | 232 | ( | ( |
205 | 233 | name_ + Foam::name(mi), | name_ + Foam::name(mi), |
206 | 234 | mFieldSet[mi].cmptOrders(), | mFieldSet[mi].cmptOrders(), |
... | ... | quadratureApproximation | |
210 | 238 | ); | ); |
211 | 239 | } | } |
212 | 240 | ||
241 | PtrList<dimensionSet> abscissaeDimensions(momentOrders_[0].size()); | ||
242 | labelList zeroOrder(momentOrders_[0].size(), 0); | ||
243 | labelList velocityIndexes; | ||
244 | |||
245 | forAll(abscissaeDimensions, dimi) | ||
246 | { | ||
247 | labelList firstOrder(zeroOrder); | ||
248 | firstOrder[dimi] = 1; | ||
249 | |||
250 | abscissaeDimensions.set | ||
251 | ( | ||
252 | dimi, | ||
253 | new dimensionSet | ||
254 | ( | ||
255 | moments_(firstOrder).dimensions()/moments_(0).dimensions() | ||
256 | ) | ||
257 | ); | ||
258 | |||
259 | if (abscissaeDimensions[dimi] == dimVelocity) | ||
260 | { | ||
261 | velocityIndexes.append(dimi); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | momentFieldInverter_ = | ||
266 | fieldMomentInversion::New | ||
267 | ( | ||
268 | (*this), | ||
269 | mesh_, | ||
270 | momentOrders_, | ||
271 | nodeIndexes_, | ||
272 | velocityIndexes, | ||
273 | nSecondaryNodes_ | ||
274 | ); | ||
275 | |||
276 | if (nSecondaryNodes_ != 0 && !momentFieldInverter_().extended()) | ||
277 | { | ||
278 | WarningInFunction | ||
279 | << "The number of secondary nodes in the quadrature" << nl | ||
280 | << " approximation is not zero, but the selected" << nl | ||
281 | << " inversion algorithm is not of extended type." << nl | ||
282 | << " Proceeding with nSecondaryNodes = 0." << nl | ||
283 | << " No extended quadrature will be computed." << nl; | ||
284 | } | ||
285 | |||
213 | 286 | // Allocating nodes | // Allocating nodes |
214 | 287 | nodes_ = autoPtr<mappedPtrList<nodeType>> | nodes_ = autoPtr<mappedPtrList<nodeType>> |
215 | 288 | ( | ( |
... | ... | quadratureApproximation | |
221 | 294 | name_, | name_, |
222 | 295 | mesh_, | mesh_, |
223 | 296 | moments_[0].dimensions(), | moments_[0].dimensions(), |
224 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
297 | abscissaeDimensions, | ||
225 | 298 | moments_[0].boundaryField().types(), | moments_[0].boundaryField().types(), |
226 | 299 | momentFieldInverter_().extended(), | momentFieldInverter_().extended(), |
227 | 300 | nSecondaryNodes_ | nSecondaryNodes_ |
... | ... | quadratureApproximation | |
240 | 313 | ||
241 | 314 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
242 | 315 | ||
243 | template<class momentFieldSetType, class nodeType> | ||
244 | Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
316 | template<class momentType, class nodeType> | ||
317 | Foam::quadratureApproximation<momentType, nodeType> | ||
245 | 318 | ::~quadratureApproximation() | ::~quadratureApproximation() |
246 | 319 | {} | {} |
247 | 320 | ||
248 | 321 | ||
249 | 322 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
250 | 323 | ||
251 | template<class momentFieldSetType, class nodeType> | ||
252 | void Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
324 | template<class momentType, class nodeType> | ||
325 | void Foam::quadratureApproximation<momentType, nodeType> | ||
253 | 326 | ::updateQuadrature() | ::updateQuadrature() |
254 | 327 | { | { |
255 | 328 | momentFieldInverter_().invert(moments_, nodes_()); | momentFieldInverter_().invert(moments_, nodes_()); |
256 | 329 | updateMoments(); | updateMoments(); |
257 | 330 | } | } |
258 | 331 | ||
259 | template<class momentFieldSetType, class nodeType> | ||
260 | void Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
332 | template<class momentType, class nodeType> | ||
333 | void Foam::quadratureApproximation<momentType, nodeType> | ||
334 | ::updateBoundaryQuadrature() | ||
335 | { | ||
336 | momentFieldInverter_().invertBoundaryMoments(moments_, nodes_()); | ||
337 | moments_.updateBoundaries(); | ||
338 | } | ||
339 | |||
340 | template<class momentType, class nodeType> | ||
341 | void Foam::quadratureApproximation<momentType, nodeType> | ||
261 | 342 | ::updateMoments() | ::updateMoments() |
262 | 343 | { | { |
263 | 344 | moments_.update(); | moments_.update(); |
264 | 345 | } | } |
265 | 346 | ||
266 | template<class momentFieldSetType, class nodeType> | ||
267 | void Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
347 | template<class momentType, class nodeType> | ||
348 | void Foam::quadratureApproximation<momentType, nodeType> | ||
268 | 349 | ::updateLocalMoments(label celli) | ::updateLocalMoments(label celli) |
269 | 350 | { | { |
270 | 351 | moments_.updateLocalMoments(celli); | moments_.updateLocalMoments(celli); |
271 | 352 | } | } |
272 | 353 | ||
273 | template<class momentFieldSetType, class nodeType> | ||
274 | bool Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
354 | template<class momentType, class nodeType> | ||
355 | bool Foam::quadratureApproximation<momentType, nodeType> | ||
275 | 356 | ::updateLocalQuadrature(label celli, bool fatalErrorOnFailedRealizabilityTest) | ::updateLocalQuadrature(label celli, bool fatalErrorOnFailedRealizabilityTest) |
276 | 357 | { | { |
277 | 358 | bool realizable = momentFieldInverter_().invertLocalMoments | bool realizable = momentFieldInverter_().invertLocalMoments |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximation.H changed (mode: 100755) (index 7296307..7aa9640) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
46 | 46 | #include "volFields.H" | #include "volFields.H" |
47 | 47 | #include "surfaceFields.H" | #include "surfaceFields.H" |
48 | 48 | #include "fieldMomentInversion.H" | #include "fieldMomentInversion.H" |
49 | #include "volVelocityNode.H" | ||
50 | #include "surfaceVelocityNode.H" | ||
49 | 51 | ||
50 | 52 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
51 | 53 | ||
... | ... | namespace Foam | |
56 | 58 | Class univariateQuadratureApproximation Declaration | Class univariateQuadratureApproximation Declaration |
57 | 59 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
58 | 60 | ||
59 | template <class momentFieldSetType, class nodeType> | ||
61 | template <class momentType, class nodeType> | ||
60 | 62 | class quadratureApproximation | class quadratureApproximation |
61 | 63 | : | : |
62 | 64 | public IOdictionary | public IOdictionary |
... | ... | class quadratureApproximation | |
64 | 66 | protected: | protected: |
65 | 67 | // Protected data | // Protected data |
66 | 68 | ||
69 | typedef momentFieldSet<momentType, nodeType> momentFieldSetType; | ||
70 | |||
67 | 71 | //- Name of the quadrature approximation | //- Name of the quadrature approximation |
68 | 72 | const word name_; | const word name_; |
69 | 73 | ||
... | ... | protected: | |
78 | 82 | //- Node indexes used to map nodes | //- Node indexes used to map nodes |
79 | 83 | const labelListList nodeIndexes_; | const labelListList nodeIndexes_; |
80 | 84 | ||
85 | //- Number of nodes in each direction | ||
86 | labelList nNodes_; | ||
87 | |||
81 | 88 | //- AutoPtr to the mappedPtrList of quadrature nodes | //- AutoPtr to the mappedPtrList of quadrature nodes |
82 | 89 | autoPtr<mappedPtrList<nodeType>> nodes_; | autoPtr<mappedPtrList<nodeType>> nodes_; |
83 | 90 | ||
... | ... | public: | |
138 | 145 | //- Return name | //- Return name |
139 | 146 | inline const word name() const; | inline const word name() const; |
140 | 147 | ||
148 | //- Return the nmber of nodes in each direction | ||
149 | const labelList& nNodes() const; | ||
150 | |||
141 | 151 | //- Extended moment inversion method | //- Extended moment inversion method |
142 | 152 | inline fieldMomentInversion& momentFieldInverter(); | inline fieldMomentInversion& momentFieldInverter(); |
143 | 153 | ||
... | ... | public: | |
171 | 181 | //- Recalculate the quadrature nodes from the moments | //- Recalculate the quadrature nodes from the moments |
172 | 182 | void updateQuadrature(); | void updateQuadrature(); |
173 | 183 | ||
184 | //- Recalculate the quadrature nodes from the moments | ||
185 | // on boundaries | ||
186 | void updateBoundaryQuadrature(); | ||
174 | 187 | //- Recalculate the moments from the quadrature nodes | //- Recalculate the moments from the quadrature nodes |
175 | 188 | void updateMoments(); | void updateMoments(); |
176 | 189 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximationI.H changed (mode: 100755) (index d5a9cd4..17952d9) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
25 | 25 | ||
26 | 26 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
27 | 27 | ||
28 | template <class momentFieldSetType, class nodeType> | ||
28 | template <class momentType, class nodeType> | ||
29 | 29 | const word | const word |
30 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::name() const | ||
30 | Foam::quadratureApproximation<momentType, nodeType>::name() const | ||
31 | 31 | { | { |
32 | 32 | return name_; | return name_; |
33 | 33 | } | } |
34 | 34 | ||
35 | template <class momentFieldSetType, class nodeType> | ||
35 | template <class momentType, class nodeType> | ||
36 | const labelList& | ||
37 | Foam::quadratureApproximation<momentType, nodeType>::nNodes() const | ||
38 | { | ||
39 | return nNodes_; | ||
40 | } | ||
41 | |||
42 | template <class momentType, class nodeType> | ||
36 | 43 | Foam::fieldMomentInversion& | Foam::fieldMomentInversion& |
37 | Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
44 | Foam::quadratureApproximation<momentType, nodeType> | ||
38 | 45 | ::momentFieldInverter() | ::momentFieldInverter() |
39 | 46 | { | { |
40 | 47 | return momentFieldInverter_(); | return momentFieldInverter_(); |
41 | 48 | } | } |
42 | 49 | ||
43 | template <class momentFieldSetType, class nodeType> | ||
50 | template <class momentType, class nodeType> | ||
44 | 51 | const Foam::mappedPtrList<nodeType>& | const Foam::mappedPtrList<nodeType>& |
45 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nodes() const | ||
52 | Foam::quadratureApproximation<momentType, nodeType>::nodes() const | ||
46 | 53 | { | { |
47 | 54 | return nodes_(); | return nodes_(); |
48 | 55 | } | } |
49 | 56 | ||
50 | template <class momentFieldSetType, class nodeType> | ||
57 | template <class momentType, class nodeType> | ||
51 | 58 | Foam::mappedPtrList<nodeType>& | Foam::mappedPtrList<nodeType>& |
52 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nodes() | ||
59 | Foam::quadratureApproximation<momentType, nodeType>::nodes() | ||
53 | 60 | { | { |
54 | 61 | return nodes_(); | return nodes_(); |
55 | 62 | } | } |
56 | 63 | ||
57 | template <class momentFieldSetType, class nodeType> | ||
58 | const momentFieldSetType& | ||
59 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::moments() const | ||
64 | template <class momentType, class nodeType> | ||
65 | const momentFieldSet<momentType, nodeType>& | ||
66 | Foam::quadratureApproximation<momentType, nodeType>::moments() const | ||
60 | 67 | { | { |
61 | 68 | return moments_; | return moments_; |
62 | 69 | } | } |
63 | 70 | ||
64 | template <class momentFieldSetType, class nodeType> | ||
65 | momentFieldSetType& | ||
66 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::moments() | ||
71 | template <class momentType, class nodeType> | ||
72 | momentFieldSet<momentType, nodeType>& | ||
73 | Foam::quadratureApproximation<momentType, nodeType>::moments() | ||
67 | 74 | { | { |
68 | 75 | return moments_; | return moments_; |
69 | 76 | } | } |
70 | 77 | ||
71 | template <class momentFieldSetType, class nodeType> | ||
78 | template <class momentType, class nodeType> | ||
72 | 79 | Foam::label | Foam::label |
73 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nDimensions() const | ||
80 | Foam::quadratureApproximation<momentType, nodeType>::nDimensions() const | ||
74 | 81 | { | { |
75 | 82 | return nDimensions_; | return nDimensions_; |
76 | 83 | } | } |
77 | 84 | ||
78 | template <class momentFieldSetType, class nodeType> | ||
85 | template <class momentType, class nodeType> | ||
79 | 86 | Foam::label | Foam::label |
80 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nMoments() const | ||
87 | Foam::quadratureApproximation<momentType, nodeType>::nMoments() const | ||
81 | 88 | { | { |
82 | 89 | return nMoments_; | return nMoments_; |
83 | 90 | } | } |
84 | 91 | ||
85 | template <class momentFieldSetType, class nodeType> | ||
92 | template <class momentType, class nodeType> | ||
86 | 93 | const Foam::labelListList& | const Foam::labelListList& |
87 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::momentOrders() const | ||
94 | Foam::quadratureApproximation<momentType, nodeType>::momentOrders() const | ||
88 | 95 | { | { |
89 | 96 | return momentOrders_; | return momentOrders_; |
90 | 97 | } | } |
91 | 98 | ||
92 | template <class momentFieldSetType, class nodeType> | ||
99 | template <class momentType, class nodeType> | ||
93 | 100 | const Foam::labelListList& | const Foam::labelListList& |
94 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nodeIndexes() const | ||
101 | Foam::quadratureApproximation<momentType, nodeType>::nodeIndexes() const | ||
95 | 102 | { | { |
96 | 103 | return nodeIndexes_; | return nodeIndexes_; |
97 | 104 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximations.H changed (mode: 100644) (index 9e882d3..b36175c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
37 | 37 | #include "quadratureNodes.H" | #include "quadratureNodes.H" |
38 | 38 | #include "momentFieldSets.H" | #include "momentFieldSets.H" |
39 | 39 | #include "quadratureApproximation.H" | #include "quadratureApproximation.H" |
40 | #include "monoKineticQuadratureApproximation.H" | ||
41 | 40 | ||
42 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
43 | 42 | ||
44 | 43 | namespace Foam | namespace Foam |
45 | 44 | { | { |
46 | 45 | ||
47 | typedef quadratureApproximation<volUnivariateMomentFieldSet, volScalarNode> | ||
48 | univariateQuadratureApproximation; | ||
46 | typedef quadratureApproximation<volScalarMoment, volScalarNode> | ||
47 | scalarQuadratureApproximation; | ||
49 | 48 | ||
50 | typedef quadratureApproximation<volVectorMomentFieldSet, volVectorNode> | ||
49 | typedef quadratureApproximation<volVelocityMoment, volVelocityNode> | ||
51 | 50 | velocityQuadratureApproximation; | velocityQuadratureApproximation; |
52 | 51 | ||
53 | 52 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/Make/files added (mode: 100644) (index 0000000..b83e913) | |||
1 | velocityQuadratureNode/volVelocityNode.C | ||
2 | velocityQuadratureNode/surfaceVelocityNode.C | ||
3 | |||
4 | |||
5 | LIB = $(FOAM_USER_LIBBIN)/libquadratureNode |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/Make/options added (mode: 100644) (index 0000000..136cb29) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../../mappedList \ | ||
4 | -I../../mappedPtrList \ | ||
5 | -I../momentSets/lnInclude \ | ||
6 | -I../moments \ | ||
7 | |||
8 | LIB_LIBS = |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.C deleted (index 29d4987..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2018 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 "quadratureNode.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | template <class weightType, class abscissaType, class sigmaType> | ||
30 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
31 | quadratureNode | ||
32 | ( | ||
33 | const word& name, | ||
34 | const word& distributionName, | ||
35 | const fvMesh& mesh, | ||
36 | const dimensionSet& weightDimensions, | ||
37 | const dimensionSet& abscissaDimensions, | ||
38 | const bool extended, | ||
39 | const label nSecondaryNodes | ||
40 | ) | ||
41 | : | ||
42 | name_(IOobject::groupName(name, distributionName)), | ||
43 | weight_ | ||
44 | ( | ||
45 | IOobject | ||
46 | ( | ||
47 | IOobject::groupName("weight", name_), | ||
48 | mesh.time().timeName(), | ||
49 | mesh, | ||
50 | IOobject::NO_READ, | ||
51 | IOobject::NO_WRITE | ||
52 | ), | ||
53 | mesh, | ||
54 | dimensioned<typename weightType::value_type> | ||
55 | ( | ||
56 | "zeroWeight", | ||
57 | weightDimensions, | ||
58 | pTraits<typename weightType::value_type>::zero | ||
59 | ) | ||
60 | ), | ||
61 | abscissa_ | ||
62 | ( | ||
63 | IOobject | ||
64 | ( | ||
65 | IOobject::groupName("abscissa", name_), | ||
66 | mesh.time().timeName(), | ||
67 | mesh, | ||
68 | IOobject::NO_READ, | ||
69 | IOobject::NO_WRITE | ||
70 | ), | ||
71 | mesh, | ||
72 | dimensioned<typename abscissaType::value_type> | ||
73 | ( | ||
74 | "zeroAbscissa", | ||
75 | abscissaDimensions, | ||
76 | pTraits<typename abscissaType::value_type>::zero | ||
77 | ) | ||
78 | ), | ||
79 | secondaryWeights_(), | ||
80 | secondaryAbscissae_(), | ||
81 | sigma_(), | ||
82 | nSecondaryNodes_(nSecondaryNodes), | ||
83 | extended_(extended) | ||
84 | { | ||
85 | if (extended_) | ||
86 | { | ||
87 | // Allocating secondary quadrature only if the node is of extended type | ||
88 | secondaryWeights_.setSize(nSecondaryNodes_); | ||
89 | secondaryAbscissae_.setSize(nSecondaryNodes_); | ||
90 | |||
91 | // Allocating secondary weights and abscissae | ||
92 | forAll(secondaryWeights_, nodei) | ||
93 | { | ||
94 | secondaryWeights_.set | ||
95 | ( | ||
96 | nodei, | ||
97 | new weightType | ||
98 | ( | ||
99 | IOobject | ||
100 | ( | ||
101 | IOobject::groupName | ||
102 | ( | ||
103 | "secondaryWeight." + Foam::name(nodei), | ||
104 | name_ | ||
105 | ), | ||
106 | mesh.time().timeName(), | ||
107 | mesh, | ||
108 | IOobject::NO_READ, | ||
109 | IOobject::NO_WRITE | ||
110 | ), | ||
111 | mesh, | ||
112 | dimensioned<typename weightType::value_type> | ||
113 | ( | ||
114 | "zeroWeight", | ||
115 | dimless, | ||
116 | pTraits<typename weightType::value_type>::zero | ||
117 | ) | ||
118 | ) | ||
119 | ); | ||
120 | |||
121 | secondaryAbscissae_.set | ||
122 | ( | ||
123 | nodei, | ||
124 | new abscissaType | ||
125 | ( | ||
126 | IOobject | ||
127 | ( | ||
128 | IOobject::groupName | ||
129 | ( | ||
130 | "secondaryAbscissa." + Foam::name(nodei), | ||
131 | name_ | ||
132 | ), | ||
133 | mesh.time().timeName(), | ||
134 | mesh, | ||
135 | IOobject::NO_READ, | ||
136 | IOobject::NO_WRITE | ||
137 | ), | ||
138 | mesh, | ||
139 | dimensioned<typename abscissaType::value_type> | ||
140 | ( | ||
141 | "zeroAbscissa", | ||
142 | abscissaDimensions, | ||
143 | pTraits<typename abscissaType::value_type>::zero | ||
144 | ) | ||
145 | ) | ||
146 | ); | ||
147 | } | ||
148 | |||
149 | // Allocating sigma | ||
150 | sigma_.set | ||
151 | ( | ||
152 | new sigmaType | ||
153 | ( | ||
154 | IOobject | ||
155 | ( | ||
156 | IOobject::groupName("sigma", name_), | ||
157 | mesh.time().timeName(), | ||
158 | mesh, | ||
159 | IOobject::NO_READ, | ||
160 | IOobject::NO_WRITE | ||
161 | ), | ||
162 | mesh, | ||
163 | dimensioned<typename sigmaType::value_type> | ||
164 | ( | ||
165 | "zeroSigma", | ||
166 | dimless, | ||
167 | pTraits<typename sigmaType::value_type>::zero | ||
168 | ) | ||
169 | ) | ||
170 | ); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | |||
175 | template <class weightType, class abscissaType, class sigmaType> | ||
176 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
177 | quadratureNode | ||
178 | ( | ||
179 | const word& name, | ||
180 | const word& distributionName, | ||
181 | const fvMesh& mesh, | ||
182 | const dimensionSet& weightDimensions, | ||
183 | const dimensionSet& abscissaDimensions, | ||
184 | const wordList& boundaryTypes, | ||
185 | const bool extended, | ||
186 | const label nSecondaryNodes | ||
187 | ) | ||
188 | : | ||
189 | name_(IOobject::groupName(name, distributionName)), | ||
190 | weight_ | ||
191 | ( | ||
192 | IOobject | ||
193 | ( | ||
194 | IOobject::groupName("weight", name_), | ||
195 | mesh.time().timeName(), | ||
196 | mesh, | ||
197 | IOobject::NO_READ, | ||
198 | IOobject::NO_WRITE | ||
199 | ), | ||
200 | mesh, | ||
201 | dimensioned<typename weightType::value_type> | ||
202 | ( | ||
203 | "zeroWeight", | ||
204 | weightDimensions, | ||
205 | pTraits<typename weightType::value_type>::zero | ||
206 | ) | ||
207 | ), | ||
208 | abscissa_ | ||
209 | ( | ||
210 | IOobject | ||
211 | ( | ||
212 | IOobject::groupName("abscissa", name_), | ||
213 | mesh.time().timeName(), | ||
214 | mesh, | ||
215 | IOobject::NO_READ, | ||
216 | IOobject::NO_WRITE | ||
217 | ), | ||
218 | mesh, | ||
219 | dimensioned<typename abscissaType::value_type> | ||
220 | ( | ||
221 | "zeroAbscissa", | ||
222 | abscissaDimensions, | ||
223 | pTraits<typename abscissaType::value_type>::zero | ||
224 | ) | ||
225 | ), | ||
226 | secondaryWeights_(), | ||
227 | secondaryAbscissae_(), | ||
228 | sigma_(), | ||
229 | nSecondaryNodes_(nSecondaryNodes), | ||
230 | extended_(extended) | ||
231 | { | ||
232 | if (extended_) | ||
233 | { | ||
234 | // Allocating secondary quadrature only if the node is of extended type | ||
235 | secondaryWeights_.setSize(nSecondaryNodes_); | ||
236 | secondaryAbscissae_.setSize(nSecondaryNodes_); | ||
237 | |||
238 | // Allocating secondary weights and abscissae | ||
239 | forAll(secondaryWeights_, nodei) | ||
240 | { | ||
241 | secondaryWeights_.set | ||
242 | ( | ||
243 | nodei, | ||
244 | new weightType | ||
245 | ( | ||
246 | IOobject | ||
247 | ( | ||
248 | IOobject::groupName | ||
249 | ( | ||
250 | "secondaryWeight." + Foam::name(nodei), | ||
251 | name_ | ||
252 | ), | ||
253 | mesh.time().timeName(), | ||
254 | mesh, | ||
255 | IOobject::NO_READ, | ||
256 | IOobject::NO_WRITE | ||
257 | ), | ||
258 | mesh, | ||
259 | dimensioned<typename weightType::value_type> | ||
260 | ( | ||
261 | "zeroWeight", | ||
262 | dimless, | ||
263 | pTraits<typename weightType::value_type>::zero | ||
264 | ), | ||
265 | boundaryTypes | ||
266 | ) | ||
267 | ); | ||
268 | |||
269 | secondaryAbscissae_.set | ||
270 | ( | ||
271 | nodei, | ||
272 | new abscissaType | ||
273 | ( | ||
274 | IOobject | ||
275 | ( | ||
276 | IOobject::groupName | ||
277 | ( | ||
278 | "secondaryAbscissa." + Foam::name(nodei), | ||
279 | name_ | ||
280 | ), | ||
281 | mesh.time().timeName(), | ||
282 | mesh, | ||
283 | IOobject::NO_READ, | ||
284 | IOobject::NO_WRITE | ||
285 | ), | ||
286 | mesh, | ||
287 | dimensioned<typename abscissaType::value_type> | ||
288 | ( | ||
289 | "zeroAbscissa", | ||
290 | abscissaDimensions, | ||
291 | pTraits<typename abscissaType::value_type>::zero | ||
292 | ), | ||
293 | boundaryTypes | ||
294 | ) | ||
295 | ); | ||
296 | |||
297 | } | ||
298 | |||
299 | sigma_.set | ||
300 | ( | ||
301 | new sigmaType | ||
302 | ( | ||
303 | IOobject | ||
304 | ( | ||
305 | IOobject::groupName("sigma", name_), | ||
306 | mesh.time().timeName(), | ||
307 | mesh, | ||
308 | IOobject::NO_READ, | ||
309 | IOobject::NO_WRITE, | ||
310 | true | ||
311 | ), | ||
312 | mesh, | ||
313 | dimensioned<typename sigmaType::value_type> | ||
314 | ( | ||
315 | "zeroSigma", | ||
316 | dimless, | ||
317 | pTraits<typename sigmaType::value_type>::zero | ||
318 | ), | ||
319 | boundaryTypes | ||
320 | ) | ||
321 | ); | ||
322 | } | ||
323 | } | ||
324 | |||
325 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
326 | |||
327 | template <class weightType, class abscissaType, class sigmaType> | ||
328 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
329 | ~quadratureNode() | ||
330 | {} | ||
331 | |||
332 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
333 | |||
334 | template <class weightType, class abscissaType, class sigmaType> | ||
335 | Foam::autoPtr | ||
336 | < | ||
337 | Foam::quadratureNode<weightType, abscissaType, sigmaType> | ||
338 | > | ||
339 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::clone() const | ||
340 | { | ||
341 | notImplemented("quadratureNode::clone() const"); | ||
342 | return autoPtr | ||
343 | < | ||
344 | quadratureNode<weightType, abscissaType, sigmaType> | ||
345 | >(NULL); | ||
346 | } | ||
347 | |||
348 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode/quadratureNode.C added (mode: 100644) (index 0000000..57bbb51) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "quadratureNode.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | template<class scalarType, class vectorType> | ||
30 | Foam::quadratureNode<scalarType, vectorType>::quadratureNode | ||
31 | ( | ||
32 | const word& name, | ||
33 | const word& distributionName, | ||
34 | const fvMesh& mesh, | ||
35 | const dimensionSet& weightDimensions, | ||
36 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
37 | const bool extended, | ||
38 | const label nSecondaryNodes | ||
39 | ) | ||
40 | : | ||
41 | name_(IOobject::groupName(name, distributionName)), | ||
42 | weight_ | ||
43 | ( | ||
44 | IOobject | ||
45 | ( | ||
46 | IOobject::groupName("weight", name_), | ||
47 | mesh.time().timeName(), | ||
48 | mesh, | ||
49 | IOobject::NO_READ, | ||
50 | IOobject::NO_WRITE | ||
51 | ), | ||
52 | mesh, | ||
53 | dimensioned<typename weightType::value_type> | ||
54 | ( | ||
55 | "zeroWeight", | ||
56 | weightDimensions, | ||
57 | pTraits<typename weightType::value_type>::zero | ||
58 | ) | ||
59 | ), | ||
60 | abscissae_(), | ||
61 | scalarIndexes_(), | ||
62 | velocityIndexes_(), | ||
63 | sizeIndex_(-1), | ||
64 | lengthBased_(false), | ||
65 | massBased_(false), | ||
66 | useVolumeFraction_(false), | ||
67 | secondaryWeights_(), | ||
68 | secondaryAbscissae_(), | ||
69 | sigmas_(), | ||
70 | nSecondaryNodes_(nSecondaryNodes), | ||
71 | extended_(extended) | ||
72 | { | ||
73 | if (weightDimensions == dimless) | ||
74 | { | ||
75 | useVolumeFraction_ = true; | ||
76 | } | ||
77 | |||
78 | forAll(abscissaeDimensions, dimi) | ||
79 | { | ||
80 | if (abscissaeDimensions[dimi] == dimVelocity) | ||
81 | { | ||
82 | velocityIndexes_.append(dimi); | ||
83 | } | ||
84 | else | ||
85 | { | ||
86 | scalarIndexes_.append(dimi); | ||
87 | |||
88 | if | ||
89 | ( | ||
90 | (abscissaeDimensions[dimi] == dimMass) | ||
91 | || (abscissaeDimensions[dimi] == dimVolume) | ||
92 | || (abscissaeDimensions[dimi] == dimLength) | ||
93 | ) | ||
94 | { | ||
95 | if (sizeIndex_ != -1) | ||
96 | { | ||
97 | FatalErrorInFunction | ||
98 | << "Only one abscissae can be sized based." | ||
99 | << abort(FatalError); | ||
100 | } | ||
101 | |||
102 | sizeIndex_ = dimi; | ||
103 | |||
104 | if (abscissaeDimensions[dimi] == dimLength) | ||
105 | { | ||
106 | lengthBased_ = true; | ||
107 | } | ||
108 | else if (abscissaeDimensions[dimi] == dimMass) | ||
109 | { | ||
110 | massBased_ = true; | ||
111 | word rhoName = IOobject::groupName("thermo:rho", name_); | ||
112 | |||
113 | if (mesh.foundObject<volScalarField>(rhoName)) | ||
114 | { | ||
115 | rhoPtr_ = &mesh.lookupObject<volScalarField>(rhoName); | ||
116 | } | ||
117 | } | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | abscissae_.resize(scalarIndexes_.size()); | ||
123 | |||
124 | if (extended_) | ||
125 | { | ||
126 | secondaryWeights_.resize(scalarIndexes_.size()); | ||
127 | secondaryAbscissae_.resize(scalarIndexes_.size()); | ||
128 | sigmas_.resize(scalarIndexes_.size()); | ||
129 | } | ||
130 | |||
131 | forAll(abscissae_, dimi) | ||
132 | { | ||
133 | label cmpt = scalarIndexes_[dimi]; | ||
134 | abscissae_.set | ||
135 | ( | ||
136 | dimi, | ||
137 | new abscissaType | ||
138 | ( | ||
139 | IOobject | ||
140 | ( | ||
141 | IOobject::groupName("abscissa" + Foam::name(dimi), name_), | ||
142 | mesh.time().timeName(), | ||
143 | mesh, | ||
144 | IOobject::NO_READ, | ||
145 | IOobject::NO_WRITE | ||
146 | ), | ||
147 | mesh, | ||
148 | dimensionedScalar | ||
149 | ( | ||
150 | "zeroAbscissa", | ||
151 | abscissaeDimensions[cmpt], | ||
152 | 0.0 | ||
153 | ) | ||
154 | ) | ||
155 | ); | ||
156 | |||
157 | if (extended_) | ||
158 | { | ||
159 | // Allocating secondary quadrature only if the node is of extended | ||
160 | // type | ||
161 | secondaryWeights_.set | ||
162 | ( | ||
163 | dimi, | ||
164 | new PtrList<weightType>(nSecondaryNodes_) | ||
165 | ); | ||
166 | secondaryAbscissae_.set | ||
167 | ( | ||
168 | dimi, | ||
169 | new abscissaeType(nSecondaryNodes_) | ||
170 | ); | ||
171 | |||
172 | // Allocating secondary weights and abscissae | ||
173 | forAll(secondaryWeights_[dimi], sNodei) | ||
174 | { | ||
175 | secondaryWeights_[dimi].set | ||
176 | ( | ||
177 | sNodei, | ||
178 | new weightType | ||
179 | ( | ||
180 | IOobject | ||
181 | ( | ||
182 | IOobject::groupName | ||
183 | ( | ||
184 | "secondaryWeight" | ||
185 | + Foam::name(dimi) | ||
186 | + '.' | ||
187 | + Foam::name(sNodei), | ||
188 | name_ | ||
189 | ), | ||
190 | mesh.time().timeName(), | ||
191 | mesh, | ||
192 | IOobject::NO_READ, | ||
193 | IOobject::NO_WRITE | ||
194 | ), | ||
195 | mesh, | ||
196 | dimensionedScalar("zeroWeight", dimless, 0.0) | ||
197 | ) | ||
198 | ); | ||
199 | |||
200 | secondaryAbscissae_[dimi].set | ||
201 | ( | ||
202 | sNodei, | ||
203 | new abscissaType | ||
204 | ( | ||
205 | IOobject | ||
206 | ( | ||
207 | IOobject::groupName | ||
208 | ( | ||
209 | "secondaryAbscissa" | ||
210 | + Foam::name(dimi) | ||
211 | + '.' | ||
212 | + Foam::name(sNodei), | ||
213 | name_ | ||
214 | ), | ||
215 | mesh.time().timeName(), | ||
216 | mesh, | ||
217 | IOobject::NO_READ, | ||
218 | IOobject::NO_WRITE | ||
219 | ), | ||
220 | mesh, | ||
221 | dimensionedScalar | ||
222 | ( | ||
223 | "zeroAbscissa", | ||
224 | abscissaeDimensions[cmpt], | ||
225 | 0.0 | ||
226 | ) | ||
227 | ) | ||
228 | ); | ||
229 | } | ||
230 | |||
231 | // Allocating sigma | ||
232 | sigmas_.set | ||
233 | ( | ||
234 | dimi, | ||
235 | new sigmaType | ||
236 | ( | ||
237 | IOobject | ||
238 | ( | ||
239 | IOobject::groupName("sigma", name_), | ||
240 | mesh.time().timeName(), | ||
241 | mesh, | ||
242 | IOobject::NO_READ, | ||
243 | IOobject::NO_WRITE | ||
244 | ), | ||
245 | mesh, | ||
246 | dimensionedScalar("zeroSigma", dimless, 0.0) | ||
247 | ) | ||
248 | ); | ||
249 | } | ||
250 | } | ||
251 | } | ||
252 | |||
253 | |||
254 | template<class scalarType, class vectorType> | ||
255 | Foam::quadratureNode<scalarType, vectorType>::quadratureNode | ||
256 | ( | ||
257 | const word& name, | ||
258 | const word& distributionName, | ||
259 | const fvMesh& mesh, | ||
260 | const dimensionSet& weightDimensions, | ||
261 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
262 | const wordList& boundaryTypes, | ||
263 | const bool extended, | ||
264 | const label nSecondaryNodes | ||
265 | ) | ||
266 | : | ||
267 | name_(IOobject::groupName(name, distributionName)), | ||
268 | weight_ | ||
269 | ( | ||
270 | IOobject | ||
271 | ( | ||
272 | IOobject::groupName("weight", name_), | ||
273 | mesh.time().timeName(), | ||
274 | mesh, | ||
275 | IOobject::NO_READ, | ||
276 | IOobject::NO_WRITE | ||
277 | ), | ||
278 | mesh, | ||
279 | dimensioned<typename weightType::value_type> | ||
280 | ( | ||
281 | "zeroWeight", | ||
282 | weightDimensions, | ||
283 | pTraits<typename weightType::value_type>::zero | ||
284 | ), | ||
285 | boundaryTypes | ||
286 | ), | ||
287 | abscissae_(), | ||
288 | scalarIndexes_(), | ||
289 | velocityIndexes_(), | ||
290 | sizeIndex_(-1), | ||
291 | lengthBased_(false), | ||
292 | massBased_(false), | ||
293 | useVolumeFraction_(false), | ||
294 | secondaryWeights_(), | ||
295 | secondaryAbscissae_(), | ||
296 | sigmas_(), | ||
297 | nSecondaryNodes_(nSecondaryNodes), | ||
298 | extended_(extended) | ||
299 | { | ||
300 | if (weightDimensions == dimless) | ||
301 | { | ||
302 | useVolumeFraction_ = true; | ||
303 | } | ||
304 | |||
305 | forAll(abscissaeDimensions, dimi) | ||
306 | { | ||
307 | if (abscissaeDimensions[dimi] == dimVelocity) | ||
308 | { | ||
309 | velocityIndexes_.append(dimi); | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | scalarIndexes_.append(dimi); | ||
314 | |||
315 | if | ||
316 | ( | ||
317 | (abscissaeDimensions[dimi] == dimMass) | ||
318 | || (abscissaeDimensions[dimi] == dimVolume) | ||
319 | || (abscissaeDimensions[dimi] == dimLength) | ||
320 | ) | ||
321 | { | ||
322 | if (sizeIndex_ != -1) | ||
323 | { | ||
324 | FatalErrorInFunction | ||
325 | << "Only one abscissae can be sized based." | ||
326 | << abort(FatalError); | ||
327 | } | ||
328 | |||
329 | sizeIndex_ = dimi; | ||
330 | |||
331 | if (abscissaeDimensions[dimi] == dimLength) | ||
332 | { | ||
333 | lengthBased_ = true; | ||
334 | } | ||
335 | else if (abscissaeDimensions[dimi] == dimMass) | ||
336 | { | ||
337 | massBased_ = true; | ||
338 | word rhoName = | ||
339 | IOobject::groupName | ||
340 | ( | ||
341 | "thermo:rho", | ||
342 | IOobject::group(name_) | ||
343 | ); | ||
344 | |||
345 | if (mesh.foundObject<volScalarField>(rhoName)) | ||
346 | { | ||
347 | rhoPtr_ = &mesh.lookupObject<volScalarField>(rhoName); | ||
348 | } | ||
349 | } | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | |||
354 | abscissae_.resize(scalarIndexes_.size()); | ||
355 | |||
356 | if (extended_) | ||
357 | { | ||
358 | secondaryWeights_.resize(scalarIndexes_.size()); | ||
359 | secondaryAbscissae_.resize(scalarIndexes_.size()); | ||
360 | sigmas_.resize(scalarIndexes_.size()); | ||
361 | } | ||
362 | |||
363 | forAll(abscissae_, dimi) | ||
364 | { | ||
365 | label cmpt = scalarIndexes_[dimi]; | ||
366 | abscissae_.set | ||
367 | ( | ||
368 | dimi, | ||
369 | new abscissaType | ||
370 | ( | ||
371 | IOobject | ||
372 | ( | ||
373 | IOobject::groupName("abscissa" + Foam::name(dimi), name_), | ||
374 | mesh.time().timeName(), | ||
375 | mesh, | ||
376 | IOobject::NO_READ, | ||
377 | IOobject::NO_WRITE | ||
378 | ), | ||
379 | mesh, | ||
380 | dimensionedScalar | ||
381 | ( | ||
382 | "zeroAbscissa", | ||
383 | abscissaeDimensions[cmpt], | ||
384 | 0.0 | ||
385 | ), | ||
386 | boundaryTypes | ||
387 | ) | ||
388 | ); | ||
389 | |||
390 | if (extended_) | ||
391 | { | ||
392 | // Allocating secondary quadrature only if the node is of extended | ||
393 | // type | ||
394 | secondaryWeights_.set | ||
395 | ( | ||
396 | dimi, | ||
397 | new PtrList<weightType>(nSecondaryNodes_) | ||
398 | ); | ||
399 | |||
400 | secondaryAbscissae_.set | ||
401 | ( | ||
402 | dimi, | ||
403 | new abscissaeType(nSecondaryNodes_) | ||
404 | ); | ||
405 | |||
406 | // Allocating secondary weights and abscissae | ||
407 | forAll(secondaryWeights_[dimi], sNodei) | ||
408 | { | ||
409 | secondaryWeights_[dimi].set | ||
410 | ( | ||
411 | sNodei, | ||
412 | new weightType | ||
413 | ( | ||
414 | IOobject | ||
415 | ( | ||
416 | IOobject::groupName | ||
417 | ( | ||
418 | "secondaryWeight" | ||
419 | + Foam::name(dimi) | ||
420 | + '.' | ||
421 | + Foam::name(sNodei), | ||
422 | name_ | ||
423 | ), | ||
424 | mesh.time().timeName(), | ||
425 | mesh, | ||
426 | IOobject::NO_READ, | ||
427 | IOobject::NO_WRITE | ||
428 | ), | ||
429 | mesh, | ||
430 | dimensionedScalar("zeroWeight", dimless, 0.0), | ||
431 | boundaryTypes | ||
432 | ) | ||
433 | ); | ||
434 | |||
435 | secondaryAbscissae_[dimi].set | ||
436 | ( | ||
437 | sNodei, | ||
438 | new abscissaType | ||
439 | ( | ||
440 | IOobject | ||
441 | ( | ||
442 | IOobject::groupName | ||
443 | ( | ||
444 | "secondaryAbscissa" | ||
445 | + Foam::name(dimi) | ||
446 | + '.' | ||
447 | + Foam::name(sNodei), | ||
448 | name_ | ||
449 | ), | ||
450 | mesh.time().timeName(), | ||
451 | mesh, | ||
452 | IOobject::NO_READ, | ||
453 | IOobject::NO_WRITE | ||
454 | ), | ||
455 | mesh, | ||
456 | dimensionedScalar | ||
457 | ( | ||
458 | "zeroAbscissa", | ||
459 | abscissaeDimensions[cmpt], | ||
460 | 0.0 | ||
461 | ), | ||
462 | boundaryTypes | ||
463 | ) | ||
464 | ); | ||
465 | } | ||
466 | |||
467 | // Allocating sigma | ||
468 | sigmas_.set | ||
469 | ( | ||
470 | dimi, | ||
471 | new sigmaType | ||
472 | ( | ||
473 | IOobject | ||
474 | ( | ||
475 | IOobject::groupName("sigma", name_), | ||
476 | mesh.time().timeName(), | ||
477 | mesh, | ||
478 | IOobject::NO_READ, | ||
479 | IOobject::NO_WRITE | ||
480 | ), | ||
481 | mesh, | ||
482 | dimensionedScalar("zeroSigma", dimless, 0.0), | ||
483 | boundaryTypes | ||
484 | ) | ||
485 | ); | ||
486 | } | ||
487 | } | ||
488 | } | ||
489 | |||
490 | |||
491 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
492 | |||
493 | template<class scalarType, class vectorType> | ||
494 | Foam::quadratureNode<scalarType, vectorType>::~quadratureNode() | ||
495 | {} | ||
496 | |||
497 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
498 | |||
499 | template<class scalarType, class vectorType> | ||
500 | Foam::autoPtr<Foam::quadratureNode<scalarType, vectorType>> | ||
501 | Foam::quadratureNode<scalarType, vectorType>::clone() const | ||
502 | { | ||
503 | notImplemented("quadratureNode::clone() const"); | ||
504 | return autoPtr<quadratureNode<scalarType, vectorType>>(NULL); | ||
505 | } | ||
506 | |||
507 | |||
508 | template<class scalarType, class vectorType> | ||
509 | Foam::tmp<Foam::volScalarField> | ||
510 | Foam::quadratureNode<scalarType, vectorType>::d | ||
511 | ( | ||
512 | const volScalarField& x | ||
513 | ) const | ||
514 | { | ||
515 | if (sizeIndex_ == -1) | ||
516 | { | ||
517 | return tmp<volScalarField> | ||
518 | ( | ||
519 | new volScalarField | ||
520 | ( | ||
521 | IOobject | ||
522 | ( | ||
523 | "d", | ||
524 | weight_.time().timeName(), | ||
525 | weight_.mesh(), | ||
526 | IOobject::NO_READ, | ||
527 | IOobject::NO_WRITE, | ||
528 | false | ||
529 | ), | ||
530 | weight_.mesh(), | ||
531 | dimensionedScalar("d", dimLength, 0.0) | ||
532 | ) | ||
533 | ); | ||
534 | } | ||
535 | |||
536 | if (lengthBased_) | ||
537 | { | ||
538 | return x; | ||
539 | } | ||
540 | |||
541 | if (massBased_ && rhoPtr_) | ||
542 | { | ||
543 | return cbrt(x*6.0/(Foam::constant::mathematical::pi*(*rhoPtr_))); | ||
544 | } | ||
545 | |||
546 | return cbrt(x*6.0/Foam::constant::mathematical::pi); | ||
547 | } | ||
548 | |||
549 | |||
550 | template<class scalarType, class vectorType> | ||
551 | Foam::scalar Foam::quadratureNode<scalarType, vectorType>::d | ||
552 | ( | ||
553 | const label celli, | ||
554 | const scalar& x | ||
555 | ) const | ||
556 | { | ||
557 | if (sizeIndex_ == -1) | ||
558 | { | ||
559 | return 0.0; | ||
560 | } | ||
561 | if (lengthBased_) | ||
562 | { | ||
563 | return x; | ||
564 | } | ||
565 | |||
566 | if (massBased_ && rhoPtr_) | ||
567 | { | ||
568 | return cbrt(x*6.0/(Foam::constant::mathematical::pi*(*rhoPtr_)[celli])); | ||
569 | } | ||
570 | return cbrt(x*6.0/Foam::constant::mathematical::pi); | ||
571 | } | ||
572 | |||
573 | |||
574 | template<class scalarType, class vectorType> | ||
575 | Foam::tmp<Foam::volScalarField> | ||
576 | Foam::quadratureNode<scalarType, vectorType>::n | ||
577 | ( | ||
578 | const volScalarField& w, | ||
579 | const volScalarField& x | ||
580 | ) const | ||
581 | { | ||
582 | if (!useVolumeFraction_) | ||
583 | { | ||
584 | return w; | ||
585 | |||
586 | } | ||
587 | |||
588 | tmp<volScalarField> v; | ||
589 | if (massBased_ && rhoPtr_) | ||
590 | { | ||
591 | v = x/(*rhoPtr_); | ||
592 | } | ||
593 | else if (lengthBased_) | ||
594 | { | ||
595 | v = pow3(x); | ||
596 | } | ||
597 | else | ||
598 | { | ||
599 | v = x; | ||
600 | } | ||
601 | |||
602 | v.ref().max(pow3(small)); | ||
603 | |||
604 | return w/v; | ||
605 | } | ||
606 | |||
607 | |||
608 | template<class scalarType, class vectorType> | ||
609 | Foam::scalar Foam::quadratureNode<scalarType, vectorType>::n | ||
610 | ( | ||
611 | const label celli, | ||
612 | const scalar& w, | ||
613 | const scalar& x | ||
614 | ) const | ||
615 | { | ||
616 | if (!useVolumeFraction_) | ||
617 | { | ||
618 | return w; | ||
619 | } | ||
620 | |||
621 | scalar v = pow3(small); | ||
622 | |||
623 | if (massBased_ && rhoPtr_) | ||
624 | { | ||
625 | v = max(v, x/(*rhoPtr_)[celli]); | ||
626 | } | ||
627 | else if (lengthBased_) | ||
628 | { | ||
629 | v = max(v, pow3(x)); | ||
630 | } | ||
631 | else | ||
632 | { | ||
633 | v = max(v, x); | ||
634 | } | ||
635 | |||
636 | return w/v; | ||
637 | } | ||
638 | |||
639 | |||
640 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode/quadratureNode.H copied from file multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.H (similarity 58%) (mode: 100644) (index bc0150b..4baf5d4) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace Foam | |
52 | 52 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
53 | 53 | Class quadratureNode Declaration | Class quadratureNode Declaration |
54 | 54 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
55 | template <class weightType, class abscissaType, class sigmaType> | ||
55 | template<class scalarType, class vectorType> | ||
56 | 56 | class quadratureNode | class quadratureNode |
57 | 57 | { | { |
58 | // Private data | ||
58 | protected: | ||
59 | |||
60 | //- Typedefs | ||
61 | |||
62 | typedef scalarType weightType; | ||
63 | typedef PtrList<PtrList<weightType>> secondaryWeightsType; | ||
64 | |||
65 | typedef scalarType abscissaType; | ||
66 | typedef PtrList<abscissaType> abscissaeType; | ||
67 | typedef PtrList<abscissaeType> secondaryAbscissaeType; | ||
68 | |||
69 | typedef vectorType velocityAbscissaeType; | ||
70 | |||
71 | typedef scalarType sigmaType; | ||
72 | typedef PtrList<sigmaType> sigmasType; | ||
73 | |||
74 | |||
75 | // Protected data | ||
59 | 76 | ||
60 | 77 | //- Name of the quadrature node | //- Name of the quadrature node |
61 | 78 | word name_; | word name_; |
... | ... | class quadratureNode | |
63 | 80 | //- Primary weight of the node | //- Primary weight of the node |
64 | 81 | weightType weight_; | weightType weight_; |
65 | 82 | ||
66 | //- Primary abscissa of the node | ||
67 | abscissaType abscissa_; | ||
83 | //- Primary abscissae of the node | ||
84 | abscissaeType abscissae_; | ||
85 | |||
86 | //- Indicies of abscissa components | ||
87 | labelList scalarIndexes_; | ||
88 | |||
89 | //- Indicies of velocity components | ||
90 | labelList velocityIndexes_; | ||
91 | |||
92 | //- Index of size component | ||
93 | label sizeIndex_; | ||
94 | |||
95 | //- Is the size length based | ||
96 | bool lengthBased_; | ||
97 | |||
98 | //- Is the size mass based | ||
99 | bool massBased_; | ||
100 | |||
101 | //- Pointer to density field | ||
102 | const volScalarField* rhoPtr_; | ||
103 | |||
104 | //- Are weights in volume fraction | ||
105 | bool useVolumeFraction_; | ||
68 | 106 | ||
69 | 107 | //- List of secondary weights of the node | //- List of secondary weights of the node |
70 | PtrList<weightType> secondaryWeights_; | ||
108 | secondaryWeightsType secondaryWeights_; | ||
71 | 109 | ||
72 | 110 | //- List of secondary abscissae of the node | //- List of secondary abscissae of the node |
73 | PtrList<abscissaType> secondaryAbscissae_; | ||
111 | secondaryAbscissaeType secondaryAbscissae_; | ||
74 | 112 | ||
75 | 113 | //- Parameter of the kernel density function used in EQMOM | //- Parameter of the kernel density function used in EQMOM |
76 | autoPtr<sigmaType> sigma_; | ||
114 | sigmasType sigmas_; | ||
77 | 115 | ||
78 | 116 | //- Number of secondary nodes | //- Number of secondary nodes |
79 | 117 | label nSecondaryNodes_; | label nSecondaryNodes_; |
... | ... | class quadratureNode | |
81 | 119 | //- Boolean variable to identify extended nodes | //- Boolean variable to identify extended nodes |
82 | 120 | bool extended_; | bool extended_; |
83 | 121 | ||
122 | |||
123 | |||
84 | 124 | public: | public: |
85 | 125 | ||
86 | 126 | // Constructors | // Constructors |
87 | 127 | ||
128 | // Constructors | ||
129 | |||
88 | 130 | //- Construct from name, mesh and dimensions | //- Construct from name, mesh and dimensions |
89 | 131 | quadratureNode | quadratureNode |
90 | 132 | ( | ( |
... | ... | public: | |
92 | 134 | const word& distributionName, | const word& distributionName, |
93 | 135 | const fvMesh& mesh, | const fvMesh& mesh, |
94 | 136 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
95 | const dimensionSet& abscissaDimensions, | ||
137 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
96 | 138 | const wordList& boundaryTypes, | const wordList& boundaryTypes, |
97 | 139 | const bool extended = false, | const bool extended = false, |
98 | 140 | const label nSecondaryNodes = 0 | const label nSecondaryNodes = 0 |
... | ... | public: | |
105 | 147 | const word& distributionName, | const word& distributionName, |
106 | 148 | const fvMesh& mesh, | const fvMesh& mesh, |
107 | 149 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
108 | const dimensionSet& abscissaDimensions, | ||
150 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
109 | 151 | const bool extended = false, | const bool extended = false, |
110 | 152 | const label nSecondaryNodes = 0 | const label nSecondaryNodes = 0 |
111 | 153 | ); | ); |
112 | 154 | ||
113 | 155 | //- Return clone | //- Return clone |
114 | autoPtr<quadratureNode<weightType, abscissaType, sigmaType>> | ||
115 | clone() const; | ||
156 | autoPtr<quadratureNode<scalarType, vectorType>> clone() const; | ||
116 | 157 | ||
117 | 158 | //- Return a pointer to a new quadrature node created on freestore | //- Return a pointer to a new quadrature node created on freestore |
118 | 159 | // from Istream | // from Istream |
... | ... | public: | |
121 | 162 | const word distributionName_; | const word distributionName_; |
122 | 163 | const fvMesh& mesh_; | const fvMesh& mesh_; |
123 | 164 | const dimensionSet& weightDimensions_; | const dimensionSet& weightDimensions_; |
124 | const dimensionSet& abscissaDimensions_; | ||
165 | const PtrList<dimensionSet>& abscissaeDimensions_; | ||
125 | 166 | const wordList& boundaryTypes_; | const wordList& boundaryTypes_; |
126 | 167 | const bool extended_; | const bool extended_; |
127 | 168 | const label nSecondaryNodes_; | const label nSecondaryNodes_; |
... | ... | public: | |
133 | 174 | const word& distributionName, | const word& distributionName, |
134 | 175 | const fvMesh& mesh, | const fvMesh& mesh, |
135 | 176 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
136 | const dimensionSet& abscissaDimensions, | ||
177 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
137 | 178 | const wordList& boundaryTypes, | const wordList& boundaryTypes, |
138 | 179 | const bool extended, | const bool extended, |
139 | 180 | const label nSecondaryNodes | const label nSecondaryNodes |
... | ... | public: | |
142 | 183 | distributionName_(distributionName), | distributionName_(distributionName), |
143 | 184 | mesh_(mesh), | mesh_(mesh), |
144 | 185 | weightDimensions_(weightDimensions), | weightDimensions_(weightDimensions), |
145 | abscissaDimensions_(abscissaDimensions), | ||
186 | abscissaeDimensions_(abscissaeDimensions), | ||
146 | 187 | boundaryTypes_(boundaryTypes), | boundaryTypes_(boundaryTypes), |
147 | 188 | extended_(extended), | extended_(extended), |
148 | 189 | nSecondaryNodes_(nSecondaryNodes) | nSecondaryNodes_(nSecondaryNodes) |
149 | 190 | {} | {} |
150 | 191 | ||
151 | autoPtr | ||
152 | < | ||
153 | quadratureNode<weightType, abscissaType, sigmaType> | ||
154 | > | ||
192 | autoPtr<quadratureNode<scalarType, vectorType>> | ||
155 | 193 | operator() | operator() |
156 | 194 | ( | ( |
157 | 195 | Istream& is | Istream& is |
158 | 196 | ) const | ) const |
159 | 197 | { | { |
160 | 198 | labelList ent(is); | labelList ent(is); |
161 | return autoPtr | ||
162 | < | ||
163 | quadratureNode<weightType, abscissaType, sigmaType> | ||
164 | > | ||
199 | |||
200 | return autoPtr<quadratureNode<scalarType, vectorType>> | ||
165 | 201 | ( | ( |
166 | new quadratureNode | ||
167 | < | ||
168 | weightType, abscissaType, sigmaType | ||
169 | > | ||
202 | new quadratureNode<scalarType, vectorType> | ||
170 | 203 | ( | ( |
171 | 204 | "node" + mappedList<scalar>::listToWord(ent), | "node" + mappedList<scalar>::listToWord(ent), |
172 | 205 | distributionName_, | distributionName_, |
173 | 206 | mesh_, | mesh_, |
174 | 207 | weightDimensions_, | weightDimensions_, |
175 | abscissaDimensions_, | ||
208 | abscissaeDimensions_, | ||
176 | 209 | boundaryTypes_, | boundaryTypes_, |
177 | 210 | extended_, | extended_, |
178 | 211 | nSecondaryNodes_ | nSecondaryNodes_ |
... | ... | public: | |
191 | 224 | // Access | // Access |
192 | 225 | ||
193 | 226 | //- Return the name of the node | //- Return the name of the node |
194 | inline const word& name() const; | ||
227 | const word& name() const; | ||
228 | |||
229 | //- Return abscissa indexes | ||
230 | const labelList& scalarIndexes() const; | ||
231 | |||
232 | //- Return velocity indexes | ||
233 | const labelList& velocityIndexes() const; | ||
234 | |||
235 | //- Return size index | ||
236 | label sizeIndex() const; | ||
237 | |||
238 | //- Is the node length based | ||
239 | bool lengthBased() const; | ||
240 | |||
241 | //- Is the weight in terms of volume fraction | ||
242 | bool useVolumeFraction() const; | ||
195 | 243 | ||
196 | inline bool extended() const; | ||
244 | //- Is the node extended | ||
245 | bool extended() const; | ||
197 | 246 | ||
198 | 247 | //- Returns the number of secondary nodes | //- Returns the number of secondary nodes |
199 | inline label nSecondaryNodes() const; | ||
248 | label nSecondaryNodes() const; | ||
200 | 249 | ||
201 | 250 | //- Const access to the weight of the node | //- Const access to the weight of the node |
202 | inline const weightType& primaryWeight() const; | ||
251 | const weightType& primaryWeight() const; | ||
203 | 252 | ||
204 | 253 | //- Non-const access to the weight of the node | //- Non-const access to the weight of the node |
205 | inline weightType& primaryWeight(); | ||
254 | weightType& primaryWeight(); | ||
206 | 255 | ||
207 | //- Const access to the abscissa of the node | ||
208 | inline const abscissaType& primaryAbscissa() const; | ||
256 | //- Const access to the scalar abscissa of the node | ||
257 | const abscissaeType& primaryAbscissae() const; | ||
209 | 258 | ||
210 | //- Non-const access to the abscissa of the node | ||
211 | inline abscissaType& primaryAbscissa(); | ||
259 | //- Non-const access to the scalar abscissa of the node | ||
260 | abscissaeType& primaryAbscissae(); | ||
212 | 261 | ||
213 | 262 | //- Const access to the secondary weights of the node | //- Const access to the secondary weights of the node |
214 | inline const PtrList<weightType>& secondaryWeights() const; | ||
263 | const secondaryWeightsType& secondaryWeights() const; | ||
215 | 264 | ||
216 | 265 | //- Non-const access to the secondary weights of the node | //- Non-const access to the secondary weights of the node |
217 | inline PtrList<weightType>& secondaryWeights(); | ||
266 | secondaryWeightsType& secondaryWeights(); | ||
218 | 267 | ||
219 | 268 | //- Const access to the list of secondary abscissae of the node | //- Const access to the list of secondary abscissae of the node |
220 | inline const PtrList<abscissaType>& secondaryAbscissae() const; | ||
269 | const secondaryAbscissaeType& secondaryAbscissae() const; | ||
221 | 270 | ||
222 | 271 | //- Non-const access to the list of secondary abscissae of the node | //- Non-const access to the list of secondary abscissae of the node |
223 | inline PtrList<abscissaType>& secondaryAbscissae(); | ||
272 | secondaryAbscissaeType& secondaryAbscissae(); | ||
224 | 273 | ||
225 | 274 | //- Const access to sigma | //- Const access to sigma |
226 | inline const sigmaType& sigma() const; | ||
275 | const sigmasType& sigmas() const; | ||
227 | 276 | ||
228 | 277 | //- Non-const access to sigma | //- Non-const access to sigma |
229 | inline sigmaType& sigma(); | ||
278 | sigmasType& sigmas(); | ||
279 | |||
280 | //- Const access to the velocity abscissa of the node | ||
281 | virtual const velocityAbscissaeType& velocityAbscissae() const; | ||
282 | |||
283 | //- Non-const access to the velcity abscissa of the node | ||
284 | virtual velocityAbscissaeType& velocityAbscissae(); | ||
285 | |||
286 | //- Return the diameter given an abscissae | ||
287 | tmp<volScalarField> d(const volScalarField& x) const; | ||
288 | |||
289 | //- Return the diameter given an abscissae and celli | ||
290 | scalar d(const label celli, const scalar& x) const; | ||
291 | |||
292 | //- Return the number density given an abscissae | ||
293 | tmp<volScalarField> n | ||
294 | ( | ||
295 | const volScalarField& w, | ||
296 | const volScalarField& x | ||
297 | ) const; | ||
298 | |||
299 | //- Return the number density given an abscissae and celli | ||
300 | scalar n(const label celli, const scalar& w, const scalar& x) const; | ||
230 | 301 | }; | }; |
231 | 302 | ||
232 | 303 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode/quadratureNodeI.H added (mode: 100644) (index 0000000..204fc59) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
25 | |||
26 | template<class scalarType, class vectorType> | ||
27 | const Foam::word& | ||
28 | Foam::quadratureNode<scalarType, vectorType>::name() const | ||
29 | { | ||
30 | return name_; | ||
31 | } | ||
32 | |||
33 | template<class scalarType, class vectorType> | ||
34 | bool Foam::quadratureNode<scalarType, vectorType>::extended() const | ||
35 | { | ||
36 | return extended_; | ||
37 | } | ||
38 | |||
39 | template<class scalarType, class vectorType> | ||
40 | const Foam::labelList& | ||
41 | Foam::quadratureNode<scalarType, vectorType>::scalarIndexes() const | ||
42 | { | ||
43 | return scalarIndexes_; | ||
44 | } | ||
45 | |||
46 | template<class scalarType, class vectorType> | ||
47 | const Foam::labelList& | ||
48 | Foam::quadratureNode<scalarType, vectorType>::velocityIndexes() const | ||
49 | { | ||
50 | return velocityIndexes_; | ||
51 | } | ||
52 | |||
53 | template<class scalarType, class vectorType> | ||
54 | Foam::label | ||
55 | Foam::quadratureNode<scalarType, vectorType>::sizeIndex() const | ||
56 | { | ||
57 | return sizeIndex_; | ||
58 | } | ||
59 | |||
60 | template<class scalarType, class vectorType> | ||
61 | bool Foam::quadratureNode<scalarType, vectorType>::lengthBased() const | ||
62 | { | ||
63 | return lengthBased_; | ||
64 | } | ||
65 | |||
66 | template<class scalarType, class vectorType> | ||
67 | bool Foam::quadratureNode<scalarType, vectorType>::useVolumeFraction() const | ||
68 | { | ||
69 | return useVolumeFraction_; | ||
70 | } | ||
71 | |||
72 | template<class scalarType, class vectorType> | ||
73 | Foam::label | ||
74 | Foam::quadratureNode<scalarType, vectorType>::nSecondaryNodes() const | ||
75 | { | ||
76 | return nSecondaryNodes_; | ||
77 | } | ||
78 | |||
79 | template<class scalarType, class vectorType> | ||
80 | const scalarType& | ||
81 | Foam::quadratureNode<scalarType, vectorType>::primaryWeight() const | ||
82 | { | ||
83 | return weight_; | ||
84 | } | ||
85 | |||
86 | template<class scalarType, class vectorType> | ||
87 | scalarType& | ||
88 | Foam::quadratureNode<scalarType, vectorType>::primaryWeight() | ||
89 | { | ||
90 | return weight_; | ||
91 | } | ||
92 | |||
93 | template<class scalarType, class vectorType> | ||
94 | const Foam::PtrList<scalarType>& | ||
95 | Foam::quadratureNode<scalarType, vectorType>::primaryAbscissae() const | ||
96 | { | ||
97 | return abscissae_; | ||
98 | } | ||
99 | |||
100 | template<class scalarType, class vectorType> | ||
101 | Foam::PtrList<scalarType>& | ||
102 | Foam::quadratureNode<scalarType, vectorType>::primaryAbscissae() | ||
103 | { | ||
104 | return abscissae_; | ||
105 | } | ||
106 | |||
107 | template<class scalarType, class vectorType> | ||
108 | const Foam::PtrList<Foam::PtrList<scalarType>>& | ||
109 | Foam::quadratureNode<scalarType, vectorType>::secondaryWeights() const | ||
110 | { | ||
111 | if (!extended_) | ||
112 | { | ||
113 | FatalErrorInFunction | ||
114 | << "Attempt to access secondary weights of a quadrature node" << nl | ||
115 | << " not of extended type. " | ||
116 | << abort(FatalError); | ||
117 | } | ||
118 | |||
119 | return secondaryWeights_; | ||
120 | } | ||
121 | |||
122 | template<class scalarType, class vectorType> | ||
123 | Foam::PtrList<Foam::PtrList<scalarType>>& | ||
124 | Foam::quadratureNode<scalarType, vectorType>::secondaryWeights() | ||
125 | { | ||
126 | if (!extended_) | ||
127 | { | ||
128 | FatalErrorInFunction | ||
129 | << "Attempt to access secondary weights of a quadrature node" << nl | ||
130 | << " not of extended type. " | ||
131 | << abort(FatalError); | ||
132 | } | ||
133 | return secondaryWeights_; | ||
134 | } | ||
135 | |||
136 | template<class scalarType, class vectorType> | ||
137 | const Foam::PtrList<Foam::PtrList<scalarType>>& | ||
138 | Foam::quadratureNode<scalarType, vectorType>::secondaryAbscissae() const | ||
139 | { | ||
140 | if (!extended_) | ||
141 | { | ||
142 | FatalErrorInFunction | ||
143 | << "Attempt to access secondary abscissae of a quadrature" << nl | ||
144 | << " node not of extended type. " | ||
145 | << abort(FatalError); | ||
146 | } | ||
147 | |||
148 | return secondaryAbscissae_; | ||
149 | } | ||
150 | |||
151 | template<class scalarType, class vectorType> | ||
152 | Foam::PtrList<Foam::PtrList<scalarType>>& | ||
153 | Foam::quadratureNode<scalarType, vectorType>::secondaryAbscissae() | ||
154 | { | ||
155 | if (!extended_) | ||
156 | { | ||
157 | FatalErrorInFunction | ||
158 | << "Attempt to access secondary abscissae of a quadrature" << nl | ||
159 | << " node not of extended type. " | ||
160 | << abort(FatalError); | ||
161 | } | ||
162 | |||
163 | return secondaryAbscissae_; | ||
164 | } | ||
165 | |||
166 | template<class scalarType, class vectorType> | ||
167 | const Foam::PtrList<scalarType>& | ||
168 | Foam::quadratureNode<scalarType, vectorType>::sigmas() const | ||
169 | { | ||
170 | if (!extended_) | ||
171 | { | ||
172 | FatalErrorInFunction | ||
173 | << "Attempt to access sigma field of a quadrature node not" << nl | ||
174 | << " of extended type. " | ||
175 | << abort(FatalError); | ||
176 | } | ||
177 | |||
178 | return sigmas_; | ||
179 | } | ||
180 | |||
181 | template<class scalarType, class vectorType> | ||
182 | Foam::PtrList<scalarType>& | ||
183 | Foam::quadratureNode<scalarType, vectorType>::sigmas() | ||
184 | { | ||
185 | if (!extended_) | ||
186 | { | ||
187 | FatalErrorInFunction | ||
188 | << "Attempt to access sigma field of a quadrature node not" << nl | ||
189 | << " of extended type. " | ||
190 | << abort(FatalError); | ||
191 | } | ||
192 | |||
193 | return sigmas_; | ||
194 | } | ||
195 | |||
196 | template<class scalarType, class vectorType> | ||
197 | const vectorType& | ||
198 | Foam::quadratureNode<scalarType, vectorType>::velocityAbscissae() const | ||
199 | { | ||
200 | FatalErrorInFunction | ||
201 | << "Attempt to access velocity abscissa of a quadrature node" << nl | ||
202 | << " with no scalar abscissa. " | ||
203 | << abort(FatalError); | ||
204 | |||
205 | return const_cast<const vectorType&>(velocityAbscissaeType::null()); | ||
206 | } | ||
207 | |||
208 | template<class scalarType, class vectorType> | ||
209 | vectorType& | ||
210 | Foam::quadratureNode<scalarType, vectorType>::velocityAbscissae() | ||
211 | { | ||
212 | FatalErrorInFunction | ||
213 | << "Attempt to access velocity abscissa of aquadrature node" << nl | ||
214 | << " with no velocity abscissa. " | ||
215 | << abort(FatalError); | ||
216 | return const_cast<vectorType&>(velocityAbscissaeType::null()); | ||
217 | } | ||
218 | |||
219 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode/quadratureNodes.H renamed from multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNodes.H (similarity 78%) (mode: 100644) (index 6806fd6..a1aa6d7) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
34 | 34 | #define quadratureNodes_H | #define quadratureNodes_H |
35 | 35 | ||
36 | 36 | #include "volFields.H" | #include "volFields.H" |
37 | #include "surfaceFields.H" | ||
37 | 38 | #include "quadratureNode.H" | #include "quadratureNode.H" |
39 | #include "velocityQuadratureNode.H" | ||
38 | 40 | ||
39 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
40 | 42 | ||
41 | 43 | namespace Foam | namespace Foam |
42 | 44 | { | { |
43 | 45 | ||
44 | typedef quadratureNode<volScalarField, volScalarField, volScalarField> | ||
45 | volScalarNode; | ||
46 | typedef quadratureNode<volScalarField, volVectorField> volScalarNode; | ||
47 | typedef quadratureNode<surfaceScalarField, surfaceVectorField> | ||
48 | surfaceScalarNode; | ||
46 | 49 | ||
47 | typedef quadratureNode | ||
48 | < | ||
49 | surfaceScalarField, surfaceScalarField, surfaceScalarField | ||
50 | > | ||
51 | surfaceScalarNode; | ||
52 | |||
53 | typedef quadratureNode<volScalarField, volVectorField, volScalarField> | ||
54 | volVectorNode; | ||
55 | |||
56 | typedef quadratureNode | ||
57 | < | ||
58 | surfaceScalarField, surfaceVectorField, surfaceScalarField | ||
59 | > | ||
60 | surfaceVectorNode; | ||
50 | typedef velocityQuadratureNode<volScalarField, volVectorField> volVelocityNode; | ||
51 | typedef velocityQuadratureNode<surfaceScalarField, surfaceVectorField> | ||
52 | surfaceVelocityNode; | ||
61 | 53 | ||
62 | 54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
63 | 55 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNodeI.H deleted (index 23903cf..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2017 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::quadratureNode<weightType, abscissaType, sigmaType>::name() const | ||
30 | { | ||
31 | return name_; | ||
32 | } | ||
33 | |||
34 | template <class weightType, class abscissaType, class sigmaType> | ||
35 | inline bool Foam::quadratureNode<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::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
44 | nSecondaryNodes() const | ||
45 | { | ||
46 | return nSecondaryNodes_; | ||
47 | } | ||
48 | |||
49 | template <class weightType, class abscissaType, class sigmaType> | ||
50 | const weightType& | ||
51 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
52 | primaryWeight() const | ||
53 | { | ||
54 | return weight_; | ||
55 | } | ||
56 | |||
57 | template <class weightType, class abscissaType, class sigmaType> | ||
58 | weightType& | ||
59 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::primaryWeight() | ||
60 | { | ||
61 | return weight_; | ||
62 | } | ||
63 | |||
64 | template <class weightType, class abscissaType, class sigmaType> | ||
65 | const abscissaType& | ||
66 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
67 | primaryAbscissa() const | ||
68 | { | ||
69 | return abscissa_; | ||
70 | } | ||
71 | |||
72 | template <class weightType, class abscissaType, class sigmaType> | ||
73 | abscissaType& | ||
74 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::primaryAbscissa() | ||
75 | { | ||
76 | return abscissa_; | ||
77 | } | ||
78 | |||
79 | template <class weightType, class abscissaType, class sigmaType> | ||
80 | const Foam::PtrList<weightType>& | ||
81 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
82 | secondaryWeights() const | ||
83 | { | ||
84 | if (!extended_) | ||
85 | { | ||
86 | FatalErrorInFunction | ||
87 | << "Attempt to access secondary weights of a quadrature node" << nl | ||
88 | << " not of extended type. " | ||
89 | << abort(FatalError); | ||
90 | } | ||
91 | |||
92 | return secondaryWeights_; | ||
93 | } | ||
94 | |||
95 | template <class weightType, class abscissaType, class sigmaType> | ||
96 | Foam::PtrList<weightType>& | ||
97 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
98 | secondaryWeights() | ||
99 | { | ||
100 | if (!extended_) | ||
101 | { | ||
102 | FatalErrorInFunction | ||
103 | << "Attempt to access secondary weights of a quadrature node" << nl | ||
104 | << " not of extended type. " | ||
105 | << abort(FatalError); | ||
106 | } | ||
107 | return secondaryWeights_; | ||
108 | } | ||
109 | |||
110 | template <class weightType, class abscissaType, class sigmaType> | ||
111 | const Foam::PtrList<abscissaType>& | ||
112 | Foam::quadratureNode<weightType, abscissaType, sigmaType> | ||
113 | ::secondaryAbscissae() const | ||
114 | { | ||
115 | if (!extended_) | ||
116 | { | ||
117 | FatalErrorInFunction | ||
118 | << "Attempt to access secondary abscissae of a quadrature" << nl | ||
119 | << " node not of extended type. " | ||
120 | << abort(FatalError); | ||
121 | } | ||
122 | |||
123 | return secondaryAbscissae_; | ||
124 | } | ||
125 | |||
126 | template <class weightType, class abscissaType, class sigmaType> | ||
127 | Foam::PtrList<abscissaType>& | ||
128 | Foam::quadratureNode<weightType, abscissaType, sigmaType> | ||
129 | ::secondaryAbscissae() | ||
130 | { | ||
131 | if (!extended_) | ||
132 | { | ||
133 | FatalErrorInFunction | ||
134 | << "Attempt to access secondary abscissae of a quadrature" << nl | ||
135 | << " node not of extended type. " | ||
136 | << abort(FatalError); | ||
137 | } | ||
138 | |||
139 | return secondaryAbscissae_; | ||
140 | } | ||
141 | |||
142 | template <class weightType, class abscissaType, class sigmaType> | ||
143 | const sigmaType& | ||
144 | Foam::quadratureNode<weightType, abscissaType, sigmaType> | ||
145 | ::sigma() const | ||
146 | { | ||
147 | if (!extended_) | ||
148 | { | ||
149 | FatalErrorInFunction | ||
150 | << "Attempt to access sigma field of a quadrature node not" << nl | ||
151 | << " of extended type. " | ||
152 | << abort(FatalError); | ||
153 | } | ||
154 | |||
155 | return sigma_(); | ||
156 | } | ||
157 | |||
158 | template <class weightType, class abscissaType, class sigmaType> | ||
159 | sigmaType& | ||
160 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::sigma() | ||
161 | { | ||
162 | if (!extended_) | ||
163 | { | ||
164 | FatalErrorInFunction | ||
165 | << "Attempt to access sigma field of a quadrature node not" << nl | ||
166 | << " of extended type. " | ||
167 | << abort(FatalError); | ||
168 | } | ||
169 | |||
170 | return sigma_(); | ||
171 | } | ||
172 | |||
173 | |||
174 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/surfaceVelocityNode.C added (mode: 100644) (index 0000000..4764b0c) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "surfaceVelocityNode.H" | ||
27 | |||
28 | |||
29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | |||
34 | template<> | ||
35 | tmp<surfaceVectorField> | ||
36 | velocityQuadratureNode<surfaceScalarField, surfaceVectorField>:: | ||
37 | createVelocityAbscissae | ||
38 | ( | ||
39 | const surfaceScalarField& weight, | ||
40 | const wordList& boundaryTypes | ||
41 | ) const | ||
42 | { | ||
43 | const fvMesh& mesh = weight.mesh(); | ||
44 | |||
45 | if (boundaryTypes.size() == 0) | ||
46 | { | ||
47 | return tmp<surfaceVectorField> | ||
48 | ( | ||
49 | new surfaceVectorField | ||
50 | ( | ||
51 | IOobject | ||
52 | ( | ||
53 | IOobject::groupName("velocityAbscissae", this->name_), | ||
54 | mesh.time().timeName(), | ||
55 | mesh, | ||
56 | IOobject::NO_READ, | ||
57 | IOobject::NO_WRITE | ||
58 | ), | ||
59 | mesh, | ||
60 | dimensionedVector | ||
61 | ( | ||
62 | "zeroVelocityAbscissa", | ||
63 | dimVelocity, | ||
64 | Zero | ||
65 | ) | ||
66 | ) | ||
67 | ); | ||
68 | } | ||
69 | |||
70 | return tmp<surfaceVectorField> | ||
71 | ( | ||
72 | new surfaceVectorField | ||
73 | ( | ||
74 | IOobject | ||
75 | ( | ||
76 | IOobject::groupName("velocityAbscissae", this->name_), | ||
77 | mesh.time().timeName(), | ||
78 | mesh, | ||
79 | IOobject::NO_READ, | ||
80 | IOobject::NO_WRITE | ||
81 | ), | ||
82 | mesh, | ||
83 | dimensionedVector | ||
84 | ( | ||
85 | "zeroVelocityAbscissa", | ||
86 | dimVelocity, | ||
87 | Zero | ||
88 | ), | ||
89 | boundaryTypes | ||
90 | ) | ||
91 | ); | ||
92 | } | ||
93 | |||
94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
95 | |||
96 | } // End namespace Foam | ||
97 | |||
98 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/surfaceVelocityNode.H copied from file multiphaseEulerPbeFoam/quadratureMethods/moments/moments.H (similarity 77%) (mode: 100644) (index 4559c79..e0097b8) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::moments | ||
25 | Foam::surfaceVelocityNode | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Surface field of velocity quadrature nodes. | ||
28 | 29 | ||
29 | 30 | SourceFiles | SourceFiles |
31 | surfaceVelocityNode.C | ||
32 | surfaceVelocityNodeI.H | ||
30 | 33 | ||
31 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
32 | 35 | ||
33 | #ifndef moments_H | ||
34 | #define moments_H | ||
36 | #ifndef surfaceVelocityNode_H | ||
37 | #define surfaceVelocityNode_H | ||
35 | 38 | ||
36 | #include "volFields.H" | ||
37 | 39 | #include "quadratureNodes.H" | #include "quadratureNodes.H" |
38 | #include "moment.H" | ||
39 | 40 | ||
40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 42 | ||
42 | 43 | namespace Foam | namespace Foam |
43 | 44 | { | { |
44 | 45 | ||
45 | typedef moment<volScalarField, volScalarNode> volUnivariateMoment; | ||
46 | |||
47 | typedef moment<surfaceScalarField, surfaceScalarNode> surfaceUnivariateMoment; | ||
48 | |||
49 | typedef moment<volScalarField, volVectorNode> volVectorMoment; | ||
50 | |||
51 | typedef moment<surfaceScalarField, surfaceVectorNode> surfaceVectorMoment; | ||
46 | template<> | ||
47 | tmp<surfaceVectorField> | ||
48 | velocityQuadratureNode<surfaceScalarField, surfaceVectorField>:: | ||
49 | createVelocityAbscissae | ||
50 | ( | ||
51 | const surfaceScalarField& weight, | ||
52 | const wordList& boundaryTypes | ||
53 | ) const; | ||
52 | 54 | ||
53 | 55 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
54 | 56 | ||
55 | 57 | } // End namespace Foam | } // End namespace Foam |
56 | 58 | ||
57 | |||
58 | 59 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
59 | 60 | ||
60 | 61 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/velocityQuadratureNode.C added (mode: 100644) (index 0000000..d41fe49) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "velocityQuadratureNode.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | template<class scalarType, class vectorType> | ||
30 | Foam::velocityQuadratureNode<scalarType, vectorType>::velocityQuadratureNode | ||
31 | ( | ||
32 | const word& name, | ||
33 | const word& distributionName, | ||
34 | const fvMesh& mesh, | ||
35 | const dimensionSet& weightDimensions, | ||
36 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
37 | const bool extended, | ||
38 | const label nSecondaryNodes | ||
39 | ) | ||
40 | : | ||
41 | quadratureNode<scalarType, vectorType> | ||
42 | ( | ||
43 | name, | ||
44 | distributionName, | ||
45 | mesh, | ||
46 | weightDimensions, | ||
47 | abscissaeDimensions, | ||
48 | extended, | ||
49 | nSecondaryNodes | ||
50 | ), | ||
51 | velocityAbscissae_(createVelocityAbscissae(this->weight_)) | ||
52 | {} | ||
53 | |||
54 | |||
55 | template<class scalarType, class vectorType> | ||
56 | Foam::velocityQuadratureNode<scalarType, vectorType>::velocityQuadratureNode | ||
57 | ( | ||
58 | const word& name, | ||
59 | const word& distributionName, | ||
60 | const fvMesh& mesh, | ||
61 | const dimensionSet& weightDimensions, | ||
62 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
63 | const wordList& boundaryTypes, | ||
64 | const bool extended, | ||
65 | const label nSecondaryNodes | ||
66 | ) | ||
67 | : | ||
68 | quadratureNode<scalarType, vectorType> | ||
69 | ( | ||
70 | name, | ||
71 | distributionName, | ||
72 | mesh, | ||
73 | weightDimensions, | ||
74 | abscissaeDimensions, | ||
75 | boundaryTypes, | ||
76 | extended, | ||
77 | nSecondaryNodes | ||
78 | ), | ||
79 | velocityAbscissae_(createVelocityAbscissae(this->weight_, boundaryTypes)) | ||
80 | {} | ||
81 | |||
82 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
83 | |||
84 | template<class scalarType, class vectorType> | ||
85 | Foam::velocityQuadratureNode<scalarType, vectorType>:: | ||
86 | ~velocityQuadratureNode() | ||
87 | {} | ||
88 | |||
89 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
90 | /* | ||
91 | template<class scalarType, class vectorType> | ||
92 | Foam::tmp<vectorType> | ||
93 | Foam::velocityQuadratureNode<scalarType, vectorType>::createVelocityAbscissae | ||
94 | ( | ||
95 | const scalarType& weight, | ||
96 | const bool boundary | ||
97 | ) const | ||
98 | { | ||
99 | const fvMesh& mesh = weight.mesh(); | ||
100 | |||
101 | return tmp<vectorType> | ||
102 | ( | ||
103 | new vectorType | ||
104 | ( | ||
105 | IOobject | ||
106 | ( | ||
107 | IOobject::groupName("velocityAbscissae", this->name_), | ||
108 | mesh.time().timeName(), | ||
109 | mesh, | ||
110 | IOobject::NO_READ, | ||
111 | IOobject::NO_WRITE | ||
112 | ), | ||
113 | mesh, | ||
114 | dimensionedVector | ||
115 | ( | ||
116 | "zeroVelocityAbscissa", | ||
117 | dimVelocity, | ||
118 | Zero | ||
119 | ) | ||
120 | ) | ||
121 | ); | ||
122 | }*/ | ||
123 | |||
124 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
125 | |||
126 | template<class scalarType, class vectorType> | ||
127 | Foam::autoPtr<Foam::velocityQuadratureNode<scalarType, vectorType>> | ||
128 | Foam::velocityQuadratureNode<scalarType, vectorType>::clone() const | ||
129 | { | ||
130 | notImplemented("velocityQuadratureNode::clone() const"); | ||
131 | return autoPtr<velocityQuadratureNode<scalarType, vectorType>>(NULL); | ||
132 | } | ||
133 | |||
134 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/velocityQuadratureNode.H renamed from multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.H (similarity 55%) (mode: 100644) (index bc0150b..0dc423f) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::quadratureNode | ||
25 | Foam::velocityQuadratureNode | ||
26 | 26 | ||
27 | 27 | Description | 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. | ||
28 | Implementation of the velocity quadrature node. | ||
31 | 29 | ||
32 | 30 | SourceFiles | SourceFiles |
33 | quadratureNode.C | ||
34 | quadratureNodeI.H | ||
31 | velocityQuadratureNode.C | ||
32 | velocityQuadratureNodeI.H | ||
35 | 33 | ||
36 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
37 | 35 | ||
38 | #ifndef quadratureNode_H | ||
39 | #define quadratureNode_H | ||
36 | #ifndef velocityQuadratureNode_H | ||
37 | #define velocityQuadratureNode_H | ||
40 | 38 | ||
41 | #include "fvMesh.H" | ||
39 | #include "quadratureNode.H" | ||
42 | 40 | #include "PtrList.H" | #include "PtrList.H" |
43 | 41 | #include "dictionary.H" | #include "dictionary.H" |
44 | 42 | #include "dictionaryEntry.H" | #include "dictionaryEntry.H" |
... | ... | namespace Foam | |
50 | 48 | { | { |
51 | 49 | ||
52 | 50 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
53 | Class quadratureNode Declaration | ||
51 | Class velocityQuadratureNode Declaration | ||
54 | 52 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
55 | template <class weightType, class abscissaType, class sigmaType> | ||
56 | class quadratureNode | ||
53 | |||
54 | template<class scalarType, class vectorType> | ||
55 | class velocityQuadratureNode | ||
56 | : | ||
57 | public quadratureNode<scalarType, vectorType> | ||
57 | 58 | { | { |
58 | 59 | // Private data | // Private data |
59 | 60 | ||
60 | //- Name of the quadrature node | ||
61 | word name_; | ||
62 | |||
63 | //- Primary weight of the node | ||
64 | weightType weight_; | ||
65 | |||
66 | 61 | //- Primary abscissa of the node | //- Primary abscissa of the node |
67 | abscissaType abscissa_; | ||
62 | vectorType velocityAbscissae_; | ||
68 | 63 | ||
69 | //- List of secondary weights of the node | ||
70 | PtrList<weightType> secondaryWeights_; | ||
71 | 64 | ||
72 | //- List of secondary abscissae of the node | ||
73 | PtrList<abscissaType> secondaryAbscissae_; | ||
65 | // Private functions | ||
74 | 66 | ||
75 | //- Parameter of the kernel density function used in EQMOM | ||
76 | autoPtr<sigmaType> sigma_; | ||
77 | |||
78 | //- Number of secondary nodes | ||
79 | label nSecondaryNodes_; | ||
67 | //- Lookup boundary conditions and return velocity abscissae field | ||
68 | tmp<vectorType> createVelocityAbscissae | ||
69 | ( | ||
70 | const scalarType& weight, | ||
71 | const wordList& boundaryTypes = wordList() | ||
72 | ) const; | ||
80 | 73 | ||
81 | //- Boolean variable to identify extended nodes | ||
82 | bool extended_; | ||
83 | 74 | ||
84 | 75 | public: | public: |
85 | 76 | ||
86 | 77 | // Constructors | // Constructors |
87 | 78 | ||
88 | 79 | //- Construct from name, mesh and dimensions | //- Construct from name, mesh and dimensions |
89 | quadratureNode | ||
80 | velocityQuadratureNode | ||
90 | 81 | ( | ( |
91 | 82 | const word& name, | const word& name, |
92 | 83 | const word& distributionName, | const word& distributionName, |
93 | 84 | const fvMesh& mesh, | const fvMesh& mesh, |
94 | 85 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
95 | const dimensionSet& abscissaDimensions, | ||
86 | const PtrList<dimensionSet>& abscissaDimensions, | ||
96 | 87 | const wordList& boundaryTypes, | const wordList& boundaryTypes, |
97 | 88 | const bool extended = false, | const bool extended = false, |
98 | 89 | const label nSecondaryNodes = 0 | const label nSecondaryNodes = 0 |
99 | 90 | ); | ); |
100 | 91 | ||
101 | 92 | //- Construct from name, number of secondary nodes, mesh and dimensions | //- Construct from name, number of secondary nodes, mesh and dimensions |
102 | quadratureNode | ||
93 | velocityQuadratureNode | ||
103 | 94 | ( | ( |
104 | 95 | const word& name, | const word& name, |
105 | 96 | const word& distributionName, | const word& distributionName, |
106 | 97 | const fvMesh& mesh, | const fvMesh& mesh, |
107 | 98 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
108 | const dimensionSet& abscissaDimensions, | ||
99 | const PtrList<dimensionSet>& abscissaDimensions, | ||
109 | 100 | const bool extended = false, | const bool extended = false, |
110 | 101 | const label nSecondaryNodes = 0 | const label nSecondaryNodes = 0 |
111 | 102 | ); | ); |
112 | 103 | ||
113 | 104 | //- Return clone | //- Return clone |
114 | autoPtr<quadratureNode<weightType, abscissaType, sigmaType>> | ||
115 | clone() const; | ||
105 | autoPtr<velocityQuadratureNode<scalarType, vectorType>> clone() const; | ||
116 | 106 | ||
117 | 107 | //- Return a pointer to a new quadrature node created on freestore | //- Return a pointer to a new quadrature node created on freestore |
118 | 108 | // from Istream | // from Istream |
... | ... | public: | |
121 | 111 | const word distributionName_; | const word distributionName_; |
122 | 112 | const fvMesh& mesh_; | const fvMesh& mesh_; |
123 | 113 | const dimensionSet& weightDimensions_; | const dimensionSet& weightDimensions_; |
124 | const dimensionSet& abscissaDimensions_; | ||
114 | const PtrList<dimensionSet>& abscissaeDimensions_; | ||
125 | 115 | const wordList& boundaryTypes_; | const wordList& boundaryTypes_; |
126 | 116 | const bool extended_; | const bool extended_; |
127 | 117 | const label nSecondaryNodes_; | const label nSecondaryNodes_; |
... | ... | public: | |
133 | 123 | const word& distributionName, | const word& distributionName, |
134 | 124 | const fvMesh& mesh, | const fvMesh& mesh, |
135 | 125 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
136 | const dimensionSet& abscissaDimensions, | ||
126 | const PtrList<dimensionSet>& abscissaeDimensions, | ||
137 | 127 | const wordList& boundaryTypes, | const wordList& boundaryTypes, |
138 | 128 | const bool extended, | const bool extended, |
139 | 129 | const label nSecondaryNodes | const label nSecondaryNodes |
... | ... | public: | |
142 | 132 | distributionName_(distributionName), | distributionName_(distributionName), |
143 | 133 | mesh_(mesh), | mesh_(mesh), |
144 | 134 | weightDimensions_(weightDimensions), | weightDimensions_(weightDimensions), |
145 | abscissaDimensions_(abscissaDimensions), | ||
135 | abscissaeDimensions_(abscissaeDimensions), | ||
146 | 136 | boundaryTypes_(boundaryTypes), | boundaryTypes_(boundaryTypes), |
147 | 137 | extended_(extended), | extended_(extended), |
148 | 138 | nSecondaryNodes_(nSecondaryNodes) | nSecondaryNodes_(nSecondaryNodes) |
149 | 139 | {} | {} |
150 | 140 | ||
151 | autoPtr | ||
152 | < | ||
153 | quadratureNode<weightType, abscissaType, sigmaType> | ||
154 | > | ||
141 | autoPtr<velocityQuadratureNode<scalarType, vectorType>> | ||
155 | 142 | operator() | operator() |
156 | 143 | ( | ( |
157 | 144 | Istream& is | Istream& is |
158 | 145 | ) const | ) const |
159 | 146 | { | { |
160 | 147 | labelList ent(is); | labelList ent(is); |
161 | return autoPtr | ||
162 | < | ||
163 | quadratureNode<weightType, abscissaType, sigmaType> | ||
164 | > | ||
148 | |||
149 | return autoPtr<velocityQuadratureNode<scalarType, vectorType>> | ||
165 | 150 | ( | ( |
166 | new quadratureNode | ||
167 | < | ||
168 | weightType, abscissaType, sigmaType | ||
169 | > | ||
151 | new velocityQuadratureNode<scalarType, vectorType> | ||
170 | 152 | ( | ( |
171 | 153 | "node" + mappedList<scalar>::listToWord(ent), | "node" + mappedList<scalar>::listToWord(ent), |
172 | 154 | distributionName_, | distributionName_, |
173 | 155 | mesh_, | mesh_, |
174 | 156 | weightDimensions_, | weightDimensions_, |
175 | abscissaDimensions_, | ||
157 | abscissaeDimensions_, | ||
176 | 158 | boundaryTypes_, | boundaryTypes_, |
177 | 159 | extended_, | extended_, |
178 | 160 | nSecondaryNodes_ | nSecondaryNodes_ |
... | ... | public: | |
183 | 165 | ||
184 | 166 | ||
185 | 167 | //- Destructor | //- Destructor |
186 | virtual ~quadratureNode(); | ||
168 | virtual ~velocityQuadratureNode(); | ||
187 | 169 | ||
188 | 170 | ||
189 | 171 | // Member Functions | // Member Functions |
190 | 172 | ||
191 | 173 | // Access | // Access |
192 | 174 | ||
193 | //- Return the name of the node | ||
194 | inline const word& name() const; | ||
195 | |||
196 | inline bool extended() const; | ||
197 | |||
198 | //- Returns the number of secondary nodes | ||
199 | inline label nSecondaryNodes() const; | ||
200 | |||
201 | //- Const access to the weight of the node | ||
202 | inline const weightType& primaryWeight() const; | ||
203 | |||
204 | //- Non-const access to the weight of the node | ||
205 | inline weightType& primaryWeight(); | ||
206 | |||
207 | //- Const access to the abscissa of the node | ||
208 | inline const abscissaType& primaryAbscissa() const; | ||
209 | |||
210 | //- Non-const access to the abscissa of the node | ||
211 | inline abscissaType& primaryAbscissa(); | ||
212 | |||
213 | //- Const access to the secondary weights of the node | ||
214 | inline const PtrList<weightType>& secondaryWeights() const; | ||
215 | |||
216 | //- Non-const access to the secondary weights of the node | ||
217 | inline PtrList<weightType>& secondaryWeights(); | ||
218 | |||
219 | //- Const access to the list of secondary abscissae of the node | ||
220 | inline const PtrList<abscissaType>& secondaryAbscissae() const; | ||
221 | |||
222 | //- Non-const access to the list of secondary abscissae of the node | ||
223 | inline PtrList<abscissaType>& secondaryAbscissae(); | ||
224 | |||
225 | //- Const access to sigma | ||
226 | inline const sigmaType& sigma() const; | ||
175 | //- Const access to the velocity abscissa of the node | ||
176 | virtual const vectorType& velocityAbscissae() const; | ||
227 | 177 | ||
228 | //- Non-const access to sigma | ||
229 | inline sigmaType& sigma(); | ||
178 | //- Non-const access to the velcity abscissa of the node | ||
179 | virtual vectorType& velocityAbscissae(); | ||
230 | 180 | }; | }; |
231 | 181 | ||
232 | 182 | ||
... | ... | public: | |
236 | 186 | ||
237 | 187 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
238 | 188 | #ifdef NoRepository | #ifdef NoRepository |
239 | # include "quadratureNodeI.H" | ||
240 | # include "quadratureNode.C" | ||
189 | # include "velocityQuadratureNodeI.H" | ||
190 | # include "velocityQuadratureNode.C" | ||
241 | 191 | #endif | #endif |
242 | 192 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
243 | 193 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/velocityQuadratureNodeI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversionI.H (similarity 76%) (mode: 100644) (index 62291f8..ef987b1) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
25 | 25 | ||
26 | 26 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
27 | 27 | ||
28 | const Foam::scalarList& Foam::univariateMomentInversion::abscissae() const | ||
28 | template<class scalarType, class vectorType> | ||
29 | const vectorType& | ||
30 | Foam::velocityQuadratureNode<scalarType, vectorType>::velocityAbscissae() const | ||
29 | 31 | { | { |
30 | return abscissae_; | ||
32 | return velocityAbscissae_; | ||
31 | 33 | } | } |
32 | 34 | ||
33 | Foam::label Foam::univariateMomentInversion::nNodes() const | ||
35 | template<class scalarType, class vectorType> | ||
36 | vectorType& | ||
37 | Foam::velocityQuadratureNode<scalarType, vectorType>::velocityAbscissae() | ||
34 | 38 | { | { |
35 | return nNodes_; | ||
36 | } | ||
37 | |||
38 | const Foam::scalarList& Foam::univariateMomentInversion::weights() const | ||
39 | { | ||
40 | return weights_; | ||
39 | return velocityAbscissae_; | ||
41 | 40 | } | } |
42 | 41 | ||
43 | 42 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/volVelocityNode.C added (mode: 100644) (index 0000000..db8970a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2019 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 "volVelocityNode.H" | ||
27 | |||
28 | |||
29 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | |||
34 | template<> | ||
35 | tmp<volVectorField> | ||
36 | velocityQuadratureNode<volScalarField, volVectorField>:: | ||
37 | createVelocityAbscissae | ||
38 | ( | ||
39 | const volScalarField& weight, | ||
40 | const wordList& boundaryTypes | ||
41 | ) const | ||
42 | { | ||
43 | const fvMesh& mesh = weight.mesh(); | ||
44 | word UName = IOobject::groupName("U", weight.group()); | ||
45 | |||
46 | if (mesh.foundObject<volVectorField>(UName) && boundaryTypes.size() > 0) | ||
47 | { | ||
48 | const volVectorField& Umean = | ||
49 | mesh.lookupObject<volVectorField>(UName); | ||
50 | |||
51 | return tmp<volVectorField> | ||
52 | ( | ||
53 | new volVectorField | ||
54 | ( | ||
55 | IOobject | ||
56 | ( | ||
57 | IOobject::groupName("velocityAbscissae", this->name_), | ||
58 | mesh.time().timeName(), | ||
59 | mesh, | ||
60 | IOobject::NO_READ, | ||
61 | IOobject::NO_WRITE | ||
62 | ), | ||
63 | Umean, | ||
64 | Umean.boundaryField() | ||
65 | ) | ||
66 | ); | ||
67 | } | ||
68 | |||
69 | return tmp<volVectorField> | ||
70 | ( | ||
71 | new volVectorField | ||
72 | ( | ||
73 | IOobject | ||
74 | ( | ||
75 | IOobject::groupName("velocityAbscissae", this->name_), | ||
76 | mesh.time().timeName(), | ||
77 | mesh, | ||
78 | IOobject::NO_READ, | ||
79 | IOobject::NO_WRITE | ||
80 | ), | ||
81 | mesh, | ||
82 | dimensionedVector | ||
83 | ( | ||
84 | "zeroVelocityAbscissa", | ||
85 | dimVelocity, | ||
86 | Zero | ||
87 | ), | ||
88 | boundaryTypes | ||
89 | ) | ||
90 | ); | ||
91 | } | ||
92 | |||
93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
94 | |||
95 | } // End namespace Foam | ||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/velocityQuadratureNode/volVelocityNode.H copied from file multiphaseEulerPbeFoam/mappedList/mappedLists.H (similarity 81%) (mode: 100644) (index c3da4aa..17d3aac) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2018 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
21 | 21 | You should have received a copy of the GNU General Public License | You should have received a copy of the GNU General Public License |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | Class | ||
25 | Foam::mappedLists | ||
26 | |||
27 | Description | ||
28 | |||
29 | SourceFiles | ||
30 | |||
31 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
32 | 25 | ||
33 | #ifndef mappedLists_H | ||
34 | #define mappedLists_H | ||
26 | #ifndef volVelocityNode_H | ||
27 | #define volVelocityNode_H | ||
35 | 28 | ||
36 | #include "mappedList.H" | ||
29 | #include "quadratureNodes.H" | ||
37 | 30 | ||
38 | 31 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
39 | 32 | ||
40 | 33 | namespace Foam | namespace Foam |
41 | 34 | { | { |
42 | 35 | ||
43 | typedef mappedList<label> mappedLabelList; | ||
44 | |||
45 | typedef mappedList<scalar> mappedScalarList; | ||
36 | template<> | ||
37 | tmp<volVectorField> | ||
38 | velocityQuadratureNode<volScalarField, volVectorField>::createVelocityAbscissae | ||
39 | ( | ||
40 | const volScalarField& weight, | ||
41 | const wordList& boundaryTypes | ||
42 | ) const; | ||
46 | 43 | ||
47 | 44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
48 | 45 | ||
49 | 46 | } // End namespace Foam | } // End namespace Foam |
50 | 47 | ||
51 | |||
52 | 48 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
53 | 49 | ||
54 | 50 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/realizableOdeSolver/realizableOdeSolver.C copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.C (similarity 51%) (mode: 100644) (index 2f312ee..4a1be3c) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "univariatePDFTransportModel.H" | ||
26 | #include "realizableOdeSolver.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
29 | 29 | ||
30 | Foam::PDFTransportModels::univariatePDFTransportModel | ||
31 | ::univariatePDFTransportModel | ||
30 | template<class momentType, class nodeType> | ||
31 | Foam::realizableOdeSolver<momentType, nodeType>::realizableOdeSolver | ||
32 | 32 | ( | ( |
33 | const word& name, | ||
34 | const dictionary& dict, | ||
35 | 33 | const fvMesh& mesh, | const fvMesh& mesh, |
36 | const surfaceScalarField& phi, | ||
37 | const word& support | ||
34 | const dictionary& dict | ||
38 | 35 | ) | ) |
39 | 36 | : | : |
40 | PDFTransportModel(name, dict, mesh), | ||
41 | name_(name), | ||
42 | solveODESource_ | ||
43 | ( | ||
44 | dict.subDict("odeCoeffs").lookupOrDefault("solveODESource", true) | ||
45 | ), | ||
37 | mesh_(mesh), | ||
46 | 38 | ATol_(readScalar(dict.subDict("odeCoeffs").lookup("ATol"))), | ATol_(readScalar(dict.subDict("odeCoeffs").lookup("ATol"))), |
47 | 39 | RTol_(readScalar(dict.subDict("odeCoeffs").lookup("RTol"))), | RTol_(readScalar(dict.subDict("odeCoeffs").lookup("RTol"))), |
48 | 40 | fac_(readScalar(dict.subDict("odeCoeffs").lookup("fac"))), | fac_(readScalar(dict.subDict("odeCoeffs").lookup("fac"))), |
49 | 41 | facMin_(readScalar(dict.subDict("odeCoeffs").lookup("facMin"))), | facMin_(readScalar(dict.subDict("odeCoeffs").lookup("facMin"))), |
50 | 42 | facMax_(readScalar(dict.subDict("odeCoeffs").lookup("facMax"))), | facMax_(readScalar(dict.subDict("odeCoeffs").lookup("facMax"))), |
51 | 43 | minLocalDt_(readScalar(dict.subDict("odeCoeffs").lookup("minLocalDt"))), | minLocalDt_(readScalar(dict.subDict("odeCoeffs").lookup("minLocalDt"))), |
52 | localDt_(mesh.nCells(), mesh.time().deltaTValue()/10.0), | ||
53 | quadrature_(name, mesh, support), | ||
54 | momentAdvection_ | ||
44 | localDt_ | ||
55 | 45 | ( | ( |
56 | univariateMomentAdvection::New | ||
46 | IOobject | ||
57 | 47 | ( | ( |
58 | quadrature_.subDict("momentAdvection"), | ||
59 | quadrature_, | ||
60 | phi, | ||
61 | support | ||
62 | ) | ||
48 | "realizableOde:localDt", | ||
49 | mesh.time().timeName(), | ||
50 | mesh | ||
51 | ), | ||
52 | mesh, | ||
53 | mesh.time().deltaT() | ||
54 | ), | ||
55 | solveSources_ | ||
56 | ( | ||
57 | dict.subDict("odeCoeffs").lookupOrDefault("solveSources", true) | ||
58 | ), | ||
59 | solveOde_ | ||
60 | ( | ||
61 | dict.subDict("odeCoeffs").lookupOrDefault("solveOde", true) | ||
63 | 62 | ) | ) |
64 | 63 | {} | {} |
65 | 64 | ||
66 | 65 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
67 | 66 | ||
68 | Foam::PDFTransportModels::univariatePDFTransportModel | ||
69 | ::~univariatePDFTransportModel() | ||
67 | template<class momentType, class nodeType> | ||
68 | Foam::realizableOdeSolver<momentType, nodeType>::~realizableOdeSolver() | ||
70 | 69 | {} | {} |
71 | 70 | ||
72 | 71 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
73 | 72 | ||
74 | void Foam::PDFTransportModels::univariatePDFTransportModel | ||
75 | ::explicitMomentSource() | ||
73 | template<class momentType, class nodeType> | ||
74 | void Foam::realizableOdeSolver<momentType, nodeType>::solve | ||
75 | ( | ||
76 | quadratureType& quadrature, | ||
77 | const label enviroment | ||
78 | ) | ||
76 | 79 | { | { |
77 | volUnivariateMomentFieldSet& moments(quadrature_.moments()); | ||
78 | label nMoments = quadrature_.nMoments(); | ||
79 | scalar globalDt = moments[0].mesh().time().deltaT().value(); | ||
80 | if (!solveSources_) | ||
81 | { | ||
82 | return; | ||
83 | } | ||
80 | 84 | ||
81 | Info << "Solving source terms in realizable ODE solver." << endl; | ||
85 | momentFieldSetType& moments(quadrature.moments()); | ||
86 | label nMoments = quadrature.nMoments(); | ||
87 | scalar globalDt = mesh_.time().deltaT().value(); | ||
88 | const labelListList& momentOrders = quadrature.momentOrders(); | ||
89 | |||
90 | //- Use Euler explicit to update moments due to sources | ||
91 | if (!solveOde_) | ||
92 | { | ||
93 | forAll(moments[0], celli) | ||
94 | { | ||
95 | updateCellMomentSource(celli); | ||
96 | forAll(moments, mi) | ||
97 | { | ||
98 | const labelList& order = momentOrders[mi]; | ||
99 | moments[mi][celli] += | ||
100 | globalDt | ||
101 | *cellMomentSource | ||
102 | ( | ||
103 | order, | ||
104 | celli, | ||
105 | quadrature, | ||
106 | enviroment | ||
107 | ); | ||
108 | } | ||
109 | |||
110 | quadrature.updateLocalQuadrature(celli, true); | ||
111 | quadrature.updateLocalMoments(celli); | ||
112 | } | ||
82 | 113 | ||
114 | forAll(moments, mi) | ||
115 | { | ||
116 | moments[mi].correctBoundaryConditions(); | ||
117 | } | ||
118 | |||
119 | quadrature.updateBoundaryQuadrature(); | ||
120 | |||
121 | return; | ||
122 | } | ||
123 | |||
124 | Info << "Solving source terms in realizable ODE solver." << endl; | ||
83 | 125 | forAll(moments[0], celli) | forAll(moments[0], celli) |
84 | 126 | { | { |
85 | 127 | // Storing old moments to recover from failed step | // Storing old moments to recover from failed step |
128 | quadrature.updateLocalQuadrature(celli); | ||
129 | quadrature.updateLocalMoments(celli); | ||
86 | 130 | ||
87 | 131 | scalarList oldMoments(nMoments, 0.0); | scalarList oldMoments(nMoments, 0.0); |
88 | |||
89 | 132 | forAll(oldMoments, mi) | forAll(oldMoments, mi) |
90 | 133 | { | { |
91 | 134 | oldMoments[mi] = moments[mi][celli]; | oldMoments[mi] = moments[mi][celli]; |
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel | |
110 | 153 | bool realizableUpdate2 = false; | bool realizableUpdate2 = false; |
111 | 154 | bool realizableUpdate3 = false; | bool realizableUpdate3 = false; |
112 | 155 | ||
113 | scalarList momentsSecondStep(nMoments, 0.0); | ||
156 | scalarList diff23(nMoments, 0.0); | ||
157 | label nItt = 0; | ||
114 | 158 | ||
115 | 159 | while (!timeComplete) | while (!timeComplete) |
116 | 160 | { | { |
117 | 161 | do | do |
118 | 162 | { | { |
163 | nItt++; | ||
164 | |||
119 | 165 | // First intermediate update | // First intermediate update |
120 | forAll(oldMoments, mi) | ||
166 | bool nullSource = true; | ||
167 | updateCellMomentSource(celli); | ||
168 | forAll(k1, mi) | ||
121 | 169 | { | { |
122 | k1[mi] = localDt*cellMomentSource(mi, celli); | ||
170 | const labelList& order = momentOrders[mi]; | ||
171 | k1[mi] = | ||
172 | localDt*cellMomentSource | ||
173 | ( | ||
174 | order, | ||
175 | celli, | ||
176 | quadrature, | ||
177 | enviroment | ||
178 | ); | ||
123 | 179 | moments[mi][celli] = oldMoments[mi] + k1[mi]; | moments[mi][celli] = oldMoments[mi] + k1[mi]; |
180 | |||
181 | if (mag(k1[mi]) > small) | ||
182 | { | ||
183 | nullSource = false; | ||
184 | } | ||
124 | 185 | } | } |
125 | 186 | ||
126 | 187 | realizableUpdate1 = | realizableUpdate1 = |
127 | quadrature_.updateLocalQuadrature(celli, false); | ||
188 | quadrature.updateLocalQuadrature(celli, false); | ||
128 | 189 | ||
129 | quadrature_.updateLocalMoments(celli); | ||
190 | quadrature.updateLocalMoments(celli); | ||
191 | |||
192 | if (nullSource) | ||
193 | { | ||
194 | break; | ||
195 | } | ||
130 | 196 | ||
131 | 197 | // Second moment update | // Second moment update |
132 | forAll(oldMoments, mi) | ||
198 | updateCellMomentSource(celli); | ||
199 | forAll(k2, mi) | ||
133 | 200 | { | { |
134 | k2[mi] = localDt*cellMomentSource(mi, celli); | ||
135 | moments[mi][celli] = oldMoments[mi] + (k1[mi] + k2[mi])/4.0; | ||
201 | const labelList& order = momentOrders[mi]; | ||
136 | 202 | ||
137 | momentsSecondStep[mi] = moments[mi][celli]; | ||
203 | k2[mi] = | ||
204 | localDt*cellMomentSource | ||
205 | ( | ||
206 | order, | ||
207 | celli, | ||
208 | quadrature, | ||
209 | enviroment | ||
210 | ); | ||
211 | |||
212 | moments[mi][celli] = oldMoments[mi] + (k1[mi] + k2[mi])/4.0; | ||
138 | 213 | } | } |
139 | 214 | ||
140 | 215 | realizableUpdate2 = | realizableUpdate2 = |
141 | quadrature_.updateLocalQuadrature(celli, false); | ||
216 | quadrature.updateLocalQuadrature(celli, false); | ||
142 | 217 | ||
143 | quadrature_.updateLocalMoments(celli); | ||
218 | quadrature.updateLocalMoments(celli); | ||
144 | 219 | ||
145 | 220 | // Third moment update | // Third moment update |
146 | forAll(oldMoments, mi) | ||
221 | updateCellMomentSource(celli); | ||
222 | |||
223 | forAll(k3, mi) | ||
147 | 224 | { | { |
148 | k3[mi] = localDt*cellMomentSource(mi, celli); | ||
225 | const labelList& order = momentOrders[mi]; | ||
226 | k3[mi] = | ||
227 | localDt*cellMomentSource | ||
228 | ( | ||
229 | order, | ||
230 | celli, | ||
231 | quadrature, | ||
232 | enviroment | ||
233 | ); | ||
149 | 234 | moments[mi][celli] = | moments[mi][celli] = |
150 | 235 | oldMoments[mi] + (k1[mi] + k2[mi] + 4.0*k3[mi])/6.0; | oldMoments[mi] + (k1[mi] + k2[mi] + 4.0*k3[mi])/6.0; |
236 | |||
237 | diff23[mi] = (8.0*k3[mi] - k1[mi] - k2[mi])/12.0; | ||
151 | 238 | } | } |
152 | 239 | ||
153 | 240 | realizableUpdate3 = | realizableUpdate3 = |
154 | quadrature_.updateLocalQuadrature(celli, false); | ||
241 | quadrature.updateLocalQuadrature(celli, false); | ||
155 | 242 | ||
156 | quadrature_.updateLocalMoments(celli); | ||
243 | quadrature.updateLocalMoments(celli); | ||
157 | 244 | ||
158 | 245 | if | if |
159 | 246 | ( | ( |
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel | |
170 | 257 | } | } |
171 | 258 | ||
172 | 259 | // Updating local quadrature with old moments | // Updating local quadrature with old moments |
173 | quadrature_.updateLocalQuadrature(celli); | ||
260 | quadrature.updateLocalQuadrature(celli); | ||
174 | 261 | ||
175 | 262 | localDt /= 2.0; | localDt /= 2.0; |
176 | 263 | ||
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel | |
179 | 266 | FatalErrorInFunction | FatalErrorInFunction |
180 | 267 | << "Reached minimum local step in realizable ODE" | << "Reached minimum local step in realizable ODE" |
181 | 268 | << nl | << nl |
182 | << " solver. Cannot ensure realizability." << nl | ||
269 | << " solver. Cannot ensure realizability." | ||
270 | << nl | ||
183 | 271 | << abort(FatalError); | << abort(FatalError); |
184 | 272 | } | } |
185 | 273 | } | } |
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel | |
196 | 284 | for (label mi = 0; mi < nMoments; mi++) | for (label mi = 0; mi < nMoments; mi++) |
197 | 285 | { | { |
198 | 286 | scalar scalei = | scalar scalei = |
199 | ATol_ | ||
200 | + max | ||
201 | ( | ||
202 | mag(momentsSecondStep[mi]), mag(oldMoments[mi]) | ||
203 | )*RTol_; | ||
287 | ATol_ | ||
288 | + max | ||
289 | ( | ||
290 | mag(moments[mi][celli]), mag(oldMoments[mi]) | ||
291 | )*RTol_; | ||
204 | 292 | ||
205 | error += | ||
206 | sqr | ||
207 | ( | ||
208 | (momentsSecondStep[mi] - moments[mi][celli])/scalei | ||
209 | ); | ||
293 | error += sqr(diff23[mi]/scalei); | ||
210 | 294 | } | } |
211 | 295 | ||
212 | 296 | error = sqrt(error/nMoments); | error = sqrt(error/nMoments); |
213 | 297 | ||
214 | if (error < 1) | ||
298 | if (error < small) | ||
299 | { | ||
300 | timeComplete = true; | ||
301 | localT = 0.0; | ||
302 | break; | ||
303 | } | ||
304 | else if (error < 1) | ||
215 | 305 | { | { |
216 | 306 | localDt *= min(facMax_, max(facMin_, fac_/pow(error, 1.0/3.0))); | localDt *= min(facMax_, max(facMin_, fac_/pow(error, 1.0/3.0))); |
217 | 307 | ||
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel | |
241 | 331 | { | { |
242 | 332 | moments[mi][celli] = oldMoments[mi]; | moments[mi][celli] = oldMoments[mi]; |
243 | 333 | } | } |
334 | |||
335 | // Updating local quadrature with old moments | ||
336 | quadrature.updateLocalQuadrature(celli); | ||
244 | 337 | } | } |
245 | 338 | } | } |
246 | 339 | } | } |
247 | } | ||
248 | |||
249 | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | ||
250 | { | ||
251 | momentAdvection_().update(); | ||
252 | 340 | ||
253 | // List of moment transport equations | ||
254 | PtrList<fvScalarMatrix> momentEqns(quadrature_.nMoments()); | ||
255 | |||
256 | // Solve moment transport equations | ||
257 | forAll(quadrature_.moments(), momenti) | ||
341 | forAll(moments, mi) | ||
258 | 342 | { | { |
259 | volUnivariateMoment& m = quadrature_.moments()[momenti]; | ||
260 | |||
261 | momentEqns.set | ||
262 | ( | ||
263 | momenti, | ||
264 | new fvScalarMatrix | ||
265 | ( | ||
266 | fvm::ddt(m) | ||
267 | + momentAdvection_().divMoments()[momenti] | ||
268 | - momentDiffusion(m) | ||
269 | == | ||
270 | implicitMomentSource(m) | ||
271 | ) | ||
272 | ); | ||
343 | moments[mi].correctBoundaryConditions(); | ||
273 | 344 | } | } |
274 | 345 | ||
275 | if (solveODESource_) | ||
276 | { | ||
277 | explicitMomentSource(); | ||
278 | } | ||
279 | |||
280 | forAll (momentEqns, mEqni) | ||
281 | { | ||
282 | volUnivariateMoment& m = quadrature_.moments()[mEqni]; | ||
283 | |||
284 | if (solveODESource_) | ||
285 | { | ||
286 | momentEqns[mEqni] -= fvc::ddt(m); | ||
287 | } | ||
346 | quadrature.updateBoundaryQuadrature(); | ||
347 | } | ||
288 | 348 | ||
289 | momentEqns[mEqni].relax(); | ||
290 | momentEqns[mEqni].solve(); | ||
291 | } | ||
292 | 349 | ||
293 | quadrature_.updateQuadrature(); | ||
294 | //quadrature_.updateMoments(); | ||
350 | template<class momentType, class nodeType> | ||
351 | void Foam::realizableOdeSolver<momentType, nodeType> | ||
352 | ::read(const dictionary& dict) | ||
353 | { | ||
354 | const dictionary& odeDict = dict.subDict("odeCoeffs"); | ||
355 | solveSources_ = odeDict.lookupOrDefault<Switch>("solveSources", true); | ||
356 | solveOde_ = odeDict.lookupOrDefault<Switch>("solveOde", true); | ||
357 | |||
358 | (odeDict.lookup("ATol")) >> ATol_; | ||
359 | (odeDict.lookup("RTol")) >> RTol_; | ||
360 | (odeDict.lookup("fac")) >> fac_; | ||
361 | (odeDict.lookup("facMin")) >> facMin_; | ||
362 | (odeDict.lookup("facMax")) >> facMax_; | ||
363 | (odeDict.lookup("minLocalDt")) >> minLocalDt_; | ||
295 | 364 | } | } |
296 | 365 | ||
297 | 366 |
File multiphaseEulerPbeFoam/quadratureMethods/realizableOdeSolver/realizableOdeSolver.H copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.H (similarity 56%) (mode: 100644) (index 9fb6b8d..71275a7) | |||
2 | 2 | ========= | | ========= | |
3 | 3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
4 | 4 | \\ / O peration | | \\ / O peration | |
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
5 | \\ / A nd | Copyright (C) 2015-2019 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
22 | 22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. |
23 | 23 | ||
24 | 24 | Class | Class |
25 | Foam::univariatePDFTransportModel | ||
25 | Foam::realizableOdeSolver | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Solve a univariate PDF transport equation with the extended quadrature | Solve a univariate PDF transport equation with the extended quadrature |
29 | 29 | method of moments. | method of moments. |
30 | 30 | ||
31 | 31 | SourceFiles | SourceFiles |
32 | univariatePDFTransportModel.C | ||
32 | realizableOdeSolver.C | ||
33 | 33 | ||
34 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
35 | 35 | ||
36 | #ifndef univariatePDFTransportModel_H | ||
37 | #define univariatePDFTransportModel_H | ||
36 | #ifndef realizableOdeSolver_H | ||
37 | #define realizableOdeSolver_H | ||
38 | 38 | ||
39 | #include "PDFTransportModel.H" | ||
40 | #include "quadratureApproximations.H" | ||
41 | #include "univariateMomentAdvection.H" | ||
39 | #include "quadratureApproximation.H" | ||
42 | 40 | ||
43 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 42 | ||
45 | 43 | namespace Foam | namespace Foam |
46 | 44 | { | { |
47 | namespace PDFTransportModels | ||
48 | { | ||
49 | 45 | ||
50 | 46 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
51 | Class univariatePDFTransportModel Declaration | ||
47 | Class realizableOdeSolver Declaration | ||
52 | 48 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 49 | ||
54 | class univariatePDFTransportModel | ||
55 | : | ||
56 | public PDFTransportModel | ||
50 | template<class momentType, class nodeType> | ||
51 | class realizableOdeSolver | ||
57 | 52 | { | { |
58 | // Private data | ||
59 | 53 | ||
60 | //- Name of the univariatePDFTransportModel | ||
61 | const word name_; | ||
54 | typedef momentFieldSet<momentType, nodeType> momentFieldSetType; | ||
55 | typedef quadratureApproximation<momentType, nodeType> quadratureType; | ||
56 | |||
57 | // Private data | ||
62 | 58 | ||
63 | Switch solveODESource_; | ||
59 | //- Reference to mesh | ||
60 | const fvMesh& mesh_; | ||
64 | 61 | ||
65 | 62 | //- Absolute tolerance for realizable ODE solver | //- Absolute tolerance for realizable ODE solver |
66 | 63 | scalar ATol_; | scalar ATol_; |
... | ... | class univariatePDFTransportModel | |
81 | 78 | scalar minLocalDt_; | scalar minLocalDt_; |
82 | 79 | ||
83 | 80 | //- Stored time step values | //- Stored time step values |
84 | scalarField localDt_; | ||
81 | volScalarField localDt_; | ||
85 | 82 | ||
86 | 83 | ||
87 | 84 | protected: | protected: |
88 | 85 | ||
89 | 86 | // Protected data | // Protected data |
90 | 87 | ||
91 | //- Univariate quadrature approximation used to solve PDF transport | ||
92 | univariateQuadratureApproximation quadrature_; | ||
88 | //- Are the moments updated due to sources | ||
89 | Switch solveSources_; | ||
93 | 90 | ||
94 | //- Moment advection | ||
95 | autoPtr<univariateMomentAdvection> momentAdvection_; | ||
91 | //- Is the realizable ode solver used | ||
92 | Switch solveOde_; | ||
96 | 93 | ||
97 | 94 | // Protected member functions | // Protected member functions |
98 | 95 | ||
99 | //- Diffusion term | ||
100 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
101 | ( | ||
102 | const volUnivariateMoment& moment | ||
103 | ) = 0; | ||
104 | |||
105 | //- Calculate implicit source terms | ||
106 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
107 | ( | ||
108 | const volUnivariateMoment& moment | ||
109 | ) = 0; | ||
110 | |||
111 | //- Calculate explicit source terms with realizable ODE solver | ||
112 | virtual void explicitMomentSource(); | ||
96 | //- Calculate source term for moment equation in the specified cell | ||
97 | virtual void updateCellMomentSource(const label celli) = 0; | ||
113 | 98 | ||
114 | 99 | //- Calculate source term for moment equation in the specified cell | //- Calculate source term for moment equation in the specified cell |
115 | 100 | virtual scalar cellMomentSource | virtual scalar cellMomentSource |
116 | 101 | ( | ( |
117 | label& momentOrder, | ||
118 | label& celli | ||
102 | const labelList& momentOrder, | ||
103 | const label celli, | ||
104 | const quadratureType& nodes, | ||
105 | const label enviroment | ||
119 | 106 | ) = 0; | ) = 0; |
120 | 107 | ||
121 | 108 | ||
... | ... | public: | |
124 | 111 | // Constructors | // Constructors |
125 | 112 | ||
126 | 113 | //- Construct from components | //- Construct from components |
127 | univariatePDFTransportModel | ||
114 | realizableOdeSolver | ||
128 | 115 | ( | ( |
129 | const word& name, | ||
130 | const dictionary& dict, | ||
131 | 116 | const fvMesh& mesh, | const fvMesh& mesh, |
132 | const surfaceScalarField& phi, | ||
133 | const word& support | ||
117 | const dictionary& dict | ||
134 | 118 | ); | ); |
135 | 119 | ||
136 | 120 | ||
137 | 121 | //- Destructor | //- Destructor |
138 | virtual ~univariatePDFTransportModel(); | ||
122 | virtual ~realizableOdeSolver(); | ||
139 | 123 | ||
140 | 124 | ||
141 | 125 | // Member Functions | // Member Functions |
142 | 126 | ||
143 | //- Access | ||
144 | |||
145 | //- Returns a const reference to the quadrature approximation | ||
146 | inline const univariateQuadratureApproximation& quadrature() const; | ||
127 | //- Solve univariate PDF transport equation | ||
128 | void solve(quadratureType& quadrature, const label enviroment); | ||
147 | 129 | ||
148 | //- Return the maximum Courant number ensuring moment realizability | ||
149 | inline scalar realizableCo() const; | ||
150 | |||
151 | //-Edit | ||
152 | |||
153 | //- Solve univariate PDF transport equation | ||
154 | virtual void solve(); | ||
130 | //- Read coefficients from dictionary | ||
131 | void read(const dictionary& dict); | ||
155 | 132 | }; | }; |
156 | 133 | ||
157 | 134 | ||
158 | 135 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
159 | 136 | ||
160 | } // End namespace PDFTransportModels | ||
161 | 137 | } // End namespace Foam | } // End namespace Foam |
162 | 138 | ||
163 | 139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
164 | 140 | ||
165 | #include "univariatePDFTransportModelI.H" | ||
141 | #if NoRepository | ||
142 | #include "realizableOdeSolver.C" | ||
143 | #endif | ||
166 | 144 | ||
167 | 145 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
168 | 146 |