Subject | Hash | Author | Date (UTC) |
---|---|---|---|
first commit to update code to OpenFOAM50, no coalescence kernels included | 9d70a283abb4e26983a8d9711d76d22c251fbd4c | Anurag Misra | 2018-01-23 10:50:12 |
fixed alpha BC at outlet, included new case for horizontalSettler with only 2 outlets | c3ac36e6699dc3d9c5b12ec02160e855d500cfa1 | Anurag Misra | 2017-12-13 11:57:01 |
added residualAlpha to phaseModel, updated case dictionaries | 6f0d0800829af8e706bb67ef7bb9ef344fab1cd0 | Anurag Misra | 2017-12-12 00:53:41 |
undo previous addition, add smallnumber to rAUs for stability | e5eb3353a23efd00d36c379bac1f882e74a10643 | Anurag Misra | 2017-12-11 23:57:15 |
modified pEqn.H to limit alpha to 1e-6 | 07f66051823747fc6acbf519d757b864f3306433 | Anurag Misra | 2017-12-11 23:25:12 |
fixed missing dictionary entries in case horizontalSettler2D | 47531fc01ecde45587480e12c454d968d65aa5c6 | Anurag Misra | 2017-12-06 15:48:40 |
changed boundary conditions and mesh in case horizontalSettler2D | 091228be5c25fb6c2d0f08cc5e2cdaafef28ad89 | Anurag Misra | 2017-12-06 15:31:09 |
added fvOptions compatibility in solver | ddcc6c4dfc93450a9320d59855dd1955eabb30d0 | Anurag Misra | 2017-12-06 11:43:33 |
minor changes to case files, added ifPorous field | 55f5d687cb91a4a62c5a90a0cf33cd24a1ba5d42 | Anurag Misra | 2017-12-05 22:51:09 |
bounded diameter calculation in coalescence kernel, minor modifications to units | 1c525f2807a8f960edd33c2cbd140870278952da | Anurag Misra | 2017-12-05 22:44:30 |
fixed error in buoyancykernel | 521f349b030e88ca204637cdda9995dae4802618 | Anurag Misra | 2017-12-05 22:24:28 |
Deleted extraneous case files | cecb4eca8cb2d933acaad226831230f3517c5132 | Anurag.Misra | 2017-12-05 13:10:40 |
fixed batchSettler case with real values | 5e3967ef13cd8b570522b7d1cbc59ca01f76ec16 | Anurag.Misra | 2017-12-05 13:05:30 |
fixed horizontalSettler2D mesh | d79c28081dd5b2cc6f77c9c003c26941d3a27ea6 | Anurag Misra | 2017-12-05 12:59:28 |
fixed buoyancy kernel definition | 63b8743b0bb1d1316ec16e85382cd49ca0431356 | Anurag Misra | 2017-12-05 12:53:37 |
Added additional case file for troubleshooting | 6e8b93a3ef9ab2c9bae9a6b2eb85ecedbaf45a68 | Anurag Misra | 2017-11-28 15:33:40 |
updated boundary conditions, minor changes in mesh | 3ab8a7206d97870b823dcdceb939f0494c4be1a6 | Anurag Misra | 2017-11-10 17:50:16 |
Explicity defined floats to solve compilation problems with centOS/RHEL | 5be4ffff7079912f4481525944fc5e778b9040e5 | Anurag Misra | 2017-11-09 15:16:47 |
Replaced instances of pow with Foam::pow to solve compilation problems with centOS/RHEL | 1b5fb4cbdb7d57eb035f8f3ff110d91f88109545 | Anurag Misra | 2017-11-09 15:10:32 |
Renamed testCase0 to batchSettler | 41a5dfa7953de58bea67e177a2be3282aef19b4b | Anurag Misra | 2017-11-09 15:04:56 |
File multiphaseEulerPbeFoam/Allwclean changed (mode: 100755) (index 8c4e045..e8bf7c7) | |||
1 | 1 | #!/bin/sh | #!/bin/sh |
2 | 2 | cd ${0%/*} || exit 1 # Run from this directory | cd ${0%/*} || exit 1 # Run from this directory |
3 | set -x | ||
4 | 3 | ||
5 | 4 | wcleanLnIncludeAll | wcleanLnIncludeAll |
6 | 5 | wclean libso multiphaseDisperseSystem | wclean libso multiphaseDisperseSystem |
7 | 6 | #wclean libso eigenSolver | #wclean libso eigenSolver |
8 | 7 | #wclean libso Vandermonde | #wclean libso Vandermonde |
9 | #wclean libso quadratureMethods/univariateMomentSet | ||
10 | #wclean libso quadratureMethods/extentedMomentInversion | ||
11 | #wclean libso quadratureMethods/multivariateMomentInversion | ||
12 | #wclean libso quadratureMethods/quadratureApproximation | ||
8 | #wclean libso quadratureMethods/momentSets | ||
9 | #wclean libso quadratureMethods/momentInversion/univariate/basic | ||
10 | #wclean libso quadratureMethods/momentInversion/univariate/extended | ||
11 | #wclean libso quadratureMethods/momentInversion/multivariate | ||
12 | #wclean libso quadratureMethods/fieldMomentInversion | ||
13 | #wclean libso quadratureMethods/momentAdvection | ||
13 | 14 | #wclean libso quadratureMethods/PDFTransportModels | #wclean libso quadratureMethods/PDFTransportModels |
14 | wclean libso quadratureMethods/populationBalanceModels | ||
15 | #wclean libso quadratureMethods/populationBalanceModels | ||
15 | 16 | #wclean libso quadratureMethods/mixingModels | #wclean libso quadratureMethods/mixingModels |
16 | #wclean libso interfacialModels | ||
17 | wclean libso interfacialModels | ||
17 | 18 | wclean | wclean |
18 | 19 | ||
19 | 20 | # ----------------------------------------------------------------- end-of-file | # ----------------------------------------------------------------- end-of-file |
File multiphaseEulerPbeFoam/Allwmake changed (mode: 100755) (index 7135c20..9fbe48e) | |||
1 | 1 | #!/bin/sh | #!/bin/sh |
2 | 2 | cd ${0%/*} || exit 1 # Run from this directory | cd ${0%/*} || exit 1 # Run from this directory |
3 | set -x | ||
3 | |||
4 | . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments | ||
4 | 5 | ||
5 | 6 | wmakeLnIncludeAll | wmakeLnIncludeAll |
6 | wmake libso multiphaseDisperseSystem | ||
7 | #wmake libso eigenSolver | ||
8 | #wmake libso Vandermonde | ||
9 | #wmake libso quadratureMethods/univariateMomentSet | ||
10 | #wmake libso quadratureMethods/extentedMomentInversion | ||
11 | #wmake libso quadratureMethods/multivariateMomentInversion | ||
12 | #wmake libso quadratureMethods/quadratureApproximation | ||
13 | #wmake libso quadratureMethods/PDFTransportModels | ||
14 | wmake libso quadratureMethods/populationBalanceModels | ||
15 | #wmake libso quadratureMethods/mixingModels | ||
16 | #wmake libso interfacialModels | ||
17 | wmake | ||
7 | wmake $targetType multiphaseDisperseSystem | ||
8 | wmake $targetType eigenSolver | ||
9 | wmake $targetType Vandermonde | ||
10 | wmake $targetType quadratureMethods/momentSets | ||
11 | wmake $targetType quadratureMethods/momentInversion/univariate/basic | ||
12 | wmake $targetType quadratureMethods/momentInversion/univariate/extended | ||
13 | wmake $targetType quadratureMethods/momentInversion/multivariate | ||
14 | wmake $targetType quadratureMethods/hermiteQuadrature | ||
15 | wmake $targetType quadratureMethods/fieldMomentInversion | ||
16 | wmake $targetType quadratureMethods/quadratureApproximations | ||
17 | wmake $targetType quadratureMethods/momentAdvection | ||
18 | wmake $targetType quadratureMethods/PDFTransportModels | ||
19 | wmake $targetType quadratureMethods/populationBalanceModels | ||
20 | wmake $targetType quadratureMethods/mixingModels | ||
21 | wmake $targetType interfacialModels | ||
22 | wmake $targetType | ||
18 | 23 | ||
19 | 24 | # ----------------------------------------------------------------- end-of-file | # ----------------------------------------------------------------- end-of-file |
File multiphaseEulerPbeFoam/Make/options changed (mode: 100644) (index f512eb1..5ffd138) | |||
... | ... | EXE_INC = \ | |
13 | 13 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
14 | 14 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
15 | 15 | -I$(LIB_SRC)/fvOptions/lnInclude \ | -I$(LIB_SRC)/fvOptions/lnInclude \ |
16 | -I$../quadratureMethods/univariateMomentSet/lnInclude \ | ||
17 | -I$../quadratureMethods/extentedMomentInversion/lnInclude \ | ||
16 | -I$../quadratureMethods/momentSets/lnInclude \ | ||
17 | -I$../quadratureMethods/momentInversion/univariate/basic/lnInclude \ | ||
18 | 18 | -I$../quadratureMethods/quadratureNode \ | -I$../quadratureMethods/quadratureNode \ |
19 | 19 | -I$../quadratureMethods/moments \ | -I$../quadratureMethods/moments \ |
20 | -I$../quadratureMethods/quadratureApproximation/lnInclude \ | ||
21 | -I$../quadratureMethods/populationBalanceModels/lnInclude | ||
20 | -I$../quadratureMethods/fieldMomentInversion/lnInclude \ | ||
21 | -I$../quadratureMethods/quadratureApproximations/lnInclude \ | ||
22 | -I$../quadratureMethods/populationBalanceModels/lnInclude \ | ||
23 | -I$../Vandermonde/lnInclude | ||
22 | 24 | ||
23 | 25 | EXE_LIBS = \ | EXE_LIBS = \ |
24 | 26 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
... | ... | EXE_LIBS = \ | |
31 | 33 | -lfiniteVolume \ | -lfiniteVolume \ |
32 | 34 | -lfvOptions \ | -lfvOptions \ |
33 | 35 | -lmeshTools \ | -lmeshTools \ |
34 | -lmomentSet \ | ||
36 | -lmomentSets \ | ||
35 | 37 | -lextendedMomentInversion \ | -lextendedMomentInversion \ |
38 | -lfieldMomentInversion \ | ||
36 | 39 | -lquadratureApproximation \ | -lquadratureApproximation \ |
37 | 40 | -lpopulationBalance \ | -lpopulationBalance \ |
41 | -lvandermonde \ | ||
38 | 42 | -DFULLDEBUG -g -O0 | -DFULLDEBUG -g -O0 |
43 |
File multiphaseEulerPbeFoam/Vandermonde/Vandermonde.C changed (mode: 100644) (index 36bee86..88cc3a6) | |||
... | ... | Foam::Vandermonde::Vandermonde | |
52 | 52 | { | { |
53 | 53 | for (label j = 0; i < m_; j++) | for (label j = 0; i < m_; j++) |
54 | 54 | { | { |
55 | if (A[i][j] != Foam::pow(A[1][j], i)) | ||
55 | if (A[i][j] != pow(A[1][j], i)) | ||
56 | 56 | { | { |
57 | 57 | FatalErrorInFunction | FatalErrorInFunction |
58 | 58 | << "Source matrix not of Vandermonde type." << nl | << "Source matrix not of Vandermonde type." << nl |
File multiphaseEulerPbeFoam/Vandermonde/VandermondeI.H changed (mode: 100755 -> 100644) |
File multiphaseEulerPbeFoam/eigenSolver/eigenSolver.C changed (mode: 100644) (index 872843f..6e1d3a9) | |||
... | ... | void Foam::eigenSolver::symmTridiagQL() | |
254 | 254 | ||
255 | 255 | scalar f = scalar(0); | scalar f = scalar(0); |
256 | 256 | scalar tst1 = scalar(0); | scalar tst1 = scalar(0); |
257 | scalar eps = Foam::pow(2.0, -52.0); | ||
257 | scalar eps = pow(2.0, -52.0); | ||
258 | 258 | ||
259 | 259 | for (label l = 0; l < n_; l++) | for (label l = 0; l < n_; l++) |
260 | 260 | { | { |
... | ... | void Foam::eigenSolver::realSchur() | |
502 | 502 | label n = nn - 1; | label n = nn - 1; |
503 | 503 | label low = 0; | label low = 0; |
504 | 504 | label high = nn - 1; | label high = nn - 1; |
505 | scalar eps = Foam::pow(2.0, -52.0); | ||
505 | scalar eps = pow(2.0, -52.0); | ||
506 | 506 | scalar exshift = scalar(0); | scalar exshift = scalar(0); |
507 | 507 | scalar p = 0, q = 0, r = 0, s = 0, z = 0, t, w, x, y; | scalar p = 0, q = 0, r = 0, s = 0, z = 0, t, w, x, y; |
508 | 508 | ||
... | ... | void Foam::eigenSolver::realSchur() | |
937 | 937 | ||
938 | 938 | for (label i = n - 2; i >= 0; i--) | for (label i = n - 2; i >= 0; i--) |
939 | 939 | { | { |
940 | scalar ra,sa,vr,vi; | ||
940 | scalar ra, sa, vr, vi; | ||
941 | 941 | ra = scalar(0); | ra = scalar(0); |
942 | 942 | sa = scalar(0); | sa = scalar(0); |
943 | 943 |
File multiphaseEulerPbeFoam/interfacialModels/Make/options changed (mode: 100644) (index 1ece97b..195a339) | |||
... | ... | EXE_INC = \ | |
4 | 4 | -I$(LIB_SRC)/finiteVolume/lnInclude | -I$(LIB_SRC)/finiteVolume/lnInclude |
5 | 5 | ||
6 | 6 | LIB_LIBS = \ | LIB_LIBS = \ |
7 | -L$(FOAM_USER_LIBBIN) \ | ||
7 | 8 | -lmultiphaseDisperseSystem | -lmultiphaseDisperseSystem |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C changed (mode: 100644) (index cc4c7f9..cd9e68d) | |||
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) 2011-2012 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowErgunWenYu::K | |
78 | 78 | volScalarField Cds | volScalarField Cds |
79 | 79 | ( | ( |
80 | 80 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) |
81 | + pos(Re - 1000)*0.44 | ||
81 | + pos0(Re - 1000)*0.44 | ||
82 | 82 | ); | ); |
83 | 83 | ||
84 | 84 | // Wen and Yu (1966) | // Wen and Yu (1966) |
85 | 85 | return | return |
86 | 86 | ( | ( |
87 | pos(alpha2 - 0.8) | ||
87 | pos0(alpha2 - 0.8) | ||
88 | 88 | *(0.75*Cds*phase2_.rho()*Ur*bp/d) | *(0.75*Cds*phase2_.rho()*Ur*bp/d) |
89 | 89 | + neg(alpha2 - 0.8) | + neg(alpha2 - 0.8) |
90 | 90 | *( | *( |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C changed (mode: 100644) (index 5e2048a..59d3358) | |||
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) 2011-2012 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowSchillerNaumann::K | |
77 | 77 | volScalarField Cds | volScalarField Cds |
78 | 78 | ( | ( |
79 | 79 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) |
80 | + pos(Re - 1000)*0.44 | ||
80 | + pos0(Re - 1000)*0.44 | ||
81 | 81 | ); | ); |
82 | 82 | ||
83 | 83 | return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); | return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/SchillerNaumann/SchillerNaumann.C changed (mode: 100644) (index d4d77a2..a9983ed) | |||
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) 2011 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::tmp<Foam::volScalarField> Foam::dragModels::SchillerNaumann::K | |
74 | 74 | volScalarField Cds | volScalarField Cds |
75 | 75 | ( | ( |
76 | 76 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) |
77 | + pos(Re - 1000)*0.44 | ||
77 | + pos0(Re - 1000)*0.44 | ||
78 | 78 | ); | ); |
79 | 79 | ||
80 | 80 | return 0.75*Cds*phase2_.rho()*Ur/phase1_.d(); | return 0.75*Cds*phase2_.rho()*Ur/phase1_.d(); |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/SyamlalOBrien/SyamlalOBrien.C changed (mode: 100644) (index 83419c5..975ad0c) | |||
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) 2011-2012 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::tmp<Foam::volScalarField> Foam::dragModels::SyamlalOBrien::K | |
75 | 75 | volScalarField B | volScalarField B |
76 | 76 | ( | ( |
77 | 77 | neg(alpha2 - 0.85)*(0.8*pow(alpha2, 1.28)) | neg(alpha2 - 0.85)*(0.8*pow(alpha2, 1.28)) |
78 | + pos(alpha2 - 0.85)*(pow(alpha2, 2.65)) | ||
78 | + pos0(alpha2 - 0.85)*(pow(alpha2, 2.65)) | ||
79 | 79 | ); | ); |
80 | 80 | ||
81 | 81 | volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); | volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); |
File multiphaseEulerPbeFoam/interfacialModels/dragModels/WenYu/WenYu.C changed (mode: 100644) (index fd644f5..55c58b6) | |||
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) 2011-2012 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::tmp<Foam::volScalarField> Foam::dragModels::WenYu::K | |
77 | 77 | volScalarField Cds | volScalarField Cds |
78 | 78 | ( | ( |
79 | 79 | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) | neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) |
80 | + pos(Re - 1000)*0.44 | ||
80 | + pos0(Re - 1000)*0.44 | ||
81 | 81 | ); | ); |
82 | 82 | ||
83 | 83 | return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); | return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); |
File multiphaseEulerPbeFoam/mappedList/mappedList.C copied from file multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedList.C (similarity 50%) (mode: 100644) (index 1b2db14..e1a6b90) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "nDimensionalMappedList.H" | ||
26 | #include "mappedList.H" | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // |
30 | 30 | ||
31 | 31 | template <class mappedType> | template <class mappedType> |
32 | 32 | Foam::word | Foam::word |
33 | Foam::nDimensionalMappedList<mappedType>::listToWord(const labelList& lst) | ||
33 | Foam::mappedList<mappedType>::listToWord(const labelList& lst) | ||
34 | 34 | { | { |
35 | 35 | word w; | word w; |
36 | 36 | ||
... | ... | Foam::nDimensionalMappedList<mappedType>::listToWord(const labelList& lst) | |
44 | 44 | ||
45 | 45 | template <class mappedType> | template <class mappedType> |
46 | 46 | Foam::label | Foam::label |
47 | Foam::nDimensionalMappedList<mappedType>::listToLabel(const labelList& lst) | ||
47 | Foam::mappedList<mappedType>::listToLabel(const labelList& lst) | ||
48 | 48 | { | { |
49 | 49 | label l = 0; | label l = 0; |
50 | 50 | ||
51 | 51 | forAll(lst, dimi) | forAll(lst, dimi) |
52 | 52 | { | { |
53 | l += lst[dimi]*Foam::pow(10, lst.size() - dimi - 1.0); | ||
53 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
54 | 54 | } | } |
55 | 55 | ||
56 | 56 | return l; | return l; |
... | ... | Foam::nDimensionalMappedList<mappedType>::listToLabel(const labelList& lst) | |
59 | 59 | ||
60 | 60 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
61 | 61 | ||
62 | template <class mappedType> | ||
63 | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | ||
62 | template <class mappedType> Foam::mappedList<mappedType>::mappedList | ||
63 | ( | ||
64 | const label size, | ||
65 | const labelListList& indexes | ||
66 | ) | ||
67 | : | ||
68 | List<mappedType>(size), | ||
69 | map_(size) | ||
70 | { | ||
71 | forAll(*this, elemi) | ||
72 | { | ||
73 | map_.insert | ||
74 | ( | ||
75 | listToLabel(indexes[elemi]), | ||
76 | elemi | ||
77 | ); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | template <class mappedType> Foam::mappedList<mappedType>::mappedList | ||
82 | ( | ||
83 | const label size, | ||
84 | const labelListList& indexes, | ||
85 | const mappedType& initValue | ||
86 | ) | ||
87 | : | ||
88 | List<mappedType>(size, initValue), | ||
89 | map_(size) | ||
90 | { | ||
91 | forAll(*this, elemi) | ||
92 | { | ||
93 | map_.insert | ||
94 | ( | ||
95 | listToLabel(indexes[elemi]), | ||
96 | elemi | ||
97 | ); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | template <class mappedType> Foam::mappedList<mappedType>::mappedList | ||
64 | 102 | ( | ( |
65 | const label nCmpt, | ||
66 | const label nDims, | ||
67 | const Map<label>& map | ||
103 | const label size, | ||
104 | const Map<label>& map, | ||
105 | const mappedType& initValue | ||
68 | 106 | ) | ) |
69 | 107 | : | : |
70 | PtrList<mappedType>(nCmpt), | ||
71 | nDims_(nDims), | ||
108 | List<mappedType>(size, initValue), | ||
72 | 109 | map_(map) | map_(map) |
73 | 110 | {} | {} |
74 | 111 | ||
75 | template <class mappedType> | ||
76 | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | ||
112 | template <class mappedType> Foam::mappedList<mappedType>::mappedList | ||
77 | 113 | ( | ( |
78 | const label nDims, | ||
79 | const labelList& nNodes | ||
114 | const List<mappedType>& initList, | ||
115 | const labelListList& indexes | ||
80 | 116 | ) | ) |
81 | 117 | : | : |
82 | PtrList<mappedType>(nDimensionalListLength(nDims, nNodes)), | ||
83 | nDims_(nDims), | ||
84 | map_(this->size()) | ||
118 | List<mappedType>(initList), | ||
119 | map_(initList.size()) | ||
85 | 120 | { | { |
86 | labelList pos(nDims); | ||
87 | label mi = 0; | ||
88 | setMappedPositions(nNodes, 0, mi, pos); | ||
121 | forAll(*this, elemi) | ||
122 | { | ||
123 | map_.insert | ||
124 | ( | ||
125 | listToLabel(indexes[elemi]), | ||
126 | elemi | ||
127 | ); | ||
128 | } | ||
89 | 129 | } | } |
90 | 130 | ||
91 | 131 | ||
92 | 132 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
93 | 133 | ||
94 | 134 | template <class mappedType> | template <class mappedType> |
95 | Foam::nDimensionalMappedList<mappedType>::~nDimensionalMappedList() | ||
135 | Foam::mappedList<mappedType>::~mappedList() | ||
96 | 136 | {} | {} |
97 | 137 | ||
98 | 138 | ||
99 | 139 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
100 | 140 | ||
101 | 141 | template <class mappedType> | template <class mappedType> |
102 | void Foam::nDimensionalMappedList<mappedType>::setMappedPositions | ||
142 | Foam::label Foam::mappedList<mappedType>::calcMapIndex | ||
103 | 143 | ( | ( |
104 | const labelList& nNodes, | ||
105 | label dimi, | ||
106 | label& mi, | ||
107 | labelList& pos | ||
108 | ) | ||
144 | std::initializer_list<Foam::label> indexes | ||
145 | ) const | ||
109 | 146 | { | { |
110 | if (dimi < nDims_) | ||
147 | label argSize = indexes.size(); | ||
148 | label mapIndex = 0; | ||
149 | |||
150 | if (argSize > 0) | ||
111 | 151 | { | { |
112 | for (label i = 0; i < nNodes[dimi]; i++) | ||
152 | for | ||
153 | ( | ||
154 | std::initializer_list<label>::iterator iter = indexes.begin(); | ||
155 | iter < indexes.end(); | ||
156 | iter++ | ||
157 | ) | ||
113 | 158 | { | { |
114 | pos[dimi] = i; | ||
115 | setMappedPositions(nNodes, dimi+1, mi, pos); | ||
159 | label argIndex = std::distance(indexes.begin(), iter); | ||
160 | mapIndex += (*iter)*pow(10, argSize - argIndex - 1); | ||
116 | 161 | } | } |
117 | 162 | } | } |
118 | else | ||
119 | { | ||
120 | map_.insert | ||
121 | ( | ||
122 | listToLabel | ||
123 | ( | ||
124 | pos | ||
125 | ), | ||
126 | mi | ||
127 | ); | ||
128 | mi++; | ||
129 | } | ||
130 | } | ||
131 | 163 | ||
132 | template <class mappedType> | ||
133 | Foam::label Foam::nDimensionalMappedList<mappedType>::nDimensionalListLength | ||
134 | ( | ||
135 | const label nDims, | ||
136 | const labelList nNodes | ||
137 | ) | ||
138 | { | ||
139 | label totalProduct = 1; | ||
140 | for(label nodei = 0; nodei < nDims; nodei++) | ||
141 | { | ||
142 | totalProduct *= nNodes[nodei]; | ||
143 | } | ||
144 | return totalProduct; | ||
164 | return mapIndex; | ||
145 | 165 | } | } |
146 | 166 | ||
147 | |||
148 | 167 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/mappedList/mappedList.H added (mode: 100644) (index 0000000..c6be1a2) | |||
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 | Class | ||
25 | Foam::mappedList | ||
26 | |||
27 | Description | ||
28 | Stores a list, with a Map<label> that takes a label key and returns | ||
29 | the index into the list. | ||
30 | |||
31 | Example | ||
32 | |||
33 | Lookup | Label Key | Index | ||
34 | 0 0 0 0 0 | ||
35 | 1 0 0 100 1 | ||
36 | 0 1 0 10 2 | ||
37 | 0 0 1 1 3 | ||
38 | 2 0 0 200 4 | ||
39 | 2 1 0 210 5 | ||
40 | |||
41 | The operator () is overloaded in order to hide the above mapping. | ||
42 | |||
43 | SourceFiles | ||
44 | mappedListI.H | ||
45 | mappedList.C | ||
46 | |||
47 | \*---------------------------------------------------------------------------*/ | ||
48 | |||
49 | #ifndef mappedList_H | ||
50 | #define mappedList_H | ||
51 | |||
52 | #include "scalar.H" | ||
53 | #include "List.H" | ||
54 | #include "Map.H" | ||
55 | |||
56 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
57 | |||
58 | namespace Foam | ||
59 | { | ||
60 | |||
61 | /*---------------------------------------------------------------------------*\ | ||
62 | Class mappedList Declaration | ||
63 | \*---------------------------------------------------------------------------*/ | ||
64 | |||
65 | template <class mappedType> | ||
66 | class mappedList | ||
67 | : | ||
68 | public List<mappedType> | ||
69 | { | ||
70 | // Private data | ||
71 | |||
72 | //- Map from the label to its index within the List | ||
73 | Map<label> map_; | ||
74 | |||
75 | |||
76 | // Private Member Functions | ||
77 | |||
78 | //- Returns an element provided the indeces of the order | ||
79 | label calcMapIndex(std::initializer_list<label> indexes) const; | ||
80 | |||
81 | |||
82 | public: | ||
83 | |||
84 | // Constructors | ||
85 | |||
86 | //- Construct from size and labelListList | ||
87 | mappedList | ||
88 | ( | ||
89 | const label size, | ||
90 | const labelListList& indexes | ||
91 | ); | ||
92 | |||
93 | //- Construct from size and labelListList with initial value for | ||
94 | // all elements | ||
95 | mappedList | ||
96 | ( | ||
97 | const label size, | ||
98 | const labelListList& indexes, | ||
99 | const mappedType& initValue | ||
100 | ); | ||
101 | |||
102 | //- Construct from size and map with initial value for all elements | ||
103 | mappedList | ||
104 | ( | ||
105 | const label size, | ||
106 | const Map<label>& map, | ||
107 | const mappedType& initValue | ||
108 | ); | ||
109 | |||
110 | //- Construct from List<mappedType> and labelListList | ||
111 | mappedList | ||
112 | ( | ||
113 | const List<mappedType>& initList, | ||
114 | const labelListList& indexes | ||
115 | ); | ||
116 | |||
117 | |||
118 | //- Destructor | ||
119 | ~mappedList(); | ||
120 | |||
121 | |||
122 | // Member Functions | ||
123 | |||
124 | // Static member functions | ||
125 | |||
126 | //- Convert a list of labels to a word. {1, 2, 3} -> 123 | ||
127 | static word listToWord(const labelList& lst); | ||
128 | |||
129 | //- Convert a list of labels to a single label. {0, 2, 3} -> 23 | ||
130 | static label listToLabel(const labelList& lst); | ||
131 | |||
132 | |||
133 | // Access | ||
134 | |||
135 | //- Non-const access to a moment given the list of orders | ||
136 | template <typename ...ArgsT> | ||
137 | inline mappedType& operator()(ArgsT ...args); | ||
138 | |||
139 | //- Const access to a moment given the list of orders | ||
140 | template <typename ...ArgsT> | ||
141 | inline const mappedType& operator()(ArgsT ...args) const; | ||
142 | |||
143 | //- Constant access given a label list | ||
144 | inline const mappedType& operator()(const labelList& l) const; | ||
145 | |||
146 | //- Non-constant access given a label list | ||
147 | inline mappedType& operator()(const labelList& l); | ||
148 | |||
149 | //- Returns const access to the moment map | ||
150 | inline const Map<label>& map() const; | ||
151 | }; | ||
152 | |||
153 | |||
154 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
155 | |||
156 | } // End namespace Foam | ||
157 | |||
158 | |||
159 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
160 | |||
161 | #ifdef NoRepository | ||
162 | # include "mappedListI.H" | ||
163 | # include "mappedList.C" | ||
164 | #endif | ||
165 | |||
166 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
167 | |||
168 | #endif | ||
169 | |||
170 | |||
171 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/mappedList/mappedListI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversionI.H (similarity 56%) (mode: 100644) (index a9be43b..8de3652) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | |||
27 | 26 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
28 | 27 | ||
29 | //- Return the total number of moments | ||
30 | Foam::label Foam::multivariateMomentInversion::nMoments() | ||
28 | template <class mappedType> | ||
29 | template <typename ...ArgsT> | ||
30 | mappedType& Foam::mappedList<mappedType>::operator()(ArgsT ...args) | ||
31 | 31 | { | { |
32 | return nMoments_; | ||
32 | label mapIndex = calcMapIndex({args...}); | ||
33 | |||
34 | return this->operator[](map_[mapIndex]); | ||
33 | 35 | } | } |
34 | 36 | ||
35 | //- Return the list of nNodes | ||
36 | const Foam::labelList& Foam::multivariateMomentInversion::nNodes() | ||
37 | template <class mappedType> | ||
38 | template <typename ...ArgsT> | ||
39 | const mappedType& | ||
40 | Foam::mappedList<mappedType>::operator()(ArgsT ...args) const | ||
37 | 41 | { | { |
38 | return nNodes_; | ||
42 | Foam::label mapIndex = calcMapIndex({args...}); | ||
43 | |||
44 | return this->operator[](map_[mapIndex]); | ||
39 | 45 | } | } |
40 | 46 | ||
41 | //- Return mapped list of weights | ||
42 | const Foam::PtrList< Foam::nDimensionalMappedList< Foam::scalar> >& | ||
43 | Foam::multivariateMomentInversion::weights() const | ||
47 | template <class mappedType> | ||
48 | const mappedType& Foam::mappedList<mappedType>::operator() | ||
49 | ( | ||
50 | const Foam::labelList& l | ||
51 | ) const | ||
44 | 52 | { | { |
45 | return weights_; | ||
53 | return this->operator[](map_[listToLabel(l)]); | ||
46 | 54 | } | } |
47 | 55 | ||
48 | //- Return mapped list of abscissae | ||
49 | const Foam::PtrList< Foam::nDimensionalMappedList< Foam::scalar> >& | ||
50 | Foam::multivariateMomentInversion::abscissae() const | ||
56 | template <class mappedType> | ||
57 | mappedType& Foam::mappedList<mappedType>::operator() | ||
58 | ( | ||
59 | const Foam::labelList& l | ||
60 | ) | ||
51 | 61 | { | { |
52 | return abscissae_; | ||
62 | return this->operator[](map_[listToLabel(l)]); | ||
53 | 63 | } | } |
54 | 64 | ||
65 | template <class mappedType> const Foam::Map<Foam::label>& | ||
66 | Foam::mappedList<mappedType>::map() const | ||
67 | { | ||
68 | return map_; | ||
69 | } | ||
55 | 70 | ||
56 | 71 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/mappedList/mappedLists.H copied from file multiphaseEulerPbeFoam/quadratureMethods/moments/moments.H (similarity 75%) (mode: 100644) (index 46e0acc..3e49fdd) | |||
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-2017 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::mappedLists | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | ||
... | ... | SourceFiles | |
33 | 33 | #ifndef moments_H | #ifndef moments_H |
34 | 34 | #define moments_H | #define moments_H |
35 | 35 | ||
36 | #include "volFields.H" | ||
37 | #include "quadratureNodes.H" | ||
38 | #include "moment.H" | ||
36 | #include "mappedList.H" | ||
39 | 37 | ||
40 | 38 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 39 | ||
42 | 40 | namespace Foam | namespace Foam |
43 | 41 | { | { |
44 | 42 | ||
45 | typedef moment<volScalarField, extendedVolScalarNode> volUnivariateMoment; | ||
43 | typedef mappedList<label> mappedLabelList; | ||
46 | 44 | ||
47 | typedef moment<surfaceScalarField, extendedSurfaceScalarNode> | ||
48 | surfaceUnivariateMoment; | ||
49 | |||
50 | typedef moment<volScalarField, extendedVolScalarNode> basicVolUnivariateMoment; | ||
51 | |||
52 | typedef moment<surfaceScalarField, basicSurfaceScalarNode> | ||
53 | basicSurfaceUnivariateMoment; | ||
45 | typedef mappedList<scalar> mappedScalarList; | ||
54 | 46 | ||
55 | 47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
56 | 48 |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/QBMM/QBMMDiameter.H changed (mode: 100644) (index 4d5915f..29fe420) | |||
... | ... | public: | |
100 | 100 | // Member Functions | // Member Functions |
101 | 101 | ||
102 | 102 | //- Return the Sauter-mean diameter | //- Return the Sauter-mean diameter |
103 | virtual tmp<volScalarField> d() const | ||
103 | tmp<volScalarField> d() const | ||
104 | 104 | { | { |
105 | 105 | return d_; | return d_; |
106 | 106 | } | } |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/constantDiameter/constantDiameter.C changed (mode: 100644) (index bfa2557..88b867f) | |||
... | ... | Foam::tmp<Foam::volScalarField> Foam::diameterModels::constant::d() const | |
84 | 84 | } | } |
85 | 85 | ||
86 | 86 | ||
87 | |||
88 | 87 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/constantDiameter/constantDiameter.H changed (mode: 100644) (index a27909c..4a63c2b) | |||
... | ... | public: | |
81 | 81 | // Member Functions | // Member Functions |
82 | 82 | ||
83 | 83 | //- Return the diameter as a field | //- Return the diameter as a field |
84 | virtual tmp<volScalarField> d() const; | ||
84 | tmp<volScalarField> d() const; | ||
85 | 85 | }; | }; |
86 | 86 | ||
87 | 87 |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/diameterModel/diameterModel.C changed (mode: 100644) (index c57ec8c..a87da0c) | |||
... | ... | void Foam::diameterModel::correct() | |
59 | 59 | {} | {} |
60 | 60 | ||
61 | 61 | ||
62 | |||
63 | 62 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/diameterModel/newDiameterModel.C changed (mode: 100644) (index b58f002..ef872df) | |||
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) 2011-2015 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::autoPtr<Foam::diameterModel> Foam::diameterModel::New | |
56 | 56 | << exit(FatalError); | << exit(FatalError); |
57 | 57 | } | } |
58 | 58 | ||
59 | return cstrIter()(dict.subDict(diameterModelType + "Coeffs"), phase); | ||
59 | return cstrIter() | ||
60 | ( | ||
61 | dict.optionalSubDict(diameterModelType + "Coeffs"), | ||
62 | phase | ||
63 | ); | ||
60 | 64 | } | } |
61 | 65 | ||
62 | 66 |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/isothermalDiameter/isothermalDiameter.H changed (mode: 100644) (index 65181e9..eb0f1a5) | |||
... | ... | public: | |
84 | 84 | // Member Functions | // Member Functions |
85 | 85 | ||
86 | 86 | //- Return the diameter field | //- Return the diameter field |
87 | virtual tmp<volScalarField> d() const; | ||
87 | tmp<volScalarField> d() const; | ||
88 | 88 | ||
89 | 89 | }; | }; |
90 | 90 |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/multiphaseDisperseSystem.C changed (mode: 100644) (index 45e3dbf..56ed51f) | |||
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) 2011-2016 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
64 | 64 | ||
65 | 65 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | forAllIter(PtrDictionary<phaseModel>, phases_, iter) |
66 | 66 | { | { |
67 | phaseModel& phase1 = iter(); | ||
68 | volScalarField& alpha1 = phase1; | ||
69 | |||
70 | phase1.alphaPhi() = | ||
71 | dimensionedScalar("0", dimensionSet(0, 3, -1, 0, 0), 0); | ||
67 | phaseModel& phase = iter(); | ||
68 | volScalarField& alpha1 = phase; | ||
72 | 69 | ||
73 | 70 | alphaPhiCorrs.set | alphaPhiCorrs.set |
74 | 71 | ( | ( |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
79 | 76 | fvc::flux | fvc::flux |
80 | 77 | ( | ( |
81 | 78 | phi_, | phi_, |
82 | phase1, | ||
79 | phase, | ||
83 | 80 | "div(phi," + alpha1.name() + ')' | "div(phi," + alpha1.name() + ')' |
84 | 81 | ) | ) |
85 | 82 | ) | ) |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
92 | 89 | phaseModel& phase2 = iter2(); | phaseModel& phase2 = iter2(); |
93 | 90 | volScalarField& alpha2 = phase2; | volScalarField& alpha2 = phase2; |
94 | 91 | ||
95 | if (&phase2 == &phase1) continue; | ||
92 | if (&phase2 == &phase) continue; | ||
96 | 93 | ||
97 | surfaceScalarField phir(phase1.phi() - phase2.phi()); | ||
94 | surfaceScalarField phir(phase.phi() - phase2.phi()); | ||
98 | 95 | ||
99 | 96 | scalarCoeffSymmTable::const_iterator cAlpha | scalarCoeffSymmTable::const_iterator cAlpha |
100 | 97 | ( | ( |
101 | cAlphas_.find(interfacePair(phase1, phase2)) | ||
98 | cAlphas_.find(interfacePair(phase, phase2)) | ||
102 | 99 | ); | ); |
103 | 100 | ||
104 | 101 | if (cAlpha != cAlphas_.end()) | if (cAlpha != cAlphas_.end()) |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
108 | 105 | (mag(phi_) + mag(phir))/mesh_.magSf() | (mag(phi_) + mag(phir))/mesh_.magSf() |
109 | 106 | ); | ); |
110 | 107 | ||
111 | phir += min(cAlpha()*phic, max(phic))*nHatf(phase1, phase2); | ||
108 | phir += min(cAlpha()*phic, max(phic))*nHatf(phase, phase2); | ||
112 | 109 | } | } |
113 | 110 | ||
114 | 111 | word phirScheme | word phirScheme |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
119 | 116 | alphaPhiCorr += fvc::flux | alphaPhiCorr += fvc::flux |
120 | 117 | ( | ( |
121 | 118 | -fvc::flux(-phir, phase2, phirScheme), | -fvc::flux(-phir, phase2, phirScheme), |
122 | phase1, | ||
119 | phase, | ||
123 | 120 | phirScheme | phirScheme |
124 | 121 | ); | ); |
125 | 122 | } | } |
126 | 123 | ||
127 | surfaceScalarField::Boundary& alphaPhiCorrBf = | ||
128 | alphaPhiCorr.boundaryFieldRef(); | ||
129 | |||
130 | // Ensure that the flux at inflow BCs is preserved | ||
131 | forAll(alphaPhiCorrBf, patchi) | ||
132 | { | ||
133 | fvsPatchScalarField& alphaPhiCorrp = alphaPhiCorrBf[patchi]; | ||
134 | |||
135 | if (!alphaPhiCorrp.coupled()) | ||
136 | { | ||
137 | const scalarField& phi1p = phase1.phi().boundaryField()[patchi]; | ||
138 | const scalarField& alpha1p = alpha1.boundaryField()[patchi]; | ||
139 | |||
140 | forAll(alphaPhiCorrp, facei) | ||
141 | { | ||
142 | if (phi1p[facei] < 0) | ||
143 | { | ||
144 | alphaPhiCorrp[facei] = alpha1p[facei]*phi1p[facei]; | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | } | ||
124 | phase.correctInflowOutflow(alphaPhiCorr); | ||
149 | 125 | ||
150 | 126 | MULES::limit | MULES::limit |
151 | 127 | ( | ( |
152 | 128 | 1.0/mesh_.time().deltaT().value(), | 1.0/mesh_.time().deltaT().value(), |
153 | 129 | geometricOneField(), | geometricOneField(), |
154 | phase1, | ||
130 | phase, | ||
155 | 131 | phi_, | phi_, |
156 | 132 | alphaPhiCorr, | alphaPhiCorr, |
157 | 133 | zeroField(), | zeroField(), |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
182 | 158 | ||
183 | 159 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | forAllIter(PtrDictionary<phaseModel>, phases_, iter) |
184 | 160 | { | { |
185 | phaseModel& phase1 = iter(); | ||
161 | phaseModel& phase = iter(); | ||
186 | 162 | ||
187 | 163 | surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei]; | surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei]; |
188 | alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase1); | ||
164 | alphaPhi += upwind<scalar>(mesh_, phi_).flux(phase); | ||
165 | phase.correctInflowOutflow(alphaPhi); | ||
189 | 166 | ||
190 | 167 | MULES::explicitSolve | MULES::explicitSolve |
191 | 168 | ( | ( |
192 | 169 | geometricOneField(), | geometricOneField(), |
193 | phase1, | ||
170 | phase, | ||
194 | 171 | alphaPhi, | alphaPhi, |
195 | 172 | zeroField(), | zeroField(), |
196 | 173 | zeroField() | zeroField() |
197 | 174 | ); | ); |
198 | 175 | ||
199 | phase1.alphaPhi() += alphaPhi; | ||
176 | phase.alphaPhi() = alphaPhi; | ||
200 | 177 | ||
201 | Info<< phase1.name() << " volume fraction, min, max = " | ||
202 | << phase1.weightedAverage(mesh_.V()).value() | ||
203 | << ' ' << min(phase1).value() | ||
204 | << ' ' << max(phase1).value() | ||
178 | Info<< phase.name() << " volume fraction, min, max = " | ||
179 | << phase.weightedAverage(mesh_.V()).value() | ||
180 | << ' ' << min(phase).value() | ||
181 | << ' ' << max(phase).value() | ||
205 | 182 | << endl; | << endl; |
206 | 183 | ||
207 | sumAlpha += phase1; | ||
184 | sumAlpha += phase; | ||
208 | 185 | ||
209 | 186 | phasei++; | phasei++; |
210 | 187 | } | } |
... | ... | void Foam::multiphaseDisperseSystem::solveAlphas() | |
215 | 192 | << ' ' << max(sumAlpha).value() | << ' ' << max(sumAlpha).value() |
216 | 193 | << endl; | << endl; |
217 | 194 | ||
195 | // Correct the sum of the phase-fractions to avoid 'drift' | ||
196 | volScalarField sumCorr(1.0 - sumAlpha); | ||
197 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | ||
198 | { | ||
199 | phaseModel& phase = iter(); | ||
200 | volScalarField& alpha = phase; | ||
201 | alpha += alpha*sumCorr; | ||
202 | } | ||
203 | |||
218 | 204 | calcAlphas(); | calcAlphas(); |
219 | 205 | } | } |
220 | 206 | ||
... | ... | Foam::multiphaseDisperseSystem::nearInterface() const | |
864 | 850 | ||
865 | 851 | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter) | forAllConstIter(PtrDictionary<phaseModel>, phases_, iter) |
866 | 852 | { | { |
867 | tnearInt.ref() = max(tnearInt(), pos(iter() - 0.01)*pos(0.99 - iter())); | ||
853 | tnearInt.ref() = | ||
854 | max(tnearInt(), pos0(iter() - 0.01)*pos0(0.99 - iter())); | ||
868 | 855 | } | } |
869 | 856 | ||
870 | 857 | return tnearInt; | return tnearInt; |
... | ... | Foam::multiphaseDisperseSystem::nearInterface() const | |
873 | 860 | ||
874 | 861 | void Foam::multiphaseDisperseSystem::solve() | void Foam::multiphaseDisperseSystem::solve() |
875 | 862 | { | { |
876 | |||
877 | 863 | forAllIter(PtrDictionary<phaseModel>, phases_, iter) | forAllIter(PtrDictionary<phaseModel>, phases_, iter) |
878 | 864 | { | { |
879 | 865 | iter().correct(); | iter().correct(); |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/multiphaseDisperseSystem.H changed (mode: 100644) (index b0454ed..bd1f08b) | |||
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) 2011-2016 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/phaseModel/phaseModel.C changed (mode: 100644) (index a68a2e2..f460af3) | |||
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) 2011-2016 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::phaseModel::phaseModel | |
129 | 129 | IOobject::NO_WRITE | IOobject::NO_WRITE |
130 | 130 | ) | ) |
131 | 131 | ), | ), |
132 | switch_solvequadrature_(populationBalanceProperties.lookup("Switch_SolveQuadrature")) | ||
132 | switch_solvequadrature_(populationBalanceProperties.lookup("Switch_SolveQuadrature") | ||
133 | ) | ||
133 | 134 | ||
134 | 135 | { | { |
135 | 136 | const word phiName = IOobject::groupName("phi", name_); | const word phiName = IOobject::groupName("phi", name_); |
... | ... | Foam::phaseModel::phaseModel | |
142 | 143 | IOobject::NO_READ | IOobject::NO_READ |
143 | 144 | ); | ); |
144 | 145 | ||
145 | if (phiHeader.headerOk()) | ||
146 | if (phiHeader.typeHeaderOk<surfaceScalarField>(true)) | ||
146 | 147 | { | { |
147 | 148 | Info<< "Reading face flux field " << phiName << endl; | Info<< "Reading face flux field " << phiName << endl; |
148 | 149 | ||
... | ... | Foam::phaseModel::phaseModel | |
216 | 217 | ( | ( |
217 | 218 | IOobject::groupName("populationBalance", phaseName), | IOobject::groupName("populationBalance", phaseName), |
218 | 219 | populationBalanceProperties, | populationBalanceProperties, |
219 | U_, | ||
220 | //U_, | ||
220 | 221 | phi() //phi() or phiPtr_ ?? | phi() //phi() or phiPtr_ ?? |
221 | 222 | ); | ); |
222 | 223 | } | } |
... | ... | Foam::phaseModel::~phaseModel() | |
234 | 235 | Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const | Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::clone() const |
235 | 236 | { | { |
236 | 237 | NotImplemented; | NotImplemented; |
237 | return autoPtr<phaseModel>(NULL); | ||
238 | return autoPtr<phaseModel>(nullptr); | ||
238 | 239 | } | } |
239 | 240 | ||
240 | 241 | ||
... | ... | bool Foam::phaseModel::read(const dictionary& phaseDict) | |
269 | 270 | } | } |
270 | 271 | ||
271 | 272 | ||
273 | void Foam::phaseModel::correctInflowOutflow(surfaceScalarField& alphaPhi) const | ||
274 | { | ||
275 | surfaceScalarField::Boundary& alphaPhiBf = alphaPhi.boundaryFieldRef(); | ||
276 | const volScalarField::Boundary& alphaBf = boundaryField(); | ||
277 | const surfaceScalarField::Boundary& phiBf = phi().boundaryField(); | ||
278 | |||
279 | forAll(alphaPhiBf, patchi) | ||
280 | { | ||
281 | fvsPatchScalarField& alphaPhip = alphaPhiBf[patchi]; | ||
282 | |||
283 | if (!alphaPhip.coupled()) | ||
284 | { | ||
285 | alphaPhip = phiBf[patchi]*alphaBf[patchi]; | ||
286 | } | ||
287 | } | ||
288 | } | ||
289 | |||
290 | |||
272 | 291 | Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const | Foam::tmp<Foam::volScalarField> Foam::phaseModel::d() const |
273 | 292 | { | { |
274 | 293 | return dPtr_().d(); | return dPtr_().d(); |
File multiphaseEulerPbeFoam/multiphaseDisperseSystem/phaseModel/phaseModel.H changed (mode: 100644) (index abfc01c..4cc4bd9) | |||
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) 2011-2015 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
249 | 249 | return alphaPhi_; | return alphaPhi_; |
250 | 250 | } | } |
251 | 251 | ||
252 | //- Ensure that the flux at inflow/outflow BCs is preserved | ||
253 | void correctInflowOutflow(surfaceScalarField& alphaPhi) const; | ||
254 | |||
252 | 255 | //- Correct the phase properties | //- Correct the phase properties |
253 | 256 | void correct(); | void correct(); |
254 | 257 |
File multiphaseEulerPbeFoam/nDimensionalMappedPtrList/nDimensionalMappedPtrList.C renamed from multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedList.C (similarity 65%) (mode: 100644) (index 1b2db14..352c9b6) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "nDimensionalMappedList.H" | ||
26 | #include "nDimensionalMappedPtrList.H" | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // |
30 | 30 | ||
31 | 31 | template <class mappedType> | template <class mappedType> |
32 | 32 | Foam::word | Foam::word |
33 | Foam::nDimensionalMappedList<mappedType>::listToWord(const labelList& lst) | ||
33 | Foam::nDimensionalMappedPtrList<mappedType>::listToWord(const labelList& lst) | ||
34 | 34 | { | { |
35 | 35 | word w; | word w; |
36 | 36 | ||
... | ... | Foam::nDimensionalMappedList<mappedType>::listToWord(const labelList& lst) | |
44 | 44 | ||
45 | 45 | template <class mappedType> | template <class mappedType> |
46 | 46 | Foam::label | Foam::label |
47 | Foam::nDimensionalMappedList<mappedType>::listToLabel(const labelList& lst) | ||
47 | Foam::nDimensionalMappedPtrList<mappedType>::listToLabel(const labelList& lst) | ||
48 | 48 | { | { |
49 | 49 | label l = 0; | label l = 0; |
50 | 50 | ||
51 | 51 | forAll(lst, dimi) | forAll(lst, dimi) |
52 | 52 | { | { |
53 | l += lst[dimi]*Foam::pow(10, lst.size() - dimi - 1.0); | ||
53 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
54 | 54 | } | } |
55 | 55 | ||
56 | 56 | return l; | return l; |
... | ... | Foam::nDimensionalMappedList<mappedType>::listToLabel(const labelList& lst) | |
60 | 60 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
61 | 61 | ||
62 | 62 | template <class mappedType> | template <class mappedType> |
63 | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | ||
63 | Foam::nDimensionalMappedPtrList<mappedType>::nDimensionalMappedPtrList | ||
64 | 64 | ( | ( |
65 | const label nCmpt, | ||
66 | const label nDims, | ||
65 | const label nComponents, | ||
66 | const label nDimensions, | ||
67 | 67 | const Map<label>& map | const Map<label>& map |
68 | 68 | ) | ) |
69 | 69 | : | : |
70 | PtrList<mappedType>(nCmpt), | ||
71 | nDims_(nDims), | ||
70 | PtrList<mappedType>(nComponents), | ||
71 | nDimensions_(nDimensions), | ||
72 | 72 | map_(map) | map_(map) |
73 | 73 | {} | {} |
74 | 74 | ||
75 | 75 | template <class mappedType> | template <class mappedType> |
76 | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | ||
76 | Foam::nDimensionalMappedPtrList<mappedType>::nDimensionalMappedPtrList | ||
77 | 77 | ( | ( |
78 | const label nDims, | ||
78 | const label nDimensions, | ||
79 | 79 | const labelList& nNodes | const labelList& nNodes |
80 | 80 | ) | ) |
81 | 81 | : | : |
82 | PtrList<mappedType>(nDimensionalListLength(nDims, nNodes)), | ||
83 | nDims_(nDims), | ||
82 | PtrList<mappedType>(nDimensionalListLength(nDimensions, nNodes)), | ||
83 | nDimensions_(nDimensions), | ||
84 | 84 | map_(this->size()) | map_(this->size()) |
85 | 85 | { | { |
86 | labelList pos(nDims); | ||
86 | labelList pos(nDimensions); | ||
87 | 87 | label mi = 0; | label mi = 0; |
88 | 88 | setMappedPositions(nNodes, 0, mi, pos); | setMappedPositions(nNodes, 0, mi, pos); |
89 | 89 | } | } |
... | ... | Foam::nDimensionalMappedList<mappedType>::nDimensionalMappedList | |
92 | 92 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
93 | 93 | ||
94 | 94 | template <class mappedType> | template <class mappedType> |
95 | Foam::nDimensionalMappedList<mappedType>::~nDimensionalMappedList() | ||
95 | Foam::nDimensionalMappedPtrList<mappedType>::~nDimensionalMappedPtrList() | ||
96 | 96 | {} | {} |
97 | 97 | ||
98 | 98 | ||
99 | 99 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
100 | 100 | ||
101 | 101 | template <class mappedType> | template <class mappedType> |
102 | void Foam::nDimensionalMappedList<mappedType>::setMappedPositions | ||
102 | void Foam::nDimensionalMappedPtrList<mappedType>::setMappedPositions | ||
103 | 103 | ( | ( |
104 | 104 | const labelList& nNodes, | const labelList& nNodes, |
105 | 105 | label dimi, | label dimi, |
... | ... | void Foam::nDimensionalMappedList<mappedType>::setMappedPositions | |
107 | 107 | labelList& pos | labelList& pos |
108 | 108 | ) | ) |
109 | 109 | { | { |
110 | if (dimi < nDims_) | ||
110 | if (dimi < nDimensions_) | ||
111 | 111 | { | { |
112 | 112 | for (label i = 0; i < nNodes[dimi]; i++) | for (label i = 0; i < nNodes[dimi]; i++) |
113 | 113 | { | { |
114 | 114 | pos[dimi] = i; | pos[dimi] = i; |
115 | setMappedPositions(nNodes, dimi+1, mi, pos); | ||
115 | setMappedPositions(nNodes, dimi + 1, mi, pos); | ||
116 | 116 | } | } |
117 | 117 | } | } |
118 | 118 | else | else |
119 | 119 | { | { |
120 | map_.insert | ||
121 | ( | ||
122 | listToLabel | ||
123 | ( | ||
124 | pos | ||
125 | ), | ||
126 | mi | ||
127 | ); | ||
120 | map_.insert(listToLabel(pos), mi); | ||
128 | 121 | mi++; | mi++; |
129 | 122 | } | } |
130 | 123 | } | } |
131 | 124 | ||
132 | 125 | template <class mappedType> | template <class mappedType> |
133 | Foam::label Foam::nDimensionalMappedList<mappedType>::nDimensionalListLength | ||
126 | Foam::label Foam::nDimensionalMappedPtrList<mappedType>::nDimensionalListLength | ||
134 | 127 | ( | ( |
135 | const label nDims, | ||
128 | const label nDimensions, | ||
136 | 129 | const labelList nNodes | const labelList nNodes |
137 | 130 | ) | ) |
138 | 131 | { | { |
139 | label totalProduct = 1; | ||
140 | for(label nodei = 0; nodei < nDims; nodei++) | ||
132 | label product = 1; | ||
133 | |||
134 | for (label nodei = 0; nodei < nDimensions; nodei++) | ||
141 | 135 | { | { |
142 | totalProduct *= nNodes[nodei]; | ||
136 | product *= nNodes[nodei]; | ||
143 | 137 | } | } |
144 | return totalProduct; | ||
138 | |||
139 | return product; | ||
145 | 140 | } | } |
146 | 141 | ||
147 | 142 |
File multiphaseEulerPbeFoam/nDimensionalMappedPtrList/nDimensionalMappedPtrList.H renamed from multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedList.H (similarity 85%) (mode: 100644) (index 94192cf..d11c0a0) | |||
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-2017 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::nDimensionalMappedList | ||
25 | Foam::nDimensionalMappedPtrList | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Stores a list, with a Map<label> that takes a label key and | Stores a list, with a Map<label> that takes a label key and |
... | ... | Description | |
38 | 38 | 2 0 0 200 4 | 2 0 0 200 4 |
39 | 39 | 2 1 0 210 5 | 2 1 0 210 5 |
40 | 40 | ||
41 | operator() is overloaded in order to hide the above mapping. | ||
41 | The operator () is overloaded in order to hide the above mapping. | ||
42 | 42 | ||
43 | 43 | SourceFiles | SourceFiles |
44 | nDimensionalMappedListI.H | ||
45 | nDimensionalMappedList.C | ||
44 | nDimensionalMappedPtrListI.H | ||
45 | nDimensionalMappedPtrList.C | ||
46 | |||
47 | Note | ||
48 | Implementation provided by Jeffrey C. Heylmun | ||
46 | 49 | ||
47 | 50 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
48 | 51 | ||
... | ... | namespace Foam | |
60 | 63 | { | { |
61 | 64 | ||
62 | 65 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
63 | Class nDimensionalMappedList Declaration | ||
66 | Class nDimensionalMappedPtrList Declaration | ||
64 | 67 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
65 | 68 | ||
66 | 69 | template <class mappedType> | template <class mappedType> |
67 | class nDimensionalMappedList | ||
70 | class nDimensionalMappedPtrList | ||
68 | 71 | : | : |
69 | 72 | public PtrList<mappedType> | public PtrList<mappedType> |
70 | 73 | { | { |
71 | 74 | // Private data | // Private data |
72 | 75 | ||
73 | 76 | //- The number of dimensions for the mapped data set | //- The number of dimensions for the mapped data set |
74 | const label nDims_; | ||
77 | const label nDimensions_; | ||
75 | 78 | ||
76 | 79 | //- Map from the label representation of the moment name to its index | //- Map from the label representation of the moment name to its index |
77 | 80 | // within the List | // within the List |
... | ... | class nDimensionalMappedList | |
97 | 100 | //- Calculate the length of the PtrList given nNodes, and nDimensions | //- Calculate the length of the PtrList given nNodes, and nDimensions |
98 | 101 | label nDimensionalListLength | label nDimensionalListLength |
99 | 102 | ( | ( |
100 | const label nDims, | ||
103 | const label nDimensions, | ||
101 | 104 | const labelList nNodes | const labelList nNodes |
102 | 105 | ); | ); |
103 | 106 | ||
104 | 107 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
105 | nDimensionalMappedList(const nDimensionalMappedList&); | ||
108 | nDimensionalMappedPtrList(const nDimensionalMappedPtrList&); | ||
106 | 109 | ||
107 | 110 | //- Disallow default bitwise assignment | //- Disallow default bitwise assignment |
108 | void operator=(const nDimensionalMappedList&); | ||
111 | void operator=(const nDimensionalMappedPtrList&); | ||
109 | 112 | ||
110 | 113 | ||
111 | 114 | public: | public: |
... | ... | public: | |
114 | 117 | ||
115 | 118 | //- Construct from size, dimensions, and map | //- Construct from size, dimensions, and map |
116 | 119 | // The list is initialised | // The list is initialised |
117 | nDimensionalMappedList | ||
120 | nDimensionalMappedPtrList | ||
118 | 121 | ( | ( |
119 | const label nCmpt, | ||
122 | const label nComponents, | ||
120 | 123 | const label nDimensions, | const label nDimensions, |
121 | 124 | const Map<label>& momentMap | const Map<label>& momentMap |
122 | 125 | ); | ); |
123 | 126 | ||
124 | 127 | //- Construct mapped list using the number of nodes in each direction, | //- Construct mapped list using the number of nodes in each direction, |
125 | // nDims is not necessarily equal to nNodes.size() | ||
126 | nDimensionalMappedList | ||
128 | // nDimensions is not necessarily equal to nNodes.size() | ||
129 | nDimensionalMappedPtrList | ||
127 | 130 | ( | ( |
128 | const label nDims, | ||
131 | const label nDimensions, | ||
129 | 132 | const labelList& nNodes | const labelList& nNodes |
130 | 133 | ); | ); |
131 | 134 | ||
132 | 135 | //- Destructor | //- Destructor |
133 | ~nDimensionalMappedList(); | ||
136 | ~nDimensionalMappedPtrList(); | ||
134 | 137 | ||
135 | 138 | ||
136 | 139 | // Member Functions | // Member Functions |
137 | 140 | ||
138 | 141 | // Static member functions | // Static member functions |
142 | |||
139 | 143 | //- Convert a list of labels to a word. {1, 2, 3} -> 123 | //- Convert a list of labels to a word. {1, 2, 3} -> 123 |
140 | 144 | static word listToWord(const labelList& lst); | static word listToWord(const labelList& lst); |
141 | 145 | ||
... | ... | public: | |
197 | 201 | label d | label d |
198 | 202 | ); | ); |
199 | 203 | ||
200 | //- Const access to the fith dimension | ||
204 | //- Const access to the fifth dimension | ||
201 | 205 | inline const mappedType& operator() | inline const mappedType& operator() |
202 | 206 | ( | ( |
203 | 207 | label a, | label a, |
... | ... | public: | |
207 | 211 | label e | label e |
208 | 212 | ) const; | ) const; |
209 | 213 | ||
210 | //- Non-const access to the fith dimension | ||
214 | //- Non-const access to the fifth dimension | ||
211 | 215 | inline mappedType& operator() | inline mappedType& operator() |
212 | 216 | ( | ( |
213 | 217 | label a, | label a, |
... | ... | public: | |
227 | 231 | inline const Map<label>& map() const; | inline const Map<label>& map() const; |
228 | 232 | ||
229 | 233 | //- Return the number of dimensions of the data set | //- Return the number of dimensions of the data set |
230 | inline label nDims() const; | ||
234 | inline label nDimensions() const; | ||
231 | 235 | ||
232 | //- Return the map label of a lookup | ||
236 | //- Return the map label given the indeces | ||
233 | 237 | label map(label a, label b, label c, label d, label e) const | label map(label a, label b, label c, label d, label e) const |
234 | 238 | { | { |
235 | 239 | return map_ | return map_ |
... | ... | public: | |
252 | 256 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
253 | 257 | ||
254 | 258 | #ifdef NoRepository | #ifdef NoRepository |
255 | # include "nDimensionalMappedListI.H" | ||
256 | # include "nDimensionalMappedList.C" | ||
259 | # include "nDimensionalMappedPtrListI.H" | ||
260 | # include "nDimensionalMappedPtrList.C" | ||
257 | 261 | #endif | #endif |
258 | 262 | ||
259 | 263 |
File multiphaseEulerPbeFoam/nDimensionalMappedPtrList/nDimensionalMappedPtrListI.H renamed from multiphaseEulerPbeFoam/quadratureMethods/nDimensionalMappedList/nDimensionalMappedListI.H (similarity 72%) (mode: 100644) (index 516ff1f..172c729) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | |||
27 | |||
28 | 26 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
29 | 27 | ||
30 | 28 | template <class mappedType> | template <class mappedType> |
31 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator()() | ||
29 | mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator()() | ||
32 | 30 | { | { |
33 | 31 | return this->operator[](map_[0]); | return this->operator[](map_[0]); |
34 | 32 | } | } |
35 | 33 | ||
36 | 34 | template <class mappedType> | template <class mappedType> |
37 | 35 | const mappedType& | const mappedType& |
38 | Foam::nDimensionalMappedList<mappedType>::operator()() const | ||
36 | Foam::nDimensionalMappedPtrList<mappedType>::operator()() const | ||
39 | 37 | { | { |
40 | 38 | return this->operator[](map_[0]); | return this->operator[](map_[0]); |
41 | 39 | } | } |
42 | 40 | ||
43 | 41 | template <class mappedType> | template <class mappedType> |
44 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator()(label a) | ||
42 | mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator()(label a) | ||
45 | 43 | { | { |
46 | 44 | return this->operator[](map(0, 0, 0, 0, a)); | return this->operator[](map(0, 0, 0, 0, a)); |
47 | 45 | } | } |
48 | 46 | ||
49 | 47 | template <class mappedType> | template <class mappedType> |
50 | 48 | const mappedType& | const mappedType& |
51 | Foam::nDimensionalMappedList<mappedType>::operator()(label a) const | ||
49 | Foam::nDimensionalMappedPtrList<mappedType>::operator()(label a) const | ||
52 | 50 | { | { |
53 | 51 | return this->operator[](map(0, 0, 0, 0, a)); | return this->operator[](map(0, 0, 0, 0, a)); |
54 | 52 | } | } |
55 | 53 | ||
56 | 54 | template <class mappedType> | template <class mappedType> |
57 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
55 | mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
58 | 56 | ( | ( |
59 | 57 | label a, | label a, |
60 | 58 | label b | label b |
... | ... | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
64 | 62 | } | } |
65 | 63 | ||
66 | 64 | template <class mappedType> | template <class mappedType> |
67 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
65 | const mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
68 | 66 | ( | ( |
69 | 67 | label a, | label a, |
70 | 68 | label b | label b |
... | ... | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
74 | 72 | } | } |
75 | 73 | ||
76 | 74 | template <class mappedType> | template <class mappedType> |
77 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
75 | mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
78 | 76 | ( | ( |
79 | 77 | label a, | label a, |
80 | 78 | label b, | label b, |
... | ... | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
85 | 83 | } | } |
86 | 84 | ||
87 | 85 | template <class mappedType> | template <class mappedType> |
88 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
86 | const mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
89 | 87 | ( | ( |
90 | 88 | label a, | label a, |
91 | 89 | label b, | label b, |
... | ... | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
96 | 94 | } | } |
97 | 95 | ||
98 | 96 | template <class mappedType> | template <class mappedType> |
99 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
97 | mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
100 | 98 | ( | ( |
101 | 99 | label a, | label a, |
102 | 100 | label b, | label b, |
... | ... | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
108 | 106 | } | } |
109 | 107 | ||
110 | 108 | template <class mappedType> | template <class mappedType> |
111 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
109 | const mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
112 | 110 | ( | ( |
113 | 111 | label a, | label a, |
114 | 112 | label b, | label b, |
... | ... | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
120 | 118 | } | } |
121 | 119 | ||
122 | 120 | template <class mappedType> | template <class mappedType> |
123 | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
121 | mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
124 | 122 | ( | ( |
125 | 123 | label a, | label a, |
126 | 124 | label b, | label b, |
... | ... | mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
133 | 131 | } | } |
134 | 132 | ||
135 | 133 | template <class mappedType> | template <class mappedType> |
136 | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | ||
134 | const mappedType& Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
137 | 135 | ( | ( |
138 | 136 | label a, | label a, |
139 | 137 | label b, | label b, |
... | ... | const mappedType& Foam::nDimensionalMappedList<mappedType>::operator() | |
147 | 145 | ||
148 | 146 | template <class mappedType> | template <class mappedType> |
149 | 147 | const mappedType& | const mappedType& |
150 | Foam::nDimensionalMappedList<mappedType>::operator() | ||
148 | Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
151 | 149 | ( | ( |
152 | 150 | const Foam::labelList& l | const Foam::labelList& l |
153 | 151 | ) const | ) const |
... | ... | Foam::nDimensionalMappedList<mappedType>::operator() | |
157 | 155 | ||
158 | 156 | template <class mappedType> | template <class mappedType> |
159 | 157 | mappedType& | mappedType& |
160 | Foam::nDimensionalMappedList<mappedType>::operator() | ||
158 | Foam::nDimensionalMappedPtrList<mappedType>::operator() | ||
161 | 159 | ( | ( |
162 | 160 | const Foam::labelList& l | const Foam::labelList& l |
163 | 161 | ) | ) |
... | ... | Foam::nDimensionalMappedList<mappedType>::operator() | |
166 | 164 | } | } |
167 | 165 | ||
168 | 166 | template <class mappedType> const Foam::Map<Foam::label>& | template <class mappedType> const Foam::Map<Foam::label>& |
169 | Foam::nDimensionalMappedList<mappedType>::map() const | ||
167 | Foam::nDimensionalMappedPtrList<mappedType>::map() const | ||
170 | 168 | { | { |
171 | 169 | return map_; | return map_; |
172 | 170 | } | } |
173 | 171 | ||
174 | |||
175 | 172 | template <class mappedType> | template <class mappedType> |
176 | Foam::label Foam::nDimensionalMappedList<mappedType>::nDims() const | ||
173 | Foam::label Foam::nDimensionalMappedPtrList<mappedType>::nDimensions() const | ||
177 | 174 | { | { |
178 | return nDims_; | ||
175 | return nDimensions_; | ||
179 | 176 | } | } |
180 | 177 | ||
181 | 178 |
File multiphaseEulerPbeFoam/pEqn.H changed (mode: 100644) (index 5d506eb..b860668) | |||
82 | 82 | zeroGradientFvPatchScalarField::typeName | zeroGradientFvPatchScalarField::typeName |
83 | 83 | ); | ); |
84 | 84 | dragCoeffi.correctBoundaryConditions(); | dragCoeffi.correctBoundaryConditions(); |
85 | |||
86 | //- Correction factor to counter division by zero error | ||
87 | /*dimensionedScalar smallT | ||
88 | ( | ||
89 | "smallVelocity", | ||
90 | dimensionSet(0,0,-1,0,0), | ||
91 | SMALL | ||
92 | );*/ | ||
93 | //rAUs.set(phasei, (1.0/(UEqns[phasei].A() + dragCoeffi + smallT)).ptr()); | ||
85 | |||
94 | 86 | rAUs.set | rAUs.set |
95 | 87 | ( | ( |
96 | 88 | phasei, | phasei, |
144 | 136 | ++dmIter, ++dcIter | ++dmIter, ++dcIter |
145 | 137 | ) | ) |
146 | 138 | { | { |
147 | const phaseModel *phase2Ptr = NULL; | ||
139 | const phaseModel *phase2Ptr = nullptr; | ||
148 | 140 | ||
149 | 141 | if (&phase == &dmIter()->phase1()) | if (&phase == &dmIter()->phase1()) |
150 | 142 | { | { |
275 | 267 | // dgdt = | // dgdt = |
276 | 268 | ||
277 | 269 | // ( | // ( |
278 | // pos(alpha2)*(pEqnComp2 & p)/rho2 | ||
279 | // - pos(alpha1)*(pEqnComp1 & p)/rho1 | ||
270 | // pos0(alpha2)*(pEqnComp2 & p)/rho2 | ||
271 | // - pos0(alpha1)*(pEqnComp1 & p)/rho1 | ||
280 | 272 | // ); | // ); |
281 | 273 | ||
282 | 274 | p_rgh.relax(); | p_rgh.relax(); |
299 | 291 | ( | ( |
300 | 292 | rAlphaAUfs[phasei] | rAlphaAUfs[phasei] |
301 | 293 | *( | *( |
302 | fluid.surfaceTension(phase)*mesh.magSf() | ||
294 | fluid.surfaceTension(phase)*mesh.magSf() | ||
303 | 295 | + (phase.rho() - fvc::interpolate(rho)) | + (phase.rho() - fvc::interpolate(rho)) |
304 | 296 | *(g & mesh.Sf()) | *(g & mesh.Sf()) |
305 | 297 | - ghSnGradRho | - ghSnGradRho |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/Make/options changed (mode: 100644) (index 8256cab..9512cee) | |||
... | ... | EXE_INC = \ | |
9 | 9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
10 | 10 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
11 | 11 | -I../../eigenSolver/lnInclude \ | -I../../eigenSolver/lnInclude \ |
12 | -I../univariateMomentSet/lnInclude \ | ||
13 | -I../extentedMomentInversion/lnInclude \ | ||
12 | -I../../mappedList \ | ||
13 | -I../momentSets/lnInclude \ | ||
14 | 14 | -I../quadratureNode \ | -I../quadratureNode \ |
15 | 15 | -I../moments \ | -I../moments \ |
16 | -I../quadratureApproximation/lnInclude | ||
16 | -I../momentInversion/univariate/basic/lnInclude \ | ||
17 | -I../momentInversion/univariate/extended/lnInclude \ | ||
18 | -I../fieldMomentInversion/lnInclude \ | ||
19 | -I../quadratureApproximations/lnInclude \ | ||
20 | -I../momentAdvection/lnInclude | ||
17 | 21 | ||
18 | 22 | LIB_LIBS = \ | LIB_LIBS = \ |
19 | 23 | -lincompressibleTransportModels \ | -lincompressibleTransportModels \ |
... | ... | LIB_LIBS = \ | |
27 | 31 | -lmeshTools \ | -lmeshTools \ |
28 | 32 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
29 | 33 | -leigenSolver \ | -leigenSolver \ |
30 | -lmomentSet \ | ||
34 | -lmomentSets \ | ||
35 | -lmomentInversion \ | ||
31 | 36 | -lextendedMomentInversion \ | -lextendedMomentInversion \ |
32 | -lquadratureApproximation | ||
37 | -lfieldMomentInversion \ | ||
38 | -lquadratureApproximation \ | ||
39 | -lmomentAdvection | ||
40 |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/PDFTransportModel/PDFTransportModel.C changed (mode: 100644) (index 1336560..4800ae6) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModel::PDFTransportModel | |
44 | 44 | Foam::PDFTransportModel::~PDFTransportModel() | Foam::PDFTransportModel::~PDFTransportModel() |
45 | 45 | {} | {} |
46 | 46 | ||
47 | |||
48 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
49 | |||
50 | |||
51 | |||
52 | 47 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/PDFTransportModel/PDFTransportModel.H changed (mode: 100644) (index 4b88e1e..6e2cf06) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.C changed (mode: 100644) (index c9f071a..828a0ea) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::univariatePDFTransportModel | |
33 | 33 | const word& name, | const word& name, |
34 | 34 | const dictionary& dict, | const dictionary& dict, |
35 | 35 | const fvMesh& mesh, | const fvMesh& mesh, |
36 | const volVectorField& U, | ||
37 | 36 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
38 | 37 | const word& support | const word& support |
39 | 38 | ) | ) |
40 | 39 | : | : |
41 | 40 | PDFTransportModel(name, dict, mesh), | PDFTransportModel(name, dict, mesh), |
42 | 41 | name_(name), | name_(name), |
43 | quadrature_(name, mesh, support), | ||
44 | U_(U), | ||
45 | phi_(phi) | ||
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 | quadrature_(name, mesh, support, 1), | ||
53 | momentAdvection_ | ||
54 | ( | ||
55 | univariateMomentAdvection::New | ||
56 | ( | ||
57 | quadrature_.subDict("momentAdvection"), | ||
58 | quadrature_, | ||
59 | phi, | ||
60 | support | ||
61 | ) | ||
62 | ) | ||
46 | 63 | {} | {} |
47 | 64 | ||
48 | |||
49 | 65 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
50 | 66 | ||
51 | 67 | Foam::PDFTransportModels::univariatePDFTransportModel | Foam::PDFTransportModels::univariatePDFTransportModel |
52 | 68 | ::~univariatePDFTransportModel() | ::~univariatePDFTransportModel() |
53 | 69 | {} | {} |
54 | 70 | ||
55 | |||
56 | 71 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
57 | 72 | ||
58 | 73 | void Foam::PDFTransportModels::univariatePDFTransportModel | void Foam::PDFTransportModels::univariatePDFTransportModel |
59 | ::updatePhysicalSpaceConvection() | ||
74 | ::explicitMomentSource() | ||
60 | 75 | { | { |
61 | // Update interpolated nodes | ||
62 | quadrature_.interpolateNodes(); | ||
76 | volUnivariateMomentFieldSet& moments(quadrature_.moments()); | ||
77 | label nMoments = quadrature_.nMoments(); | ||
78 | scalar globalDt = moments[0].mesh().time().deltaT().value(); | ||
63 | 79 | ||
64 | // Updated reconstructed moments | ||
65 | quadrature_.momentsNei().update(); | ||
66 | quadrature_.momentsOwn().update(); | ||
67 | } | ||
80 | Info << "Solving source terms in realizable ODE solver." << endl; | ||
68 | 81 | ||
69 | Foam::tmp<Foam::volScalarField> | ||
70 | Foam::PDFTransportModels::univariatePDFTransportModel::physicalSpaceConvection | ||
71 | ( | ||
72 | const volUnivariateMoment& moment | ||
73 | ) | ||
74 | { | ||
75 | dimensionedScalar zeroPhi("zero", phi_.dimensions(), 0.0); | ||
82 | forAll(moments[0], celli) | ||
83 | { | ||
84 | // Storing old moments to recover from failed step | ||
76 | 85 | ||
77 | tmp<volScalarField> divMoment | ||
78 | ( | ||
79 | new volScalarField | ||
80 | ( | ||
81 | IOobject | ||
86 | scalarList oldMoments(nMoments, 0.0); | ||
87 | |||
88 | forAll(oldMoments, mi) | ||
89 | { | ||
90 | oldMoments[mi] = moments[mi][celli]; | ||
91 | } | ||
92 | |||
93 | //- Local time | ||
94 | scalar localT = 0.0; | ||
95 | |||
96 | // Initialize the local step | ||
97 | scalar localDt = globalDt/100.0; | ||
98 | |||
99 | // Initialize RK parameters | ||
100 | scalarList k1(nMoments, 0.0); | ||
101 | scalarList k2(nMoments, 0.0); | ||
102 | scalarList k3(nMoments, 0.0); | ||
103 | |||
104 | // Flag to indicate if the time step is complete | ||
105 | bool timeComplete = false; | ||
106 | |||
107 | // Check realizability of intermediate moment sets | ||
108 | bool realizableUpdate1 = false; | ||
109 | bool realizableUpdate2 = false; | ||
110 | bool realizableUpdate3 = false; | ||
111 | |||
112 | scalarList momentsSecondStep(nMoments, 0.0); | ||
113 | |||
114 | while (!timeComplete) | ||
115 | { | ||
116 | do | ||
117 | { | ||
118 | // First intermediate update | ||
119 | forAll(oldMoments, mi) | ||
120 | { | ||
121 | k1[mi] = localDt*cellMomentSource(mi, celli); | ||
122 | moments[mi][celli] = oldMoments[mi] + k1[mi]; | ||
123 | } | ||
124 | |||
125 | realizableUpdate1 = | ||
126 | quadrature_.updateLocalQuadrature(celli, false); | ||
127 | |||
128 | quadrature_.updateLocalMoments(celli); | ||
129 | |||
130 | // Second moment update | ||
131 | forAll(oldMoments, mi) | ||
132 | { | ||
133 | k2[mi] = localDt*cellMomentSource(mi, celli); | ||
134 | moments[mi][celli] = oldMoments[mi] + (k1[mi] + k2[mi])/4.0; | ||
135 | |||
136 | momentsSecondStep[mi] = moments[mi][celli]; | ||
137 | } | ||
138 | |||
139 | realizableUpdate2 = | ||
140 | quadrature_.updateLocalQuadrature(celli, false); | ||
141 | |||
142 | quadrature_.updateLocalMoments(celli); | ||
143 | |||
144 | // Third moment update | ||
145 | forAll(oldMoments, mi) | ||
146 | { | ||
147 | k3[mi] = localDt*cellMomentSource(mi, celli); | ||
148 | moments[mi][celli] = | ||
149 | oldMoments[mi] + (k1[mi] + k2[mi] + 4.0*k3[mi])/6.0; | ||
150 | } | ||
151 | |||
152 | realizableUpdate3 = | ||
153 | quadrature_.updateLocalQuadrature(celli, false); | ||
154 | |||
155 | quadrature_.updateLocalMoments(celli); | ||
156 | |||
157 | if | ||
158 | ( | ||
159 | !realizableUpdate1 | ||
160 | || !realizableUpdate2 | ||
161 | || !realizableUpdate3 | ||
162 | ) | ||
163 | { | ||
164 | Info << "Not realizable" << endl; | ||
165 | |||
166 | forAll(oldMoments, mi) | ||
167 | { | ||
168 | moments[mi][celli] = oldMoments[mi]; | ||
169 | } | ||
170 | |||
171 | localDt /= 2.0; | ||
172 | |||
173 | if (localDt < minLocalDt_) | ||
174 | { | ||
175 | FatalErrorInFunction | ||
176 | << "Reached minimum local step in realizable ODE" | ||
177 | << nl | ||
178 | << " solver. Cannot ensure realizability." << nl | ||
179 | << abort(FatalError); | ||
180 | } | ||
181 | } | ||
182 | } | ||
183 | while | ||
82 | 184 | ( | ( |
83 | "divMoment", | ||
84 | mesh_.time().timeName(), | ||
85 | mesh_, | ||
86 | IOobject::NO_READ, | ||
87 | IOobject::NO_WRITE, | ||
88 | false | ||
89 | ), | ||
90 | mesh_, | ||
91 | dimensionedScalar("zero", dimless, 0.0) | ||
92 | ) | ||
93 | ); | ||
185 | !realizableUpdate1 | ||
186 | || !realizableUpdate2 | ||
187 | || !realizableUpdate3 | ||
188 | ); | ||
94 | 189 | ||
95 | label order = moment.order(); | ||
190 | scalar error = 0.0; | ||
96 | 191 | ||
97 | surfaceScalarField mFlux | ||
98 | ( | ||
99 | quadrature_.momentsNei()[order]*min(phi_, zeroPhi) | ||
100 | + quadrature_.momentsOwn()[order]*max(phi_, zeroPhi) | ||
101 | ); | ||
192 | for (label mi = 0; mi < nMoments; mi++) | ||
193 | { | ||
194 | scalar scalei = | ||
195 | ATol_ | ||
196 | + max | ||
197 | ( | ||
198 | mag(momentsSecondStep[mi]), mag(oldMoments[mi]) | ||
199 | )*RTol_; | ||
102 | 200 | ||
103 | fvc::surfaceIntegrate(divMoment.ref(), mFlux); | ||
104 | divMoment.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
201 | error += | ||
202 | sqr | ||
203 | ( | ||
204 | (momentsSecondStep[mi] - moments[mi][celli])/scalei | ||
205 | ); | ||
206 | } | ||
105 | 207 | ||
106 | return divMoment; | ||
107 | } | ||
208 | error = sqrt(error/nMoments); | ||
209 | |||
210 | if (error < 1) | ||
211 | { | ||
212 | localDt *= min(facMax_, max(facMin_, fac_/pow(error, 1.0/3.0))); | ||
213 | |||
214 | scalar maxLocalDt = max(globalDt - localT, 0.0); | ||
215 | localDt = min(maxLocalDt, localDt); | ||
108 | 216 | ||
217 | forAll(oldMoments, mi) | ||
218 | { | ||
219 | oldMoments[mi] = moments[mi][celli]; | ||
220 | } | ||
109 | 221 | ||
222 | if (localDt == 0.0) | ||
223 | { | ||
224 | timeComplete = true; | ||
225 | localT = 0.0; | ||
226 | break; | ||
227 | } | ||
228 | |||
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 | } | ||
110 | 243 | ||
111 | 244 | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() |
112 | 245 | { | { |
113 | updatePhysicalSpaceConvection(); | ||
246 | momentAdvection_().update(); | ||
114 | 247 | ||
115 | 248 | // List of moment transport equations | // List of moment transport equations |
116 | 249 | PtrList<fvScalarMatrix> momentEqns(quadrature_.nMoments()); | PtrList<fvScalarMatrix> momentEqns(quadrature_.nMoments()); |
... | ... | void Foam::PDFTransportModels::univariatePDFTransportModel::solve() | |
126 | 259 | new fvScalarMatrix | new fvScalarMatrix |
127 | 260 | ( | ( |
128 | 261 | fvm::ddt(m) | fvm::ddt(m) |
129 | + physicalSpaceConvection(m) | ||
262 | + momentAdvection_().divMoments()[momenti] | ||
130 | 263 | - momentDiffusion(m) | - momentDiffusion(m) |
131 | 264 | == | == |
132 | momentSource(m) | ||
133 | + phaseSpaceConvection(m) | ||
265 | implicitMomentSource(m) | ||
134 | 266 | ) | ) |
135 | 267 | ); | ); |
136 | 268 | } | } |
137 | 269 | ||
138 | forAll (momentEqns, mEqnI) | ||
270 | if (solveODESource_) | ||
271 | { | ||
272 | explicitMomentSource(); | ||
273 | } | ||
274 | |||
275 | forAll (momentEqns, mEqni) | ||
139 | 276 | { | { |
140 | momentEqns[mEqnI].relax(); | ||
141 | momentEqns[mEqnI].solve(); | ||
277 | volUnivariateMoment& m = quadrature_.moments()[mEqni]; | ||
278 | |||
279 | if (solveODESource_) | ||
280 | { | ||
281 | momentEqns[mEqni] -= fvc::ddt(m); | ||
282 | } | ||
283 | |||
284 | momentEqns[mEqni].relax(); | ||
285 | momentEqns[mEqni].solve(); | ||
142 | 286 | } | } |
143 | 287 | ||
144 | 288 | quadrature_.updateQuadrature(); | quadrature_.updateQuadrature(); |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModel.H changed (mode: 100644) (index bca675d..d524dd0) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
37 | 37 | #define univariatePDFTransportModel_H | #define univariatePDFTransportModel_H |
38 | 38 | ||
39 | 39 | #include "PDFTransportModel.H" | #include "PDFTransportModel.H" |
40 | #include "univariateQuadratureApproximation.H" | ||
40 | #include "quadratureApproximations.H" | ||
41 | #include "univariateMomentAdvection.H" | ||
41 | 42 | ||
42 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
43 | 44 | ||
... | ... | class univariatePDFTransportModel | |
59 | 60 | //- Name of the univariatePDFTransportModel | //- Name of the univariatePDFTransportModel |
60 | 61 | const word name_; | const word name_; |
61 | 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 | label minLocalDt_; | ||
82 | |||
83 | |||
62 | 84 | protected: | protected: |
63 | 85 | ||
64 | 86 | // Protected data | // Protected data |
... | ... | protected: | |
66 | 88 | //- Univariate quadrature approximation used to solve PDF transport | //- Univariate quadrature approximation used to solve PDF transport |
67 | 89 | univariateQuadratureApproximation quadrature_; | univariateQuadratureApproximation quadrature_; |
68 | 90 | ||
69 | //- Velocity field | ||
70 | const volVectorField& U_; | ||
71 | |||
72 | //- Face velocity field | ||
73 | const surfaceScalarField& phi_; | ||
91 | //- Moment advection | ||
92 | autoPtr<univariateMomentAdvection> momentAdvection_; | ||
74 | 93 | ||
75 | 94 | // Protected member functions | // Protected member functions |
76 | 95 | ||
... | ... | protected: | |
80 | 99 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
81 | 100 | ) = 0; | ) = 0; |
82 | 101 | ||
83 | //- Calculate source terms | ||
84 | virtual tmp<fvScalarMatrix> momentSource | ||
102 | //- Calculate implicit source terms | ||
103 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
85 | 104 | ( | ( |
86 | 105 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
87 | 106 | ) = 0; | ) = 0; |
88 | 107 | ||
89 | //- Convect moments in phase space | ||
90 | virtual tmp<volScalarField> phaseSpaceConvection | ||
91 | ( | ||
92 | const volUnivariateMoment& moment | ||
93 | ) = 0; | ||
108 | //- Calculate explicit source terms with realizable ODE solver | ||
109 | virtual void explicitMomentSource(); | ||
94 | 110 | ||
95 | //- Calculate explicit convection term in physical space | ||
96 | tmp<volScalarField> physicalSpaceConvection | ||
111 | //- Calculate source term for moment equation in the specified cell | ||
112 | virtual scalar cellMomentSource | ||
97 | 113 | ( | ( |
98 | const volUnivariateMoment& moment | ||
99 | ); | ||
100 | |||
101 | //- Update fields required to compute kinetic fluxes | ||
102 | void updatePhysicalSpaceConvection(); | ||
114 | label& momentOrder, | ||
115 | label& celli | ||
116 | ) = 0; | ||
103 | 117 | ||
104 | 118 | ||
105 | 119 | public: | public: |
... | ... | public: | |
112 | 126 | const word& name, | const word& name, |
113 | 127 | const dictionary& dict, | const dictionary& dict, |
114 | 128 | const fvMesh& mesh, | const fvMesh& mesh, |
115 | const volVectorField& U, | ||
116 | 129 | const surfaceScalarField& phi, | const surfaceScalarField& phi, |
117 | 130 | const word& support | const word& support |
118 | 131 | ); | ); |
... | ... | public: | |
129 | 142 | //- Returns a const reference to the quadrature approximation | //- Returns a const reference to the quadrature approximation |
130 | 143 | inline const univariateQuadratureApproximation& quadrature() const; | inline const univariateQuadratureApproximation& quadrature() const; |
131 | 144 | ||
145 | //- Return the maximum Courant number ensuring moment realizability | ||
146 | inline scalar realizableCo(); | ||
147 | |||
132 | 148 | //-Edit | //-Edit |
133 | 149 | ||
134 | 150 | //- Solve univariate PDF transport equation | //- Solve univariate PDF transport equation |
File multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H changed (mode: 100755) (index ddb0a21..0f82269) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | |
31 | 31 | return quadrature_; | return quadrature_; |
32 | 32 | } | } |
33 | 33 | ||
34 | Foam::scalar | ||
35 | Foam::PDFTransportModels::univariatePDFTransportModel::realizableCo() | ||
36 | { | ||
37 | return momentAdvection_().realizableCo(); | ||
38 | } | ||
34 | 39 | ||
35 | 40 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/Make/files added (mode: 100644) (index 0000000..73926c9) | |||
1 | fieldMomentInversion/fieldMomentInversion.C | ||
2 | fieldMomentInversion/newFieldMomentInversion.C | ||
3 | basicFieldMomentInversion/basicFieldMomentInversion.C | ||
4 | extendedFieldMomentInversion/extendedFieldMomentInversion.C | ||
5 | |||
6 | LIB = $(FOAM_USER_LIBBIN)/libfieldMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/Make/options renamed from multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/Make/options (similarity 50%) (mode: 100644) (index de2f4fa..7890d06) | |||
1 | 1 | EXE_INC = \ | EXE_INC = \ |
2 | 2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
3 | 3 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
4 | -I../univariateMomentSet/lnInclude \ | ||
5 | -I../extentedMomentInversion/lnInclude \ | ||
4 | -I../../mappedList \ | ||
6 | 5 | -I../quadratureNode \ | -I../quadratureNode \ |
7 | -I../moments | ||
6 | -I../moments \ | ||
7 | -I../momentSets/lnInclude \ | ||
8 | -I../momentInversion/univariate/basic/lnInclude \ | ||
9 | -I../momentInversion/univariate/extended/lnInclude | ||
8 | 10 | ||
9 | 11 | LIB_LIBS = \ | LIB_LIBS = \ |
10 | 12 | -lfiniteVolume \ | -lfiniteVolume \ |
11 | 13 | -lmeshTools \ | -lmeshTools \ |
12 | 14 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
13 | -lmomentSet \ | ||
15 | -lmomentSets \ | ||
16 | -lmomentInversion \ | ||
14 | 17 | -lextendedMomentInversion | -lextendedMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/basicFieldMomentInversion/basicFieldMomentInversion.C added (mode: 100755) (index 0000000..ff61c86) | |||
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 part of OpenFOAM. | ||
10 | |||
11 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
12 | under the terms of the GNU General Public License as published by | ||
13 | the Free Software Foundation, either version 3 of the License, or | ||
14 | (at your option) any later version. | ||
15 | |||
16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
19 | for more details. | ||
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | \*---------------------------------------------------------------------------*/ | ||
25 | |||
26 | #include "basicFieldMomentInversion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | defineTypeNameAndDebug(basicFieldMomentInversion, 0); | ||
34 | |||
35 | addToRunTimeSelectionTable | ||
36 | ( | ||
37 | fieldMomentInversion, | ||
38 | basicFieldMomentInversion, | ||
39 | dictionary | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
44 | |||
45 | Foam::basicFieldMomentInversion::basicFieldMomentInversion | ||
46 | ( | ||
47 | const dictionary& dict, | ||
48 | const label nMoments, | ||
49 | const label nSecondaryNodes | ||
50 | ) | ||
51 | : | ||
52 | fieldMomentInversion(dict, nMoments, nSecondaryNodes), | ||
53 | minKnownAbscissa_(dict.lookupOrDefault("minKnownAbscissa", 0)), | ||
54 | maxKnownAbscissa_(dict.lookupOrDefault("maxKnownAbscissa", 1)), | ||
55 | nFixedQuadraturePoints_(0), | ||
56 | momentInverter_ | ||
57 | ( | ||
58 | univariateMomentInversion::New(dict.subDict("basicMomentInversion")) | ||
59 | ) | ||
60 | { | ||
61 | static word inversionType = momentInverter_().type(); | ||
62 | |||
63 | if (inversionType == "GaussRadau") | ||
64 | { | ||
65 | nFixedQuadraturePoints_ = 1; | ||
66 | } | ||
67 | else if (inversionType == "GaussLobatto") | ||
68 | { | ||
69 | nFixedQuadraturePoints_ = 2; | ||
70 | } | ||
71 | } | ||
72 | |||
73 | |||
74 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
75 | |||
76 | Foam::basicFieldMomentInversion::~basicFieldMomentInversion() | ||
77 | {} | ||
78 | |||
79 | |||
80 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
81 | |||
82 | void Foam::basicFieldMomentInversion::invert | ||
83 | ( | ||
84 | const volUnivariateMomentFieldSet& moments, | ||
85 | PtrList<volScalarNode>& nodes | ||
86 | ) | ||
87 | { | ||
88 | const volUnivariateMoment& m0(moments[0]); | ||
89 | |||
90 | forAll(m0, celli) | ||
91 | { | ||
92 | invertLocalMoments(moments, nodes, celli); | ||
93 | } | ||
94 | |||
95 | invertBoundaryMoments(moments, nodes); | ||
96 | } | ||
97 | |||
98 | void Foam::basicFieldMomentInversion::invertBoundaryMoments | ||
99 | ( | ||
100 | const volUnivariateMomentFieldSet& moments, | ||
101 | PtrList<volScalarNode>& nodes | ||
102 | ) | ||
103 | { | ||
104 | // Recover reference to boundaryField of zero-order moment. | ||
105 | const volScalarField::Boundary& bf = moments().boundaryField(); | ||
106 | |||
107 | forAll(bf, patchi) | ||
108 | { | ||
109 | const fvPatchScalarField& m0Patch = bf[patchi]; | ||
110 | |||
111 | forAll(m0Patch, facei) | ||
112 | { | ||
113 | univariateMomentSet momentsToInvert | ||
114 | ( | ||
115 | moments.size(), | ||
116 | moments.support(), | ||
117 | 0.0, // Initial value | ||
118 | nFixedQuadraturePoints_ | ||
119 | ); | ||
120 | |||
121 | // Copying moments from a face | ||
122 | forAll(momentsToInvert, momenti) | ||
123 | { | ||
124 | momentsToInvert[momenti] | ||
125 | = moments[momenti].boundaryField()[patchi][facei]; | ||
126 | } | ||
127 | |||
128 | // Find quadrature | ||
129 | momentInverter_().invert | ||
130 | ( | ||
131 | momentsToInvert, | ||
132 | minKnownAbscissa_, | ||
133 | maxKnownAbscissa_ | ||
134 | ); | ||
135 | |||
136 | label maxNodes = nodes.size(); | ||
137 | label actualNodes = momentInverter_().nNodes(); | ||
138 | |||
139 | // Copy quadrature data to boundary face | ||
140 | for (label nodei = 0; nodei < maxNodes; nodei++) | ||
141 | { | ||
142 | volScalarNode& node = nodes[nodei]; | ||
143 | |||
144 | volScalarField::Boundary& weightBf | ||
145 | = node.primaryWeight().boundaryFieldRef(); | ||
146 | |||
147 | volScalarField::Boundary& abscissaBf | ||
148 | = node.primaryAbscissa().boundaryFieldRef(); | ||
149 | |||
150 | if (nodei < actualNodes) | ||
151 | { | ||
152 | weightBf[patchi][facei] | ||
153 | = momentInverter_().weights()[nodei]; | ||
154 | |||
155 | abscissaBf[patchi][facei] | ||
156 | = momentInverter_().abscissae()[nodei]; | ||
157 | } | ||
158 | else | ||
159 | { | ||
160 | weightBf[patchi][facei] = 0.0; | ||
161 | abscissaBf[patchi][facei] = 0.0; | ||
162 | } | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | } | ||
167 | |||
168 | bool Foam::basicFieldMomentInversion::invertLocalMoments | ||
169 | ( | ||
170 | const volUnivariateMomentFieldSet& moments, | ||
171 | PtrList<volScalarNode>& nodes, | ||
172 | const label celli, | ||
173 | const bool fatalErrorOnFailedRealizabilityTest | ||
174 | ) | ||
175 | { | ||
176 | univariateMomentSet momentsToInvert | ||
177 | ( | ||
178 | moments.size(), | ||
179 | moments.support(), | ||
180 | 0.0, // Initial value | ||
181 | nFixedQuadraturePoints_ | ||
182 | ); | ||
183 | |||
184 | // Copying moments from cell | ||
185 | forAll(momentsToInvert, momenti) | ||
186 | { | ||
187 | momentsToInvert[momenti] = moments[momenti][celli]; | ||
188 | } | ||
189 | |||
190 | if (!fatalErrorOnFailedRealizabilityTest) | ||
191 | { | ||
192 | if (!momentsToInvert.isRealizable(fatalErrorOnFailedRealizabilityTest)) | ||
193 | { | ||
194 | return false; | ||
195 | } | ||
196 | } | ||
197 | |||
198 | // Find quadrature | ||
199 | momentInverter_().invert | ||
200 | ( | ||
201 | momentsToInvert, | ||
202 | minKnownAbscissa_, | ||
203 | maxKnownAbscissa_ | ||
204 | ); | ||
205 | |||
206 | label maxNodes = nodes.size(); | ||
207 | label actualNodes = momentInverter_().nNodes(); | ||
208 | |||
209 | // Recovering quadrature | ||
210 | const scalarList& weights(momentInverter_().weights()); | ||
211 | const scalarList& abscissae(momentInverter_().abscissae()); | ||
212 | |||
213 | for (label nodei = 0; nodei < maxNodes; nodei++) | ||
214 | { | ||
215 | volScalarNode& node(nodes[nodei]); | ||
216 | |||
217 | if (nodei < actualNodes) | ||
218 | { | ||
219 | node.primaryWeight()[celli] = weights[nodei]; | ||
220 | node.primaryAbscissa()[celli] = abscissae[nodei]; | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | node.primaryWeight()[celli] = 0.0; | ||
225 | node.primaryAbscissa()[celli] = 0.0; | ||
226 | } | ||
227 | } | ||
228 | |||
229 | return true; | ||
230 | } | ||
231 | |||
232 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/basicFieldMomentInversion/basicFieldMomentInversion.H added (mode: 100755) (index 0000000..e328acc) | |||
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 part of OpenFOAM. | ||
10 | |||
11 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
12 | under the terms of the GNU General Public License as published by | ||
13 | the Free Software Foundation, either version 3 of the License, or | ||
14 | (at your option) any later version. | ||
15 | |||
16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
19 | for more details. | ||
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | Class | ||
25 | Foam::basicFieldMomentInversion | ||
26 | |||
27 | Description | ||
28 | Invert moment a volUnivariateMomentFieldSet using basic quadrature | ||
29 | inversion. | ||
30 | |||
31 | SourceFiles | ||
32 | basicFieldMomentInversion.C | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef basicFieldMomentInversion_H | ||
37 | #define basicFieldMomentInversion_H | ||
38 | |||
39 | #include "fieldMomentInversion.H" | ||
40 | #include "univariateMomentSet.H" | ||
41 | #include "univariateMomentInversion.H" | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
44 | |||
45 | namespace Foam | ||
46 | { | ||
47 | |||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class basicFieldMomentInversion Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class basicFieldMomentInversion | ||
53 | : | ||
54 | public fieldMomentInversion | ||
55 | { | ||
56 | // Private data | ||
57 | |||
58 | //- Minimum value of the abscissa for fixed-point quadrature | ||
59 | scalar minKnownAbscissa_; | ||
60 | |||
61 | //- Maximum value of the abscissa for fixed-point quadrature | ||
62 | scalar maxKnownAbscissa_; | ||
63 | |||
64 | //- Number of fixed quadrature points | ||
65 | label nFixedQuadraturePoints_; | ||
66 | |||
67 | |||
68 | // Private Member Functions | ||
69 | |||
70 | //- Moment inverter | ||
71 | autoPtr<univariateMomentInversion> momentInverter_; | ||
72 | |||
73 | //- Disallow default bitwise copy construct | ||
74 | basicFieldMomentInversion(const basicFieldMomentInversion&); | ||
75 | |||
76 | //- Disallow default bitwise assignment | ||
77 | void operator=(const basicFieldMomentInversion&); | ||
78 | |||
79 | |||
80 | public: | ||
81 | |||
82 | //- Runtime type information | ||
83 | TypeName("basicFieldMomentInversion"); | ||
84 | |||
85 | |||
86 | // Constructors | ||
87 | |||
88 | //- Construct from dictionary | ||
89 | basicFieldMomentInversion | ||
90 | ( | ||
91 | const dictionary& dict, | ||
92 | const label nMoments, | ||
93 | const label nSecondaryNodes | ||
94 | ); | ||
95 | |||
96 | |||
97 | //- Destructor | ||
98 | ~basicFieldMomentInversion(); | ||
99 | |||
100 | |||
101 | // Public member Functions | ||
102 | |||
103 | //- Invert moments in the entire computational domain | ||
104 | virtual void invert | ||
105 | ( | ||
106 | const volUnivariateMomentFieldSet& moments, | ||
107 | PtrList<volScalarNode>& nodes | ||
108 | ); | ||
109 | |||
110 | //- Invert moments on boundaries | ||
111 | virtual void invertBoundaryMoments | ||
112 | ( | ||
113 | const volUnivariateMomentFieldSet& moments, | ||
114 | PtrList<volScalarNode>& nodes | ||
115 | ); | ||
116 | |||
117 | //- Invert moments in a single cell | ||
118 | virtual bool invertLocalMoments | ||
119 | ( | ||
120 | const volUnivariateMomentFieldSet& moments, | ||
121 | PtrList<volScalarNode>& nodes, | ||
122 | const label celli, | ||
123 | const bool fatalErrorOnFailedRealizabilityTest = true | ||
124 | ); | ||
125 | }; | ||
126 | |||
127 | |||
128 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
129 | |||
130 | } // End namespace Foam | ||
131 | |||
132 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
133 | |||
134 | #endif | ||
135 | |||
136 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/extendedFieldMomentInversion/extendedFieldMomentInversion.C added (mode: 100755) (index 0000000..c9355b3) | |||
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 part of OpenFOAM. | ||
10 | |||
11 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
12 | under the terms of the GNU General Public License as published by | ||
13 | the Free Software Foundation, either version 3 of the License, or | ||
14 | (at your option) any later version. | ||
15 | |||
16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
19 | for more details. | ||
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | \*---------------------------------------------------------------------------*/ | ||
25 | |||
26 | #include "extendedFieldMomentInversion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | defineTypeNameAndDebug(extendedFieldMomentInversion, 0); | ||
34 | |||
35 | addToRunTimeSelectionTable | ||
36 | ( | ||
37 | fieldMomentInversion, | ||
38 | extendedFieldMomentInversion, | ||
39 | dictionary | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
44 | |||
45 | Foam::extendedFieldMomentInversion::extendedFieldMomentInversion | ||
46 | ( | ||
47 | const dictionary& dict, | ||
48 | const label nMoments, | ||
49 | const label nSecondaryNodes | ||
50 | ) | ||
51 | : | ||
52 | fieldMomentInversion(dict, nMoments, nSecondaryNodes), | ||
53 | momentInverter_ | ||
54 | ( | ||
55 | extendedMomentInversion::New | ||
56 | ( | ||
57 | dict.subDict("extendedMomentInversion"), | ||
58 | nMoments, | ||
59 | nSecondaryNodes | ||
60 | ) | ||
61 | ) | ||
62 | { | ||
63 | extended_ = true; | ||
64 | } | ||
65 | |||
66 | |||
67 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
68 | |||
69 | Foam::extendedFieldMomentInversion::~extendedFieldMomentInversion() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
74 | |||
75 | void Foam::extendedFieldMomentInversion::invert | ||
76 | ( | ||
77 | const volUnivariateMomentFieldSet& moments, | ||
78 | PtrList<volScalarNode>& nodes | ||
79 | ) | ||
80 | { | ||
81 | const volScalarField& m0(moments[0]); | ||
82 | |||
83 | forAll(m0, celli) | ||
84 | { | ||
85 | invertLocalMoments(moments, nodes, celli); | ||
86 | } | ||
87 | |||
88 | invertBoundaryMoments(moments, nodes); | ||
89 | } | ||
90 | |||
91 | void Foam::extendedFieldMomentInversion::invertBoundaryMoments | ||
92 | ( | ||
93 | const volUnivariateMomentFieldSet& moments, | ||
94 | PtrList<volScalarNode>& nodes | ||
95 | ) | ||
96 | { | ||
97 | // Recover reference to boundaryField of zero-order moment. | ||
98 | // All moments will share the same BC types at a given boundary. | ||
99 | const volScalarField::Boundary& bf = moments().boundaryField(); | ||
100 | |||
101 | forAll(bf, patchi) | ||
102 | { | ||
103 | const fvPatchScalarField& m0Patch = bf[patchi]; | ||
104 | |||
105 | forAll(m0Patch, facei) | ||
106 | { | ||
107 | univariateMomentSet momentsToInvert | ||
108 | ( | ||
109 | moments.size(), | ||
110 | moments.support() | ||
111 | ); | ||
112 | |||
113 | // Copying moments from a face | ||
114 | forAll(momentsToInvert, momenti) | ||
115 | { | ||
116 | momentsToInvert[momenti] | ||
117 | = moments[momenti].boundaryField()[patchi][facei]; | ||
118 | } | ||
119 | |||
120 | // Inverting moments for EQMOM | ||
121 | momentInverter_->invert(momentsToInvert); | ||
122 | |||
123 | // Copying quadrature data to boundary face | ||
124 | for (label pNodei = 0; pNodei < nodes.size(); pNodei++) | ||
125 | { | ||
126 | volScalarNode& node = nodes[pNodei]; | ||
127 | |||
128 | node.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
129 | = momentInverter_->primaryWeights()[pNodei]; | ||
130 | |||
131 | node.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
132 | = momentInverter_->primaryAbscissae()[pNodei]; | ||
133 | |||
134 | node.sigma().boundaryFieldRef()[patchi][facei] | ||
135 | = momentInverter_->sigma(); | ||
136 | |||
137 | for | ||
138 | ( | ||
139 | label sNodei = 0; | ||
140 | sNodei < node.nSecondaryNodes(); | ||
141 | sNodei++ | ||
142 | ) | ||
143 | { | ||
144 | node.secondaryWeights()[sNodei].boundaryFieldRef()[patchi][facei] | ||
145 | = momentInverter_().secondaryWeights()[pNodei][sNodei]; | ||
146 | |||
147 | node.secondaryAbscissae()[sNodei].boundaryFieldRef()[patchi][facei] | ||
148 | = momentInverter_().secondaryAbscissae()[pNodei][sNodei]; | ||
149 | } | ||
150 | } | ||
151 | } | ||
152 | } | ||
153 | } | ||
154 | |||
155 | bool Foam::extendedFieldMomentInversion::invertLocalMoments | ||
156 | ( | ||
157 | const volUnivariateMomentFieldSet& moments, | ||
158 | PtrList<volScalarNode>& nodes, | ||
159 | const label celli, | ||
160 | const bool fatalErrorOnFailedRealizabilityTest | ||
161 | ) | ||
162 | { | ||
163 | univariateMomentSet momentsToInvert | ||
164 | ( | ||
165 | moments.size(), | ||
166 | moments.support() | ||
167 | ); | ||
168 | |||
169 | // Copying moment set from a cell to univariateMomentSet | ||
170 | forAll(momentsToInvert, momenti) | ||
171 | { | ||
172 | momentsToInvert[momenti] = moments[momenti][celli]; | ||
173 | } | ||
174 | |||
175 | if (!fatalErrorOnFailedRealizabilityTest) | ||
176 | { | ||
177 | if (!momentsToInvert.isRealizable(fatalErrorOnFailedRealizabilityTest)) | ||
178 | { | ||
179 | return false; | ||
180 | } | ||
181 | } | ||
182 | |||
183 | // Inverting moments and updating EQMOM | ||
184 | momentInverter_().invert(momentsToInvert); | ||
185 | |||
186 | // Recovering primary weights and abscissae from moment inverter | ||
187 | const scalarList& pWeights(momentInverter_().primaryWeights()); | ||
188 | |||
189 | const scalarList& pAbscissae | ||
190 | ( | ||
191 | momentInverter_().primaryAbscissae() | ||
192 | ); | ||
193 | |||
194 | // Copying EQMOM quadrature to fields | ||
195 | for (label pNodei = 0; pNodei < nodes.size(); pNodei++) | ||
196 | { | ||
197 | volScalarNode& node(nodes[pNodei]); | ||
198 | |||
199 | // Copy primary node | ||
200 | node.primaryWeight()[celli] = pWeights[pNodei]; | ||
201 | node.primaryAbscissa()[celli] = pAbscissae[pNodei]; | ||
202 | |||
203 | // Copy secondary nodes | ||
204 | PtrList<volScalarField>& sWeightFields(node.secondaryWeights()); | ||
205 | PtrList<volScalarField>& sAbscissaFields(node.secondaryAbscissae()); | ||
206 | |||
207 | const scalarRectangularMatrix& sWeights | ||
208 | ( | ||
209 | momentInverter_().secondaryWeights() | ||
210 | ); | ||
211 | |||
212 | const scalarRectangularMatrix& sAbscissae | ||
213 | ( | ||
214 | momentInverter_().secondaryAbscissae() | ||
215 | ); | ||
216 | |||
217 | for | ||
218 | ( | ||
219 | label sNodei = 0; | ||
220 | sNodei < nodes[0].nSecondaryNodes(); | ||
221 | sNodei++ | ||
222 | ) | ||
223 | { | ||
224 | sWeightFields[sNodei][celli] = sWeights[pNodei][sNodei]; | ||
225 | sAbscissaFields[sNodei][celli] = sAbscissae[pNodei][sNodei]; | ||
226 | } | ||
227 | |||
228 | // Copy sigma | ||
229 | node.sigma()[celli] = momentInverter_().sigma(); | ||
230 | } | ||
231 | |||
232 | return true; | ||
233 | } | ||
234 | |||
235 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/extendedFieldMomentInversion/extendedFieldMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.H (similarity 53%) (mode: 100755 -> 100644) (index 4e63d1c..e7086c2) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
9 | This file is derivative work of OpenFOAM. | ||
9 | This file is part of OpenFOAM. | ||
10 | 10 | ||
11 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it | OpenFOAM is free software: you can redistribute it and/or modify it |
12 | 12 | under the terms of the GNU General Public License as published by | under the terms of the GNU General Public License as published by |
... | ... | 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::mixingModel | ||
25 | Foam::extendedFieldMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Abstract class for the run-time selection of mixing models. | ||
28 | Inverts a volUnivariateMomentFieldSet using the extended quadrature method | ||
29 | of moments. | ||
29 | 30 | ||
30 | 31 | SourceFiles | SourceFiles |
31 | mixingModel.C | ||
32 | extendedFieldMomentInversion.C | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef mixingModel_H | ||
36 | #define mixingModel_H | ||
36 | #ifndef extendedFieldMomentInversion_H | ||
37 | #define extendedFieldMomentInversion_H | ||
37 | 38 | ||
38 | #include "dictionary.H" | ||
39 | #include "volFields.H" | ||
40 | #include "dimensionedTypes.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
39 | #include "fieldMomentInversion.H" | ||
40 | #include "univariateMomentSet.H" | ||
41 | #include "extendedMomentInversion.H" | ||
42 | 42 | ||
43 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 44 | ||
... | ... | namespace Foam | |
46 | 46 | { | { |
47 | 47 | ||
48 | 48 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
49 | Class mixingModel Declaration | ||
49 | Class extendedFieldMomentInversion Declaration | ||
50 | 50 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
51 | 51 | ||
52 | class mixingModel | ||
52 | class extendedFieldMomentInversion | ||
53 | : | ||
54 | public fieldMomentInversion | ||
53 | 55 | { | { |
54 | // Private data | ||
55 | |||
56 | //- Name of the mixingModel | ||
57 | const word name_; | ||
58 | |||
59 | 56 | // Private Member Functions | // Private Member Functions |
60 | 57 | ||
58 | //- Moment inverter | ||
59 | autoPtr<extendedMomentInversion> momentInverter_; | ||
60 | |||
61 | 61 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
62 | mixingModel(const mixingModel&); | ||
62 | extendedFieldMomentInversion(const extendedFieldMomentInversion&); | ||
63 | 63 | ||
64 | 64 | //- Disallow default bitwise assignment | //- Disallow default bitwise assignment |
65 | void operator=(const mixingModel&); | ||
66 | |||
67 | |||
68 | protected: | ||
69 | |||
70 | // Protected data | ||
71 | |||
72 | //- Fluid-phase face-normal velocity | ||
73 | const surfaceScalarField& phi_; | ||
65 | void operator=(const extendedFieldMomentInversion&); | ||
74 | 66 | ||
75 | 67 | ||
76 | 68 | public: | public: |
77 | 69 | ||
78 | 70 | //- Runtime type information | //- Runtime type information |
79 | TypeName("mixingModel"); | ||
80 | |||
81 | // Declare runtime constructor selection table | ||
82 | declareRunTimeSelectionTable | ||
83 | ( | ||
84 | autoPtr, | ||
85 | mixingModel, | ||
86 | dictionary, | ||
87 | ( | ||
88 | const word& name, | ||
89 | const dictionary& dict, | ||
90 | const volVectorField& U, | ||
91 | const surfaceScalarField& phi | ||
92 | ), | ||
93 | (name, dict, U, phi) | ||
94 | ); | ||
71 | TypeName("extendedFieldMomentInversion"); | ||
95 | 72 | ||
96 | 73 | ||
97 | 74 | // Constructors | // Constructors |
98 | 75 | ||
99 | //- Construct from components | ||
100 | mixingModel | ||
101 | ( | ||
102 | const word& name, | ||
103 | const dictionary& dict, | ||
104 | const volVectorField& U, | ||
105 | const surfaceScalarField& phi | ||
106 | ); | ||
107 | |||
108 | |||
109 | // Selectors | ||
110 | |||
111 | //- Select null constructed | ||
112 | static autoPtr<mixingModel> New | ||
76 | //- Construct from dictionary | ||
77 | extendedFieldMomentInversion | ||
113 | 78 | ( | ( |
114 | const word& name, | ||
115 | 79 | const dictionary& dict, | const dictionary& dict, |
116 | const volVectorField& U, | ||
117 | const surfaceScalarField& phi | ||
80 | const label nMoments, | ||
81 | const label nSecondaryNodes | ||
118 | 82 | ); | ); |
119 | 83 | ||
120 | 84 | ||
121 | 85 | //- Destructor | //- Destructor |
122 | virtual ~mixingModel(); | ||
86 | ~extendedFieldMomentInversion(); | ||
123 | 87 | ||
124 | 88 | ||
125 | // Member Functions | ||
89 | // Public member Functions | ||
126 | 90 | ||
127 | //- Solve mixing model | ||
128 | virtual void solve() = 0; | ||
91 | //- Invert moments in the entire computational domain | ||
92 | virtual void invert | ||
93 | ( | ||
94 | const volUnivariateMomentFieldSet& moments, | ||
95 | PtrList<volScalarNode>& nodes | ||
96 | ); | ||
129 | 97 | ||
98 | virtual void invertBoundaryMoments | ||
99 | ( | ||
100 | const volUnivariateMomentFieldSet& moments, | ||
101 | PtrList<volScalarNode>& nodes | ||
102 | ); | ||
103 | |||
104 | //- Invert moments in a single cell | ||
105 | virtual bool invertLocalMoments | ||
106 | ( | ||
107 | const volUnivariateMomentFieldSet& moments, | ||
108 | PtrList<volScalarNode>& nodes, | ||
109 | const label celli, | ||
110 | const bool fatalErrorOnFailedRealizabilityTest = true | ||
111 | ); | ||
130 | 112 | }; | }; |
131 | 113 | ||
132 | 114 |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/fieldMomentInversion.C copied from file multiphaseEulerPbeFoam/multiphaseDisperseSystem/diameterModels/diameterModel/diameterModel.C (similarity 76%) (mode: 100644) (index c57ec8c..d673d89) | |||
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) 2011-2013 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2014-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
9 | This file is part of OpenFOAM. | ||
9 | This file is derivative work of OpenFOAM. | ||
10 | 10 | ||
11 | 11 | OpenFOAM is free software: you can redistribute it and/or modify it | OpenFOAM is free software: you can redistribute it and/or modify it |
12 | 12 | under the terms of the GNU General Public License as published by | under the terms of the GNU General Public License as published by |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "diameterModel.H" | ||
26 | #include "fieldMomentInversion.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 | defineTypeNameAndDebug(diameterModel, 0); | ||
33 | defineRunTimeSelectionTable(diameterModel, dictionary); | ||
33 | defineTypeNameAndDebug(fieldMomentInversion, 0); | ||
34 | defineRunTimeSelectionTable(fieldMomentInversion, dictionary); | ||
34 | 35 | } | } |
35 | 36 | ||
36 | |||
37 | 37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
38 | 38 | ||
39 | Foam::diameterModel::diameterModel | ||
39 | Foam::fieldMomentInversion::fieldMomentInversion | ||
40 | 40 | ( | ( |
41 | 41 | const dictionary& dict, | const dictionary& dict, |
42 | const phaseModel& phase | ||
42 | const label nMoments, | ||
43 | const label nSecondaryNodes | ||
43 | 44 | ) | ) |
44 | 45 | : | : |
45 | dict_(dict), | ||
46 | phase_(phase) | ||
46 | extended_(false) | ||
47 | 47 | {} | {} |
48 | 48 | ||
49 | 49 | ||
50 | 50 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
51 | 51 | ||
52 | Foam::diameterModel::~diameterModel() | ||
52 | Foam::fieldMomentInversion::~fieldMomentInversion() | ||
53 | 53 | {} | {} |
54 | 54 | ||
55 | 55 | ||
56 | 56 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
57 | 57 | ||
58 | void Foam::diameterModel::correct() | ||
59 | {} | ||
60 | |||
61 | |||
62 | 58 | ||
63 | 59 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/fieldMomentInversion.H added (mode: 100644) (index 0000000..2161dc1) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | Class | ||
25 | Foam::fieldMomentInversion | ||
26 | |||
27 | Description | ||
28 | Abstract class for run-time selection of field moment inversion. | ||
29 | |||
30 | SourceFiles | ||
31 | fieldMomentInversion.C | ||
32 | fieldMomentInversionI.H | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef fieldMomentInversion_H | ||
37 | #define fieldMomentInversion_H | ||
38 | |||
39 | #include "runTimeSelectionTables.H" | ||
40 | #include "quadratureNodes.H" | ||
41 | #include "univariateMomentSet.H" | ||
42 | #include "momentFieldSets.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class fieldMomentInversion Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class fieldMomentInversion | ||
53 | { | ||
54 | // Private member functions | ||
55 | |||
56 | //- Disallow default bitwise copy construct | ||
57 | fieldMomentInversion(const fieldMomentInversion&); | ||
58 | |||
59 | //- Disallow default bitwise assignment | ||
60 | void operator=(const fieldMomentInversion&); | ||
61 | |||
62 | |||
63 | protected: | ||
64 | |||
65 | // Protected data | ||
66 | |||
67 | //- Boolean flag to indicate extended type of inversion | ||
68 | bool extended_; | ||
69 | |||
70 | |||
71 | public: | ||
72 | |||
73 | //- Runtime type information | ||
74 | TypeName("fieldMomentInversion"); | ||
75 | |||
76 | |||
77 | // Declare runtime construction | ||
78 | |||
79 | declareRunTimeSelectionTable | ||
80 | ( | ||
81 | autoPtr, | ||
82 | fieldMomentInversion, | ||
83 | dictionary, | ||
84 | ( | ||
85 | const dictionary& dict, | ||
86 | const label nMoments, | ||
87 | const label nSecondaryNodes | ||
88 | ), | ||
89 | (dict, nMoments, nSecondaryNodes) | ||
90 | ); | ||
91 | |||
92 | |||
93 | // Constructors | ||
94 | |||
95 | //- Construct from univariateMomentSet | ||
96 | fieldMomentInversion | ||
97 | ( | ||
98 | const dictionary& dict, | ||
99 | const label nMoments, | ||
100 | const label nSecondaryNodes | ||
101 | ); | ||
102 | |||
103 | |||
104 | //- Destructor | ||
105 | virtual ~fieldMomentInversion(); | ||
106 | |||
107 | |||
108 | // Selectors | ||
109 | |||
110 | static autoPtr<fieldMomentInversion> New | ||
111 | ( | ||
112 | const dictionary& dict, | ||
113 | const label nMoments, | ||
114 | const label nSecondaryNodes | ||
115 | ); | ||
116 | |||
117 | |||
118 | // Member Functions | ||
119 | |||
120 | //- Invert moments in the entire computational domain | ||
121 | virtual void invert | ||
122 | ( | ||
123 | const volUnivariateMomentFieldSet& moments, | ||
124 | PtrList<volScalarNode>& nodes | ||
125 | ) = 0; | ||
126 | |||
127 | //- Invert moments on boundaries | ||
128 | virtual void invertBoundaryMoments | ||
129 | ( | ||
130 | const volUnivariateMomentFieldSet& moments, | ||
131 | PtrList<volScalarNode>& nodes | ||
132 | ) = 0; | ||
133 | |||
134 | //- Invert moments in a single cell | ||
135 | virtual bool invertLocalMoments | ||
136 | ( | ||
137 | const volUnivariateMomentFieldSet& moments, | ||
138 | PtrList<volScalarNode>& nodes, | ||
139 | const label celli, | ||
140 | const bool fatalErrorOnFailedRealizabilityTest = true | ||
141 | ) = 0; | ||
142 | |||
143 | //- Return extended type | ||
144 | inline bool extended(); | ||
145 | }; | ||
146 | |||
147 | |||
148 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
149 | |||
150 | } // End namespace Foam | ||
151 | |||
152 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
153 | |||
154 | #include "fieldMomentInversionI.H" | ||
155 | |||
156 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
157 | |||
158 | #endif | ||
159 | |||
160 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/fieldMomentInversionI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H (similarity 85%) (mode: 100644 -> 100755) (index ddb0a21..7ca6809) | |||
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) 2014-2017 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& | ||
29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | ||
28 | bool Foam::fieldMomentInversion::extended() | ||
30 | 29 | { | { |
31 | return quadrature_; | ||
30 | return extended_; | ||
32 | 31 | } | } |
33 | 32 | ||
34 | |||
35 | 33 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/fieldMomentInversion/fieldMomentInversion/newFieldMomentInversion.C renamed from multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coalescenceKernel/newCoalescenceKernel.C (similarity 63%) (mode: 100644) (index 792c41f..fea7711) | |||
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) 2014-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "coalescenceKernel.H" | ||
26 | #include "fieldMomentInversion.H" | ||
27 | 27 | ||
28 | // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // | ||
28 | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // | ||
29 | 29 | ||
30 | Foam::autoPtr<Foam::populationBalanceSubModels::coalescenceKernel> | ||
31 | Foam::populationBalanceSubModels::coalescenceKernel::New | ||
30 | Foam::autoPtr<Foam::fieldMomentInversion> Foam::fieldMomentInversion::New | ||
32 | 31 | ( | ( |
33 | 32 | const dictionary& dict, | const dictionary& dict, |
34 | const fvMesh& mesh, | ||
35 | const volVectorField& U | ||
33 | const label nMoments, | ||
34 | const label nSecondaryNodes | ||
36 | 35 | ) | ) |
37 | 36 | { | { |
38 | word coalescenceKernelType(dict.lookup("coalescenceKernel")); | ||
37 | word fieldMomentInversionType | ||
38 | ( | ||
39 | dict.lookup("fieldMomentInversion") | ||
40 | ); | ||
39 | 41 | ||
40 | Info<< "Selecting coalescenceKernel " | ||
41 | << coalescenceKernelType << endl; | ||
42 | Info<< "Selecting fieldMomentInversion: " | ||
43 | << fieldMomentInversionType << endl; | ||
42 | 44 | ||
43 | 45 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
44 | dictionaryConstructorTablePtr_->find(coalescenceKernelType); | ||
46 | dictionaryConstructorTablePtr_->find(fieldMomentInversionType); | ||
45 | 47 | ||
46 | 48 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
47 | 49 | { | { |
48 | 50 | FatalErrorInFunction | FatalErrorInFunction |
49 | << "Unknown coalescenceKernelType type " | ||
50 | << coalescenceKernelType << endl << endl | ||
51 | << "Valid coalescenceKernelType types are :" << endl | ||
51 | << "Unknown fieldMomentInversion type " | ||
52 | << fieldMomentInversionType << endl << endl | ||
53 | << "Valid fieldMomentInversion types are : " << endl | ||
52 | 54 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
53 | << abort(FatalError); | ||
55 | << exit(FatalError); | ||
54 | 56 | } | } |
55 | 57 | ||
56 | return autoPtr<coalescenceKernel>(cstrIter()(dict, mesh, U)); | ||
58 | return cstrIter()(dict, nMoments, nSecondaryNodes); | ||
57 | 59 | } | } |
58 | 60 | ||
59 | 61 |
File multiphaseEulerPbeFoam/quadratureMethods/hermiteQuadrature/Make/files added (mode: 100644) (index 0000000..b8908ad) | |||
1 | hermiteQuadrature.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libhermiteQuadrature |
File multiphaseEulerPbeFoam/quadratureMethods/hermiteQuadrature/Make/options copied from file multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/Make/options (similarity 62%) (mode: 100644) (index d1b5d52..3888545) | |||
1 | 1 | EXE_INC = \ | EXE_INC = \ |
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | 2 | -I../../eigenSolver/lnInclude | -I../../eigenSolver/lnInclude |
4 | 3 | ||
5 | 4 | LIB_LIBS = \ | LIB_LIBS = \ |
6 | -lfiniteVolume \ | ||
7 | 5 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
8 | 6 | -leigenSolver | -leigenSolver |
File multiphaseEulerPbeFoam/quadratureMethods/hermiteQuadrature/hermiteQuadrature.C added (mode: 100644) (index 0000000..f7844ca) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2010-2014 Bo Kong | ||
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 "hermiteQuadrature.H" | ||
27 | #include "scalar.H" | ||
28 | #include "scalarMatrices.H" | ||
29 | #include "eigenSolver.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
32 | |||
33 | const Foam::scalar Foam::hermiteQuadrature::thetaLimit_ = 1.0E-7; | ||
34 | |||
35 | Foam::hermiteQuadrature::hermiteQuadrature | ||
36 | ( | ||
37 | const label& nDim, | ||
38 | const label& nOrder | ||
39 | ) | ||
40 | : | ||
41 | nDim_(nDim), | ||
42 | nOrder_(nOrder), | ||
43 | nTolNodes_(pow(nOrder_, nDim)), | ||
44 | origWei_(nTolNodes_, 0.0), | ||
45 | origAbs_(nTolNodes_, vector::zero), | ||
46 | resAbs_(nTolNodes_, vector::zero) | ||
47 | { | ||
48 | |||
49 | if((nOrder_ <= 0)) | ||
50 | { | ||
51 | FatalErrorIn("Foam::hermiteQuadrature\n" ) | ||
52 | << "parameter(s) out of range ! " | ||
53 | << abort(FatalError); | ||
54 | } | ||
55 | |||
56 | scalarRectangularMatrix ab(nOrder_, 2, scalar(0)); | ||
57 | |||
58 | for(label i = 0; i < nOrder_; i++) | ||
59 | { | ||
60 | ab[i][1]= scalar(i); | ||
61 | } | ||
62 | |||
63 | scalarSquareMatrix z(nOrder_, Zero); | ||
64 | |||
65 | for (label i = 0; i < nOrder_ - 1; i++) | ||
66 | { | ||
67 | z[i][i] = ab[i][0]; | ||
68 | z[i][i+1] = Foam::sqrt(ab[i+1][1]); | ||
69 | z[i+1][i] = z[i][i+1]; | ||
70 | } | ||
71 | |||
72 | z[nOrder_-1][nOrder_-1] = ab[nOrder_-1][0]; | ||
73 | |||
74 | eigenSolver zEig(z); | ||
75 | |||
76 | scalarList herWei_(nOrder_,0.0); | ||
77 | scalarList herAbs_(nOrder_,0.0); | ||
78 | |||
79 | forAll(herWei_,i) | ||
80 | { | ||
81 | herWei_[i] = sqr(zEig.eigenvectors()[0][i]); | ||
82 | herAbs_[i] = zEig.eigenvaluesRe()[i]; | ||
83 | } | ||
84 | |||
85 | scalar wtotal = sum(herWei_) ; | ||
86 | |||
87 | forAll(herWei_,i) | ||
88 | { | ||
89 | herWei_[i] = herWei_[i]/wtotal; | ||
90 | } | ||
91 | |||
92 | if (nDim_ == 1) | ||
93 | { | ||
94 | forAll(origWei_,i) | ||
95 | { | ||
96 | origWei_[i] = herWei_[i]; | ||
97 | origAbs_[i] = vector(herAbs_[i], 0, 0); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | maxAbs_ = max(herAbs_); | ||
102 | |||
103 | if (nDim_ == 2) | ||
104 | { | ||
105 | for(label i = 0; i < nOrder_; i++) | ||
106 | { | ||
107 | for(label j = 0; j < nOrder_; j++) | ||
108 | { | ||
109 | label p = i*nOrder_ + j; | ||
110 | origWei_[p] = herWei_[i]*herWei_[j]; | ||
111 | origAbs_[p] = vector(herAbs_[i], herAbs_[j], 0); | ||
112 | |||
113 | } | ||
114 | } | ||
115 | } | ||
116 | |||
117 | if (nDim_ == 3) | ||
118 | { | ||
119 | for(label i = 0; i < nOrder_; i++) | ||
120 | { | ||
121 | for(label j = 0; j < nOrder_; j++) | ||
122 | { | ||
123 | for(label k = 0; k < nOrder_; k++) | ||
124 | { | ||
125 | label p = i*nOrder_*nOrder_ + j*nOrder_ + k; | ||
126 | origWei_[p] = herWei_[i]*herWei_[j]*herWei_[k]; | ||
127 | origAbs_[p] = vector(herAbs_[i], herAbs_[j], herAbs_[k]); | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | return ; | ||
134 | } | ||
135 | |||
136 | void Foam::hermiteQuadrature::calcHermiteQuadrature | ||
137 | ( | ||
138 | const vector& mu, | ||
139 | const symmTensor& Pp | ||
140 | ) | ||
141 | { | ||
142 | if (tr(Pp) > thetaLimit_) | ||
143 | { | ||
144 | tensor spM(tensor::zero); | ||
145 | |||
146 | if( nDim_ == 3) | ||
147 | { | ||
148 | scalarSquareMatrix z(3, Zero); | ||
149 | |||
150 | z[0][0] = Pp.xx(); | ||
151 | z[0][1] = Pp.xy(); | ||
152 | z[0][2] = Pp.xz(); | ||
153 | z[1][0] = Pp.xy(); | ||
154 | z[1][1] = Pp.yy(); | ||
155 | z[1][2] = Pp.yz(); | ||
156 | z[2][0] = Pp.xz(); | ||
157 | z[2][1] = Pp.yz(); | ||
158 | z[2][2] = Pp.zz(); | ||
159 | |||
160 | eigenSolver zEig(z); | ||
161 | const scalarDiagonalMatrix& e(zEig.eigenvaluesRe()); | ||
162 | const scalarSquareMatrix& ev(zEig.eigenvectors()); | ||
163 | |||
164 | scalarSquareMatrix E(3, Zero); | ||
165 | |||
166 | forAll(e,i) | ||
167 | { | ||
168 | if(e[i] >= 0) | ||
169 | { | ||
170 | E[i][i] = sqrt(e[i]); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | E[i][i] = 0.0; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | z = Zero; | ||
179 | multiply(z, ev, E); | ||
180 | forAll(spM,i) spM[i] = z[label(i/3)][i % 3]; | ||
181 | |||
182 | } | ||
183 | else | ||
184 | { | ||
185 | if(nDim_==2) | ||
186 | { | ||
187 | scalarSquareMatrix z(2, Zero); | ||
188 | z[0][0] = Pp.xx(); | ||
189 | z[0][1] = Pp.xy(); | ||
190 | z[1][0] = Pp.xy(); | ||
191 | z[1][1] = Pp.yy(); | ||
192 | |||
193 | eigenSolver zEig(z); | ||
194 | const scalarDiagonalMatrix& e(zEig.eigenvaluesRe()); | ||
195 | const scalarSquareMatrix& ev(zEig.eigenvectors()); | ||
196 | |||
197 | scalarSquareMatrix E(2,Zero); | ||
198 | |||
199 | forAll(e, i) | ||
200 | { | ||
201 | if(e[i] >=0) | ||
202 | { | ||
203 | E[i][i] = sqrt(e[i]); | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | E[i][i] = 0.0; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | z = Zero; | ||
212 | multiply(z, ev, E); | ||
213 | |||
214 | spM.xx() = z[0][0]; | ||
215 | spM.xy() = z[0][1]; | ||
216 | spM.yx() = z[1][0]; | ||
217 | spM.yy() = z[1][1]; | ||
218 | |||
219 | } | ||
220 | else | ||
221 | { | ||
222 | spM.xx() = sqrt(Pp.xx()); | ||
223 | } | ||
224 | } | ||
225 | |||
226 | resAbs_ = (spM & origAbs_) + mu; | ||
227 | |||
228 | } | ||
229 | else | ||
230 | { | ||
231 | resAbs_ = mu ; | ||
232 | } | ||
233 | |||
234 | return ; | ||
235 | } | ||
236 | |||
237 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/hermiteQuadrature/hermiteQuadrature.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.H (similarity 52%) (mode: 100644) (index 21240d1..a9e36cb) | |||
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) 2010-2014 Bo Kong | ||
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::mixingSubModels::diffusionModels::turbulentDiffusion | ||
25 | Foam::hermiteQuadrature | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Turbulent diffusion model. | ||
29 | |||
30 | SourceFiles | ||
31 | turbulentDiffusion.C | ||
28 | Use spectral methods to generate samples for multivaraites Gaussian | ||
29 | distribution | ||
32 | 30 | ||
33 | 31 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 32 | ||
35 | #ifndef turbulentDiffusion_H | ||
36 | #define turbulentDiffusion_H | ||
33 | #ifndef hermiteQuadrature_H | ||
34 | #define hermiteQuadrature_H | ||
37 | 35 | ||
38 | #include "diffusionModel.H" | ||
39 | #include "fvm.H" | ||
36 | #include "scalar.H" | ||
37 | #include "vector.H" | ||
38 | #include "tensor.H" | ||
39 | #include "scalarList.H" | ||
40 | #include "vectorList.H" | ||
40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 42 | ||
42 | 43 | namespace Foam | namespace Foam |
43 | 44 | { | { |
44 | namespace mixingSubModels | ||
45 | { | ||
46 | namespace diffusionModels | ||
47 | { | ||
48 | 45 | ||
49 | 46 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
50 | Class turbulentDiffusion Declaration | ||
47 | Class hermiteQuadrature Declaration | ||
51 | 48 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
52 | 49 | ||
53 | class turbulentDiffusion | ||
54 | : | ||
55 | public diffusionModel | ||
50 | class hermiteQuadrature | ||
56 | 51 | { | { |
52 | // Private data | ||
53 | |||
54 | static const scalar thetaLimit_; | ||
55 | |||
56 | //- Number of weights and abscissas | ||
57 | const label nDim_; | ||
58 | |||
59 | const label nOrder_; | ||
60 | |||
61 | const label nTolNodes_; | ||
62 | |||
63 | scalarList origWei_; | ||
64 | |||
65 | vectorList origAbs_; | ||
66 | |||
67 | vectorList resAbs_; | ||
68 | |||
69 | scalar maxAbs_; | ||
70 | |||
57 | 71 | //- Private member functions | //- Private member functions |
58 | tmp<volScalarField> turbViscosity(const volScalarField& moment) const; | ||
59 | 72 | ||
60 | //- Private data | ||
73 | //- Disallow default bitwise copy construct | ||
74 | hermiteQuadrature(const hermiteQuadrature&); | ||
61 | 75 | ||
62 | //- Laminar diffusivity | ||
63 | dimensionedScalar gammaLam_; | ||
76 | //- Disallow default bitwise assignment | ||
77 | void operator=(const hermiteQuadrature&); | ||
64 | 78 | ||
65 | //- Turbulent Schmidt number | ||
66 | scalar Sc_; | ||
67 | 79 | ||
68 | 80 | public: | public: |
69 | 81 | ||
70 | //- Runtime type information | ||
71 | TypeName("turbulentDiffusion"); | ||
82 | // Constructors | ||
72 | 83 | ||
84 | //- Construct from a scalarDiagonalMatrix | ||
85 | hermiteQuadrature | ||
86 | ( | ||
87 | const label& nDim, | ||
88 | const label& nOrder | ||
89 | ); | ||
73 | 90 | ||
74 | // Constructors | ||
75 | 91 | ||
76 | //- Construct from components | ||
77 | turbulentDiffusion(const dictionary& dict); | ||
92 | void calcHermiteQuadrature | ||
93 | ( | ||
94 | const vector& mu, | ||
95 | const symmTensor& Pp | ||
96 | ) ; | ||
97 | |||
78 | 98 | ||
99 | //- Return eigenvalues | ||
100 | const scalarList& hermiteWeights() const | ||
101 | { | ||
102 | return origWei_; | ||
103 | } | ||
79 | 104 | ||
80 | //- Destructor | ||
81 | virtual ~turbulentDiffusion(); | ||
105 | //- Return eigenvectors | ||
106 | const vectorList& hermiteAbscissas() const | ||
107 | { | ||
108 | return resAbs_; | ||
109 | } | ||
82 | 110 | ||
111 | vectorList& hermiteAbscissas() | ||
112 | { | ||
113 | return resAbs_; | ||
114 | } | ||
83 | 115 | ||
84 | // Member Functions | ||
116 | const vectorList& hermiteOriginalAbscissas() const | ||
117 | { | ||
118 | return origAbs_; | ||
119 | } | ||
85 | 120 | ||
86 | //- Moments of the daughter distribution | ||
87 | virtual tmp<fvScalarMatrix> momentDiff | ||
88 | ( | ||
89 | const volScalarField& moment | ||
90 | ) const; | ||
121 | const scalar& maxAbs() const | ||
122 | { | ||
123 | return maxAbs_; | ||
124 | } | ||
91 | 125 | ||
92 | 126 | }; | }; |
93 | 127 | ||
94 | 128 | ||
95 | 129 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
96 | 130 | ||
97 | } // End namespace diffusionModels | ||
98 | } // End namespace mixingSubModels | ||
99 | 131 | } // End namespace Foam | } // End namespace Foam |
100 | 132 | ||
101 | 133 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/Make/files changed (mode: 100644) (index be402eb..e58ee4c) | |||
... | ... | mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C | |
9 | 9 | ||
10 | 10 | mixingSubModels/mixingKernels/mixingKernel/mixingKernel.C | mixingSubModels/mixingKernels/mixingKernel/mixingKernel.C |
11 | 11 | mixingSubModels/mixingKernels/mixingKernel/newMixingKernel.C | mixingSubModels/mixingKernels/mixingKernel/newMixingKernel.C |
12 | mixingSubModels/mixingKernels/noMixingKernel/noMixingKernel.C | ||
12 | 13 | mixingSubModels/mixingKernels/IEM/IEM.C | mixingSubModels/mixingKernels/IEM/IEM.C |
13 | 14 | mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.C | mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.C |
14 | 15 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/Make/options changed (mode: 100644) (index 8cb9c4e..f3531f4) | |||
... | ... | EXE_INC = \ | |
9 | 9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
10 | 10 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
11 | 11 | -I../../eigenSolver/lnInclude \ | -I../../eigenSolver/lnInclude \ |
12 | -I../univariateMomentSet/lnInclude \ | ||
13 | -I../extentedMomentInversion/lnInclude \ | ||
12 | -I../../mappedList \ | ||
13 | -I../momentSets/lnInclude \ | ||
14 | 14 | -I../quadratureNode \ | -I../quadratureNode \ |
15 | 15 | -I../moments \ | -I../moments \ |
16 | -I../quadratureApproximation/lnInclude \ | ||
16 | -I../momentInversion/univariate/basic/lnInclude \ | ||
17 | -I../momentInversion/univariate/extended/lnInclude \ | ||
18 | -I../fieldMomentInversion/lnInclude \ | ||
19 | -I../quadratureApproximations/lnInclude \ | ||
20 | -I../momentAdvection/lnInclude \ | ||
17 | 21 | -I../PDFTransportModels/lnInclude | -I../PDFTransportModels/lnInclude |
18 | 22 | ||
19 | 23 | LIB_LIBS = \ | LIB_LIBS = \ |
... | ... | LIB_LIBS = \ | |
28 | 32 | -lmeshTools \ | -lmeshTools \ |
29 | 33 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
30 | 34 | -leigenSolver \ | -leigenSolver \ |
31 | -lmomentSet \ | ||
35 | -lmomentSets \ | ||
36 | -lmomentInversion \ | ||
32 | 37 | -lextendedMomentInversion \ | -lextendedMomentInversion \ |
38 | -lfieldMomentInversion \ | ||
33 | 39 | -lquadratureApproximation \ | -lquadratureApproximation \ |
40 | -lmomentAdvection \ | ||
34 | 41 | -lPDFTransportModel | -lPDFTransportModel |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.C changed (mode: 100644) (index e110bf9..4040ec7) | |||
... | ... | Foam::mixingModel::mixingModel | |
40 | 40 | ( | ( |
41 | 41 | const word& name, | const word& name, |
42 | 42 | const dictionary& dict, | const dictionary& dict, |
43 | const volVectorField& U, | ||
44 | 43 | const surfaceScalarField& phi | const surfaceScalarField& phi |
45 | 44 | ) | ) |
46 | 45 | : | : |
... | ... | Foam::mixingModel::mixingModel | |
54 | 53 | Foam::mixingModel::~mixingModel() | Foam::mixingModel::~mixingModel() |
55 | 54 | {} | {} |
56 | 55 | ||
57 | |||
58 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
59 | |||
60 | |||
61 | |||
62 | 56 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/mixingModel.H changed (mode: 100644) (index 4e63d1c..22f0d66) | |||
... | ... | public: | |
87 | 87 | ( | ( |
88 | 88 | const word& name, | const word& name, |
89 | 89 | const dictionary& dict, | const dictionary& dict, |
90 | const volVectorField& U, | ||
91 | 90 | const surfaceScalarField& phi | const surfaceScalarField& phi |
92 | 91 | ), | ), |
93 | (name, dict, U, phi) | ||
92 | (name, dict, phi) | ||
94 | 93 | ); | ); |
95 | 94 | ||
96 | 95 | ||
... | ... | public: | |
101 | 100 | ( | ( |
102 | 101 | const word& name, | const word& name, |
103 | 102 | const dictionary& dict, | const dictionary& dict, |
104 | const volVectorField& U, | ||
105 | 103 | const surfaceScalarField& phi | const surfaceScalarField& phi |
106 | 104 | ); | ); |
107 | 105 | ||
... | ... | public: | |
113 | 111 | ( | ( |
114 | 112 | const word& name, | const word& name, |
115 | 113 | const dictionary& dict, | const dictionary& dict, |
116 | const volVectorField& U, | ||
117 | 114 | const surfaceScalarField& phi | const surfaceScalarField& phi |
118 | 115 | ); | ); |
119 | 116 | ||
... | ... | public: | |
124 | 121 | ||
125 | 122 | // Member Functions | // Member Functions |
126 | 123 | ||
124 | //- Return the maximum Courant number ensuring moment realizability | ||
125 | virtual scalar realizableCo() = 0; | ||
126 | |||
127 | 127 | //- Solve mixing model | //- Solve mixing model |
128 | 128 | virtual void solve() = 0; | virtual void solve() = 0; |
129 | 129 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingModel/newMixingModel.C changed (mode: 100644) (index f13c124..2d4228f) | |||
... | ... | Foam::autoPtr<Foam::mixingModel> Foam::mixingModel::New | |
31 | 31 | ( | ( |
32 | 32 | const word& name, | const word& name, |
33 | 33 | const dictionary& dict, | const dictionary& dict, |
34 | const volVectorField& U, | ||
35 | 34 | const surfaceScalarField& phi | const surfaceScalarField& phi |
36 | 35 | ) | ) |
37 | 36 | { | { |
... | ... | Foam::autoPtr<Foam::mixingModel> Foam::mixingModel::New | |
60 | 59 | ( | ( |
61 | 60 | name, | name, |
62 | 61 | dict.subDict(mixingModelType + "Coeffs"), | dict.subDict(mixingModelType + "Coeffs"), |
63 | U, | ||
64 | 62 | phi | phi |
65 | 63 | ) | ) |
66 | 64 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C changed (mode: 100644) (index c92b561..16f3d69) | |||
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-2017 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 33ca88f..b32565d) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Molecular diffusion model. | Molecular diffusion model. |
29 | 29 | ||
30 | The moment diffusion is modeled with a constant diffusion coefficient | ||
31 | specified by the user. | ||
32 | |||
33 | \f[ | ||
34 | \mathcal{D}_k = \nabla \cdot \left( \Gamma_l | ||
35 | \nabla m_k \right) | ||
36 | \f] | ||
37 | |||
38 | where | ||
39 | |||
40 | \vartable | ||
41 | \mathcal{D}_k | Diffusion term in the moment transport equation | ||
42 | m_k | Moment of order k [-] | ||
43 | \Gamma_l | Molecular diffusivity [m2/s] | ||
44 | \endvartable | ||
45 | |||
30 | 46 | SourceFiles | SourceFiles |
31 | 47 | molecularDiffusion.C | molecularDiffusion.C |
32 | 48 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C changed (mode: 100644) (index d0a1183..90be3b7) | |||
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-2017 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 21240d1..1f7c878) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Turbulent diffusion model. | Turbulent diffusion model. |
29 | 29 | ||
30 | The moment diffusion is modeled as | ||
31 | |||
32 | \f[ | ||
33 | \mathcal{D}_k = \nabla \cdot \left[ \left( \Gamma_l | ||
34 | + \frac{\mu_t}{Sc_t} \right) \nabla m_k \right] | ||
35 | \f] | ||
36 | |||
37 | where | ||
38 | |||
39 | \vartable | ||
40 | \mathcal{D}_k | Diffusion term in the moment transport equation | ||
41 | m_k | Moment of order k [-] | ||
42 | Sc_t | Turbulent Schmidt number [-] | ||
43 | \Gamma_l | Molecular diffusivity [m2/s] | ||
44 | \mu_t | Turbulent dynamic viscosity [m2/s] | ||
45 | \endvartable | ||
46 | |||
30 | 47 | SourceFiles | SourceFiles |
31 | 48 | turbulentDiffusion.C | turbulentDiffusion.C |
32 | 49 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.C changed (mode: 100644) (index 6a0fd06..bce97f0) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::mixingSubModels::mixingKernels::FokkerPlanck | |
63 | 63 | ||
64 | 64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
65 | 65 | ||
66 | Foam::mixingSubModels::mixingKernels::FokkerPlanck | ||
67 | ::~FokkerPlanck() | ||
66 | Foam::mixingSubModels::mixingKernels::FokkerPlanck::~FokkerPlanck() | ||
68 | 67 | {} | {} |
69 | 68 | ||
70 | 69 |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/FokkerPlanck/FokkerPlanck.H changed (mode: 100644) (index b37c894..931e5a1) | |||
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-2017 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 | Fokker-Planck mixing model. | ||
25 | Foam::mixingSubModels::mixingKernels::FokkerPlanck | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | Kolmogorov scale. | ||
28 | Fokker-Planck mixing model. | ||
31 | 29 | ||
32 | 30 | References | References |
33 | 31 | \verbatim | \verbatim |
... | ... | Description | |
35 | 33 | R O Fox | R O Fox |
36 | 34 | Cambridge University Press | Cambridge University Press |
37 | 35 | \endverbatim | \endverbatim |
38 | |||
39 | \verbatim | ||
40 | "Solution of the Fokker-Planck Equation Using the Extended | ||
41 | Quadrature Method of Moments" | ||
42 | E Madadi-Kandjani and A Passalacqua | ||
43 | 2015 AIChE Annual Meeting, Salt Lake City, UT | ||
44 | \endverbatim | ||
45 | 36 | ||
46 | 37 | SourceFiles | SourceFiles |
47 | 38 | FokkerPlanck.C | FokkerPlanck.C |
... | ... | namespace mixingKernels | |
63 | 54 | { | { |
64 | 55 | ||
65 | 56 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
66 | Class FokkerPlanck Declaration | ||
57 | Class FokkerPlanck Declaration | ||
67 | 58 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
68 | 59 | ||
69 | 60 | class FokkerPlanck | class FokkerPlanck |
... | ... | public: | |
88 | 79 | ||
89 | 80 | // Member Functions | // Member Functions |
90 | 81 | ||
91 | //- Aggregation kernel | ||
82 | //- Mixing kernel | ||
92 | 83 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
93 | 84 | ( | ( |
94 | 85 | const volUnivariateMoment& moment, | const volUnivariateMoment& moment, |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.C changed (mode: 100644) (index f87f8f4..dfa6a85) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace mixingKernels | |
51 | 51 | ||
52 | 52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
53 | 53 | ||
54 | Foam::mixingSubModels::mixingKernels::IEM | ||
55 | ::IEM | ||
54 | Foam::mixingSubModels::mixingKernels::IEM::IEM | ||
56 | 55 | ( | ( |
57 | 56 | const dictionary& dict | const dictionary& dict |
58 | 57 | ) | ) |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.H changed (mode: 100644) (index d122951..c4245bd) | |||
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-2017 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 | Interaction by exchange with the mean mixing model. | ||
25 | Foam::mixingSubModels::mixingKernels::IEM | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | Kolmogorov scale. | ||
28 | Interaction by exchange with the mean mixing model. | ||
31 | 29 | ||
32 | 30 | References | References |
33 | 31 | \verbatim | \verbatim |
... | ... | public: | |
81 | 79 | ||
82 | 80 | // Member Functions | // Member Functions |
83 | 81 | ||
84 | //- Aggregation kernel | ||
82 | //- Mixing kernel | ||
85 | 83 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
86 | 84 | ( | ( |
87 | 85 | const volUnivariateMoment& moment, | const volUnivariateMoment& moment, |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/noMixingKernel/noMixingKernel.C copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C (similarity 70%) (mode: 100644) (index c92b561..62543a0) | |||
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-2018 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "molecularDiffusion.H" | ||
26 | #include "noMixingKernel.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | |||
29 | #include "turbulentTransportModel.H" | ||
30 | 28 | #include "turbulentFluidThermoModel.H" | #include "turbulentFluidThermoModel.H" |
29 | #include "fundamentalConstants.H" | ||
31 | 30 | ||
32 | 31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
33 | 32 | ||
... | ... | namespace Foam | |
35 | 34 | { | { |
36 | 35 | namespace mixingSubModels | namespace mixingSubModels |
37 | 36 | { | { |
38 | namespace diffusionModels | ||
37 | namespace mixingKernels | ||
39 | 38 | { | { |
40 | defineTypeNameAndDebug(molecularDiffusion, 0); | ||
39 | defineTypeNameAndDebug(noMixingKernel, 0); | ||
41 | 40 | ||
42 | 41 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
43 | 42 | ( | ( |
44 | diffusionModel, | ||
45 | molecularDiffusion, | ||
43 | mixingKernel, | ||
44 | noMixingKernel, | ||
46 | 45 | dictionary | dictionary |
47 | 46 | ); | ); |
48 | 47 | } | } |
... | ... | namespace diffusionModels | |
52 | 51 | ||
53 | 52 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
54 | 53 | ||
55 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
56 | ::molecularDiffusion | ||
54 | Foam::mixingSubModels::mixingKernels::noMixingKernel::noMixingKernel | ||
57 | 55 | ( | ( |
58 | 56 | const dictionary& dict | const dictionary& dict |
59 | 57 | ) | ) |
60 | 58 | : | : |
61 | diffusionModel(dict), | ||
62 | gammaLam_(dict.lookup("gammaLam")) | ||
59 | mixingKernel(dict) | ||
63 | 60 | {} | {} |
64 | 61 | ||
65 | 62 | ||
66 | 63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
67 | 64 | ||
68 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
69 | ::~molecularDiffusion() | ||
65 | Foam::mixingSubModels::mixingKernels::noMixingKernel | ||
66 | ::~noMixingKernel() | ||
70 | 67 | {} | {} |
71 | 68 | ||
72 | 69 | ||
73 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
74 | 71 | ||
75 | 72 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
76 | Foam::mixingSubModels::diffusionModels::molecularDiffusion | ||
77 | ::momentDiff | ||
73 | Foam::mixingSubModels::mixingKernels::noMixingKernel::K | ||
78 | 74 | ( | ( |
79 | const volScalarField& moment | ||
75 | const volUnivariateMoment& moment, | ||
76 | const volUnivariateMomentFieldSet& moments | ||
80 | 77 | ) const | ) const |
81 | 78 | { | { |
79 | tmp<fvScalarMatrix> mixingK | ||
80 | ( | ||
81 | new fvScalarMatrix | ||
82 | ( | ||
83 | moment, | ||
84 | moment.dimensions()*dimVol/dimTime | ||
85 | ) | ||
86 | ); | ||
82 | 87 | ||
83 | return fvm::laplacian(gammaLam_, moment); | ||
88 | return mixingK; | ||
84 | 89 | } | } |
85 | 90 | ||
86 | 91 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/noMixingKernel/noMixingKernel.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.H (similarity 76%) (mode: 100644) (index d122951..90c3654) | |||
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-2018 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 | Interaction by exchange with the mean mixing model. | ||
25 | Foam::mixingSubModels::mixingKernels::noMixingKernel | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | Kolmogorov scale. | ||
31 | |||
32 | References | ||
33 | \verbatim | ||
34 | "Computational Models for Turbulent Reacting Flows" | ||
35 | R O Fox | ||
36 | Cambridge University Press | ||
37 | \endverbatim | ||
28 | Empty mixing model. | ||
38 | 29 | ||
39 | 30 | SourceFiles | SourceFiles |
40 | IEM.C | ||
31 | noMixingKernel.C | ||
41 | 32 | ||
42 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
43 | 34 | ||
44 | #ifndef IEM_H | ||
45 | #define IEM_H | ||
35 | #ifndef noMixingKernel_H | ||
36 | #define noMixingKernel_H | ||
46 | 37 | ||
47 | 38 | #include "mixingKernel.H" | #include "mixingKernel.H" |
48 | 39 | ||
... | ... | namespace mixingKernels | |
56 | 47 | { | { |
57 | 48 | ||
58 | 49 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
59 | Class IEM Declaration | ||
50 | Class noMixingKernel Declaration | ||
60 | 51 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
61 | 52 | ||
62 | class IEM | ||
53 | class noMixingKernel | ||
63 | 54 | : | : |
64 | 55 | public mixingKernel | public mixingKernel |
65 | 56 | { | { |
66 | 57 | public: | public: |
67 | 58 | ||
68 | 59 | //- Runtime type information | //- Runtime type information |
69 | TypeName("IEM"); | ||
60 | TypeName("none"); | ||
70 | 61 | ||
71 | 62 | ||
72 | 63 | // Constructors | // Constructors |
73 | 64 | ||
74 | 65 | //- Construct from components | //- Construct from components |
75 | IEM(const dictionary& dict); | ||
66 | noMixingKernel(const dictionary& dict); | ||
76 | 67 | ||
77 | 68 | ||
78 | 69 | //- Destructor | //- Destructor |
79 | virtual ~IEM(); | ||
70 | virtual ~noMixingKernel(); | ||
80 | 71 | ||
81 | 72 | ||
82 | 73 | // Member Functions | // Member Functions |
83 | 74 | ||
84 | //- Aggregation kernel | ||
75 | //- Mixing kernel | ||
85 | 76 | virtual tmp<fvScalarMatrix> K | virtual tmp<fvScalarMatrix> K |
86 | 77 | ( | ( |
87 | 78 | const volUnivariateMoment& moment, | const volUnivariateMoment& moment, |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.C changed (mode: 100644) (index 2c8834d..5672d69) | |||
... | ... | Foam::mixingModels::noMixing::noMixing | |
48 | 48 | ( | ( |
49 | 49 | const word& name, | const word& name, |
50 | 50 | const dictionary& dict, | const dictionary& dict, |
51 | const volVectorField& U, | ||
52 | 51 | const surfaceScalarField& phi | const surfaceScalarField& phi |
53 | 52 | ) | ) |
54 | 53 | : | : |
55 | mixingModel(name, dict, U, phi), | ||
54 | mixingModel(name, dict, phi), | ||
56 | 55 | name_(name) | name_(name) |
57 | 56 | {} | {} |
58 | 57 | ||
... | ... | void Foam::mixingModels::noMixing::solve() | |
70 | 69 | return; | return; |
71 | 70 | } | } |
72 | 71 | ||
72 | Foam::scalar Foam::mixingModels::noMixing::realizableCo() | ||
73 | { | ||
74 | return 1.0; | ||
75 | } | ||
76 | |||
73 | 77 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H changed (mode: 100644) (index 9254c4b..63c8f61) | |||
... | ... | public: | |
71 | 71 | ( | ( |
72 | 72 | const word& name, | const word& name, |
73 | 73 | const dictionary& dict, | const dictionary& dict, |
74 | const volVectorField& U, | ||
75 | 74 | const surfaceScalarField& phi | const surfaceScalarField& phi |
76 | 75 | ); | ); |
77 | 76 | ||
... | ... | public: | |
81 | 80 | ||
82 | 81 | // Member Functions | // Member Functions |
83 | 82 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
85 | |||
84 | 86 | //- Solve mixing model | //- Solve mixing model |
85 | 87 | void solve(); | void solve(); |
86 | 88 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.C changed (mode: 100644) (index 0f02056..276bf45) | |||
... | ... | Foam::PDFTransportModels::mixingModels::turbulentMixing::turbulentMixing | |
51 | 51 | ( | ( |
52 | 52 | const word& name, | const word& name, |
53 | 53 | const dictionary& dict, | const dictionary& dict, |
54 | const volVectorField& U, | ||
55 | 54 | const surfaceScalarField& phi | const surfaceScalarField& phi |
56 | 55 | ) | ) |
57 | 56 | : | : |
58 | univariatePDFTransportModel(name, dict, U.mesh(), U, phi, "01"), | ||
59 | mixingModel(name, dict, U, phi), | ||
57 | univariatePDFTransportModel(name, dict, phi.mesh(), phi, "01"), | ||
58 | mixingModel(name, dict, phi), | ||
60 | 59 | name_(name), | name_(name), |
61 | 60 | mixingKernel_ | mixingKernel_ |
62 | 61 | ( | ( |
... | ... | Foam::PDFTransportModels::mixingModels::turbulentMixing | |
106 | 105 | IOobject | IOobject |
107 | 106 | ( | ( |
108 | 107 | "gSource", | "gSource", |
109 | U_.mesh().time().timeName(), | ||
110 | U_.mesh(), | ||
108 | phi_.mesh().time().timeName(), | ||
109 | phi_.mesh(), | ||
111 | 110 | IOobject::NO_READ, | IOobject::NO_READ, |
112 | 111 | IOobject::NO_WRITE, | IOobject::NO_WRITE, |
113 | 112 | false | false |
114 | 113 | ), | ), |
115 | U_.mesh(), | ||
114 | phi_.mesh(), | ||
116 | 115 | dimensionedScalar("zero", moment.dimensions()/dimTime, 0.0) | dimensionedScalar("zero", moment.dimensions()/dimTime, 0.0) |
117 | 116 | ) | ) |
118 | 117 | ); | ); |
... | ... | Foam::PDFTransportModels::mixingModels::turbulentMixing | |
120 | 119 | return gSource; | return gSource; |
121 | 120 | } | } |
122 | 121 | ||
122 | void Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
123 | ::explicitMomentSource() | ||
124 | {} | ||
125 | |||
123 | 126 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
124 | Foam::PDFTransportModels::mixingModels::turbulentMixing | ||
125 | ::momentSource | ||
127 | Foam::PDFTransportModels::mixingModels::turbulentMixing::implicitMomentSource | ||
126 | 128 | ( | ( |
127 | 129 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
128 | 130 | ) | ) |
... | ... | Foam::PDFTransportModels::mixingModels::turbulentMixing | |
132 | 134 | return mixingKernel_->K(moment, moments); | return mixingKernel_->K(moment, moments); |
133 | 135 | } | } |
134 | 136 | ||
137 | Foam::scalar | ||
138 | Foam::PDFTransportModels::mixingModels::turbulentMixing::cellMomentSource | ||
139 | ( | ||
140 | label& momentOrder, | ||
141 | label& celli | ||
142 | ) | ||
143 | { | ||
144 | return 0.0; | ||
145 | } | ||
146 | |||
147 | Foam::scalar Foam::PDFTransportModels::mixingModels::turbulentMixing::realizableCo | ||
148 | () | ||
149 | { | ||
150 | return univariatePDFTransportModel::realizableCo(); | ||
151 | } | ||
152 | |||
135 | 153 | void Foam::PDFTransportModels::mixingModels::turbulentMixing::solve | void Foam::PDFTransportModels::mixingModels::turbulentMixing::solve |
136 | 154 | () | () |
137 | 155 | { | { |
File multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.H changed (mode: 100644) (index b11ca47..a39476c) | |||
... | ... | class turbulentMixing | |
87 | 87 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
88 | 88 | ); | ); |
89 | 89 | ||
90 | //- Calculate source terms | ||
91 | virtual tmp<fvScalarMatrix> momentSource | ||
90 | //- Calculate explicit source terms | ||
91 | virtual void explicitMomentSource(); | ||
92 | |||
93 | //- Calculate implicit source terms | ||
94 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
92 | 95 | ( | ( |
93 | 96 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
94 | 97 | ); | ); |
95 | 98 | ||
99 | //- Calculate source term for moment equation in the specified cell | ||
100 | virtual scalar cellMomentSource | ||
101 | ( | ||
102 | label& momentOrder, | ||
103 | label& celli | ||
104 | ); | ||
105 | |||
96 | 106 | ||
97 | 107 | public: | public: |
98 | 108 | ||
... | ... | public: | |
107 | 117 | ( | ( |
108 | 118 | const word& name, | const word& name, |
109 | 119 | const dictionary& dict, | const dictionary& dict, |
110 | const volVectorField& U, | ||
111 | 120 | const surfaceScalarField& phi | const surfaceScalarField& phi |
112 | 121 | ); | ); |
113 | 122 | ||
... | ... | public: | |
117 | 126 | ||
118 | 127 | // Member Functions | // Member Functions |
119 | 128 | ||
129 | //- Return the maximum Courant number ensuring moment realizability | ||
130 | scalar realizableCo(); | ||
131 | |||
120 | 132 | //- Solve mixing model | //- Solve mixing model |
121 | 133 | void solve(); | void solve(); |
122 | 134 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/Make/files added (mode: 100644) (index 0000000..4e03be0) | |||
1 | univariateMomentAdvection/univariateMomentAdvection.C | ||
2 | univariateMomentAdvection/newUnivariateMomentAdvection.C | ||
3 | |||
4 | firstOrderKinetic/firstOrderKinetic.C | ||
5 | noAdvection/noAdvection.C | ||
6 | zeta/zeta.C | ||
7 | |||
8 | LIB = $(FOAM_USER_LIBBIN)/libmomentAdvection |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/Make/options added (mode: 100644) (index 0000000..17bd1f4) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I$(LIB_SRC)/meshTools/lnInclude \ | ||
4 | -I../../mappedList \ | ||
5 | -I../quadratureNode \ | ||
6 | -I../moments \ | ||
7 | -I../momentSets/lnInclude \ | ||
8 | -I../momentInversion/univariate/basic/lnInclude \ | ||
9 | -I../fieldMomentInversion/lnInclude \ | ||
10 | -I../quadratureApproximations/lnInclude | ||
11 | |||
12 | LIB_LIBS = \ | ||
13 | -lfiniteVolume \ | ||
14 | -lmeshTools \ | ||
15 | -L$(FOAM_USER_LIBBIN) \ | ||
16 | -lmomentSets \ | ||
17 | -lmomentInversion \ | ||
18 | -lfieldMomentInversion \ | ||
19 | -lquadratureApproximation | ||
20 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/firstOrderKinetic/firstOrderKinetic.C added (mode: 100644) (index 0000000..f2fcdbb) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | #include "firstOrderKinetic.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | defineTypeNameAndDebug(firstOrderKinetic, 0); | ||
34 | |||
35 | addToRunTimeSelectionTable | ||
36 | ( | ||
37 | univariateMomentAdvection, | ||
38 | firstOrderKinetic, | ||
39 | dictionary | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
44 | |||
45 | Foam::firstOrderKinetic::firstOrderKinetic | ||
46 | ( | ||
47 | const dictionary& dict, | ||
48 | const univariateQuadratureApproximation& quadrature, | ||
49 | const surfaceScalarField& phi, | ||
50 | const word& support | ||
51 | ) | ||
52 | : | ||
53 | univariateMomentAdvection(dict, quadrature, phi, support), | ||
54 | nodes_(), | ||
55 | nodesNei_(), | ||
56 | nodesOwn_(), | ||
57 | momentsNei_ | ||
58 | ( | ||
59 | name_, nMoments_, nodesNei_, nDimensions_, moments_.momentMap(), support | ||
60 | ), | ||
61 | momentsOwn_ | ||
62 | ( | ||
63 | name_, nMoments_, nodesOwn_, nDimensions_, moments_.momentMap(), support | ||
64 | ), | ||
65 | momentFieldInverter_ | ||
66 | ( | ||
67 | new basicFieldMomentInversion | ||
68 | ( | ||
69 | quadrature.subDict("momentAdvection"), | ||
70 | nMoments_, | ||
71 | 0 | ||
72 | ) | ||
73 | ) | ||
74 | { | ||
75 | if (nMoments_ % 2 == 0) | ||
76 | { | ||
77 | nNodes_ = nMoments_/2; | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | nNodes_ = (nMoments_ - 1)/2 + 1; | ||
82 | } | ||
83 | |||
84 | nodes_ = autoPtr<PtrList<volScalarNode>> | ||
85 | ( | ||
86 | new PtrList<volScalarNode>(nNodes_) | ||
87 | ); | ||
88 | |||
89 | nodesNei_ = autoPtr<PtrList<surfaceScalarNode>> | ||
90 | ( | ||
91 | new PtrList<surfaceScalarNode>(nNodes_) | ||
92 | ); | ||
93 | |||
94 | nodesOwn_ = autoPtr<PtrList<surfaceScalarNode>> | ||
95 | ( | ||
96 | new PtrList<surfaceScalarNode>(nNodes_) | ||
97 | ); | ||
98 | |||
99 | PtrList<volScalarNode>& nodes = nodes_(); | ||
100 | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | ||
101 | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
102 | |||
103 | // Populating nodes and interpolated nodes | ||
104 | forAll(nodes, nodei) | ||
105 | { | ||
106 | nodes.set | ||
107 | ( | ||
108 | nodei, | ||
109 | new volScalarNode | ||
110 | ( | ||
111 | "nodeAdvection" + Foam::name(nodei), | ||
112 | name_, | ||
113 | moments_[0].mesh(), | ||
114 | moments_[0].dimensions(), | ||
115 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
116 | false | ||
117 | ) | ||
118 | ); | ||
119 | |||
120 | nodesNei.set | ||
121 | ( | ||
122 | nodei, | ||
123 | new surfaceScalarNode | ||
124 | ( | ||
125 | "nodeRadau" + Foam::name(nodei) + "Nei", | ||
126 | name_, | ||
127 | moments_[0].mesh(), | ||
128 | moments_[0].dimensions(), | ||
129 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
130 | false | ||
131 | ) | ||
132 | ); | ||
133 | |||
134 | nodesOwn.set | ||
135 | ( | ||
136 | nodei, | ||
137 | new surfaceScalarNode | ||
138 | ( | ||
139 | "nodeRadau" + Foam::name(nodei) + "Own", | ||
140 | name_, | ||
141 | moments_[0].mesh(), | ||
142 | moments_[0].dimensions(), | ||
143 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
144 | false | ||
145 | ) | ||
146 | ); | ||
147 | } | ||
148 | |||
149 | // Setting face values of moments | ||
150 | forAll(momentsNei_, momenti) | ||
151 | { | ||
152 | momentsNei_.set | ||
153 | ( | ||
154 | momenti, | ||
155 | new Foam::surfaceUnivariateMoment | ||
156 | ( | ||
157 | name_, | ||
158 | moments_[momenti].cmptOrders(), | ||
159 | nodesNei_, | ||
160 | fvc::interpolate(moments_[momenti]) | ||
161 | ) | ||
162 | ); | ||
163 | |||
164 | momentsOwn_.set | ||
165 | ( | ||
166 | momenti, | ||
167 | new Foam::surfaceUnivariateMoment | ||
168 | ( | ||
169 | name_, | ||
170 | moments_[momenti].cmptOrders(), | ||
171 | nodesOwn_, | ||
172 | fvc::interpolate(moments_[momenti]) | ||
173 | ) | ||
174 | ); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | |||
179 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
180 | |||
181 | Foam::firstOrderKinetic::~firstOrderKinetic() | ||
182 | {} | ||
183 | |||
184 | |||
185 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
186 | |||
187 | void Foam::firstOrderKinetic::interpolateNodes() | ||
188 | { | ||
189 | const PtrList<volScalarNode>& nodes = nodes_(); | ||
190 | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | ||
191 | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
192 | |||
193 | forAll(nodes, rNodei) | ||
194 | { | ||
195 | const volScalarNode& node(nodes[rNodei]); | ||
196 | surfaceScalarNode& nodeNei(nodesNei[rNodei]); | ||
197 | surfaceScalarNode& nodeOwn(nodesOwn[rNodei]); | ||
198 | |||
199 | nodeOwn.primaryWeight() = | ||
200 | fvc::interpolate(node.primaryWeight(), own_, "reconstruct(weight)"); | ||
201 | |||
202 | nodeOwn.primaryAbscissa() = | ||
203 | fvc::interpolate | ||
204 | ( | ||
205 | node.primaryAbscissa(), | ||
206 | own_, | ||
207 | "reconstruct(abscissa)" | ||
208 | ); | ||
209 | |||
210 | nodeNei.primaryWeight() = | ||
211 | fvc::interpolate(node.primaryWeight(), nei_, "reconstruct(weight)"); | ||
212 | |||
213 | nodeNei.primaryAbscissa() = | ||
214 | fvc::interpolate | ||
215 | ( | ||
216 | node.primaryAbscissa(), | ||
217 | nei_, | ||
218 | "reconstruct(abscissa)" | ||
219 | ); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | Foam::scalar Foam::firstOrderKinetic::realizableCo() | ||
224 | { | ||
225 | // Returning 1 because the restriction of this scheme is the same CFL | ||
226 | // condition of the main scheme. | ||
227 | return 1.0; | ||
228 | } | ||
229 | |||
230 | void Foam::firstOrderKinetic::update() | ||
231 | { | ||
232 | momentFieldInverter_().invert(moments_, nodes_()); | ||
233 | interpolateNodes(); | ||
234 | momentsNei_.update(); | ||
235 | momentsOwn_.update(); | ||
236 | |||
237 | dimensionedScalar zeroPhi("zero", phi_.dimensions(), 0.0); | ||
238 | |||
239 | forAll(divMoments_, divi) | ||
240 | { | ||
241 | volScalarField divMoment | ||
242 | ( | ||
243 | IOobject | ||
244 | ( | ||
245 | "divMoment", | ||
246 | moments_[0].mesh().time().timeName(), | ||
247 | moments_[0].mesh(), | ||
248 | IOobject::NO_READ, | ||
249 | IOobject::NO_WRITE, | ||
250 | false | ||
251 | ), | ||
252 | moments_[0].mesh(), | ||
253 | dimensionedScalar("zero", dimless, 0.0) | ||
254 | ); | ||
255 | |||
256 | surfaceScalarField mFlux | ||
257 | ( | ||
258 | momentsNei_[divi]*min(phi_, zeroPhi) | ||
259 | + momentsOwn_[divi]*max(phi_, zeroPhi) | ||
260 | ); | ||
261 | |||
262 | fvc::surfaceIntegrate(divMoment.ref(), mFlux); | ||
263 | divMoment.ref().dimensions().reset(moments_[divi].dimensions()/dimTime); | ||
264 | |||
265 | divMoments_[divi].replace(0, divMoment); | ||
266 | } | ||
267 | } | ||
268 | |||
269 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/firstOrderKinetic/firstOrderKinetic.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/turbulentMixing/turbulentMixing.H (similarity 51%) (mode: 100644) (index b11ca47..0f51db0) | |||
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) 2014-2017 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:turbulentMixing | ||
25 | Foam::firstOrderKinetic | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Solve a turbulent mixing model. | ||
28 | First-order univariate moment advection with kinetic scheme. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | turbulentMixing.C | ||
31 | firstOrderKinetic.C | ||
32 | firstOrderKineticI.H | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef turbulentMixing_H | ||
36 | #define turbulentMixing_H | ||
36 | #ifndef firstOrderKinetic_H | ||
37 | #define firstOrderKinetic_H | ||
38 | |||
39 | #include "univariateMomentAdvection.H" | ||
37 | 40 | ||
38 | #include "univariatePDFTransportModel.H" | ||
39 | #include "mixingModel.H" | ||
40 | #include "mixingKernel.H" | ||
41 | #include "diffusionModel.H" | ||
42 | 41 | ||
43 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
44 | 43 | ||
45 | 44 | namespace Foam | namespace Foam |
46 | 45 | { | { |
47 | namespace PDFTransportModels | ||
48 | { | ||
49 | namespace mixingModels | ||
50 | { | ||
51 | 46 | ||
52 | 47 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
53 | Class mixingModel Declaration | ||
48 | Class firstOrderKinetic Declaration | ||
54 | 49 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
55 | 50 | ||
56 | class turbulentMixing | ||
51 | class firstOrderKinetic | ||
57 | 52 | : | : |
58 | public univariatePDFTransportModel, public mixingModel | ||
53 | public univariateMomentAdvection | ||
59 | 54 | { | { |
60 | 55 | // Private data | // Private data |
61 | 56 | ||
62 | const word name_; | ||
57 | //- List of quadrature nodes used for moment advection | ||
58 | autoPtr<PtrList<volScalarNode>> nodes_; | ||
63 | 59 | ||
64 | //- Aggregation kernel model | ||
65 | autoPtr | ||
66 | < | ||
67 | Foam::mixingSubModels::mixingKernel | ||
68 | > mixingKernel_; | ||
60 | //- List of interpolated nodes (neighbour) | ||
61 | autoPtr<PtrList<surfaceScalarNode>> nodesNei_; | ||
69 | 62 | ||
70 | //- Diffusion model | ||
71 | autoPtr | ||
72 | < | ||
73 | Foam::mixingSubModels::diffusionModel | ||
74 | > diffusionModel_; | ||
63 | //- List of interpolated nodes (owner) | ||
64 | autoPtr<PtrList<surfaceScalarNode>> nodesOwn_; | ||
75 | 65 | ||
76 | // Private member functions | ||
66 | //- List of interpolated moments (neighbour) | ||
67 | surfaceUnivariateMomentFieldSet momentsNei_; | ||
77 | 68 | ||
78 | //- Diffusion term | ||
79 | virtual tmp<fvScalarMatrix> momentDiffusion | ||
80 | ( | ||
81 | const volUnivariateMoment& moment | ||
82 | ); | ||
69 | //- List of interpolated moments (owner) | ||
70 | surfaceUnivariateMomentFieldSet momentsOwn_; | ||
83 | 71 | ||
84 | //- Convect moments in phase space | ||
85 | virtual tmp<volScalarField> phaseSpaceConvection | ||
86 | ( | ||
87 | const volUnivariateMoment& moment | ||
88 | ); | ||
72 | //- Flux moment inversion method | ||
73 | autoPtr<basicFieldMomentInversion> momentFieldInverter_; | ||
89 | 74 | ||
90 | //- Calculate source terms | ||
91 | virtual tmp<fvScalarMatrix> momentSource | ||
92 | ( | ||
93 | const volUnivariateMoment& moment | ||
94 | ); | ||
75 | //- Number of nodes used for advection | ||
76 | label nNodes_; | ||
77 | |||
78 | |||
79 | protected: | ||
80 | |||
81 | //- Protected member functions | ||
82 | void interpolateNodes(); | ||
95 | 83 | ||
96 | 84 | ||
97 | 85 | public: | public: |
98 | 86 | ||
99 | 87 | //- Runtime type information | //- Runtime type information |
100 | TypeName("turbulentMixing"); | ||
88 | TypeName("firstOrderKinetic"); | ||
101 | 89 | ||
102 | 90 | ||
103 | 91 | // Constructors | // Constructors |
104 | 92 | ||
105 | //- Construct from components | ||
106 | turbulentMixing | ||
93 | //- Construct from univariateMomentSet | ||
94 | firstOrderKinetic | ||
107 | 95 | ( | ( |
108 | const word& name, | ||
109 | 96 | const dictionary& dict, | const dictionary& dict, |
110 | const volVectorField& U, | ||
111 | const surfaceScalarField& phi | ||
97 | const univariateQuadratureApproximation& quadrature, | ||
98 | const surfaceScalarField& phi, | ||
99 | const word& support | ||
112 | 100 | ); | ); |
113 | 101 | ||
114 | 102 | ||
115 | 103 | //- Destructor | //- Destructor |
116 | virtual ~turbulentMixing(); | ||
104 | virtual ~firstOrderKinetic(); | ||
105 | |||
117 | 106 | ||
118 | // Member Functions | ||
107 | // Public member functions | ||
119 | 108 | ||
120 | //- Solve mixing model | ||
121 | void solve(); | ||
109 | //- Return the maximum Courant number ensuring moment realizability | ||
110 | virtual scalar realizableCo(); | ||
111 | |||
112 | //- Update moment advection | ||
113 | virtual void update(); | ||
122 | 114 | }; | }; |
123 | 115 | ||
124 | 116 | ||
125 | 117 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
126 | 118 | ||
127 | } // End namespace mixingModels | ||
128 | } // End namespace univariatePDFTransportModel | ||
129 | 119 | } // End namespace Foam | } // End namespace Foam |
130 | 120 | ||
121 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
122 | |||
123 | |||
131 | 124 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
132 | 125 | ||
133 | 126 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/noAdvection/noAdvection.C copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.C (similarity 73%) (mode: 100644) (index 2c8834d..5ed654c) | |||
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) 2014-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noMixing.H" | ||
26 | #include "noAdvection.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 mixingModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(noMixing, 0); | ||
33 | defineTypeNameAndDebug(noAdvection, 0); | ||
34 | |||
36 | 35 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
37 | 36 | ( | ( |
38 | mixingModel, | ||
39 | noMixing, | ||
37 | univariateMomentAdvection, | ||
38 | noAdvection, | ||
40 | 39 | dictionary | dictionary |
41 | 40 | ); | ); |
42 | 41 | } | } |
43 | } | ||
44 | 42 | ||
45 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
46 | 44 | ||
47 | Foam::mixingModels::noMixing::noMixing | ||
45 | Foam::noAdvection::noAdvection | ||
48 | 46 | ( | ( |
49 | const word& name, | ||
50 | 47 | const dictionary& dict, | const dictionary& dict, |
51 | const volVectorField& U, | ||
52 | const surfaceScalarField& phi | ||
48 | const univariateQuadratureApproximation& quadrature, | ||
49 | const surfaceScalarField& phi, | ||
50 | const word& support | ||
53 | 51 | ) | ) |
54 | 52 | : | : |
55 | mixingModel(name, dict, U, phi), | ||
56 | name_(name) | ||
53 | univariateMomentAdvection(dict, quadrature, phi, support) | ||
57 | 54 | {} | {} |
58 | 55 | ||
59 | 56 | ||
60 | 57 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
61 | 58 | ||
62 | Foam::mixingModels::noMixing::~noMixing() | ||
59 | Foam::noAdvection::~noAdvection() | ||
63 | 60 | {} | {} |
64 | 61 | ||
65 | 62 | ||
66 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
63 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
64 | |||
65 | Foam::scalar Foam::noAdvection::realizableCo() | ||
66 | { | ||
67 | return scalar(1); | ||
68 | } | ||
67 | 69 | ||
68 | void Foam::mixingModels::noMixing::solve() | ||
70 | void Foam::noAdvection::update() | ||
69 | 71 | { | { |
70 | 72 | return; | return; |
71 | 73 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/noAdvection/noAdvection.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 66%) (mode: 100644) (index 9254c4b..f97d6fa) | |||
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) 2014-2017 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::noAdvection | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Empty scheme for cases without moment advection. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | noAdvection.C | ||
32 | noAdvectionI.H | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
36 | #ifndef noAdvection_H | ||
37 | #define noAdvection_H | ||
38 | |||
39 | #include "univariateMomentAdvection.H" | ||
37 | 40 | ||
38 | #include "mixingModel.H" | ||
39 | 41 | ||
40 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 43 | ||
42 | 44 | namespace Foam | namespace Foam |
43 | 45 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | 46 | ||
47 | 47 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
48 | Class noAdvection Declaration | ||
49 | 49 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 50 | ||
51 | class noMixing | ||
51 | class noAdvection | ||
52 | 52 | : | : |
53 | public mixingModel | ||
53 | public univariateMomentAdvection | ||
54 | 54 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 55 | public: | public: |
62 | 56 | ||
63 | 57 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
58 | TypeName("noAdvection"); | ||
65 | 59 | ||
66 | 60 | ||
67 | 61 | // Constructors | // Constructors |
68 | 62 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
63 | //- Construct from univariateMomentSet | ||
64 | noAdvection | ||
71 | 65 | ( | ( |
72 | const word& name, | ||
73 | 66 | const dictionary& dict, | const dictionary& dict, |
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
67 | const univariateQuadratureApproximation& quadrature, | ||
68 | const surfaceScalarField& phi, | ||
69 | const word& support | ||
76 | 70 | ); | ); |
77 | 71 | ||
78 | 72 | ||
79 | 73 | //- Destructor | //- Destructor |
80 | virtual ~noMixing(); | ||
74 | virtual ~noAdvection(); | ||
81 | 75 | ||
82 | // Member Functions | ||
83 | 76 | ||
84 | //- Solve mixing model | ||
85 | void solve(); | ||
77 | // Public member functions | ||
78 | |||
79 | //- Return the maximum Courant number ensuring moment realizability | ||
80 | virtual scalar realizableCo(); | ||
81 | |||
82 | //- Update moment advection | ||
83 | virtual void update(); | ||
86 | 84 | }; | }; |
87 | 85 | ||
88 | 86 | ||
89 | 87 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
90 | 88 | ||
91 | } // End namespace mixingModels | ||
92 | 89 | } // End namespace Foam | } // End namespace Foam |
93 | 90 | ||
91 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
92 | |||
93 | |||
94 | 94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
95 | 95 | ||
96 | 96 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariateMomentAdvection/newUnivariateMomentAdvection.C copied from file multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/newExtendedMomentInversion.C (similarity 65%) (mode: 100644) (index 8a0f1ec..182cb00) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "extendedMomentInversion.H" | ||
26 | #include "univariateMomentAdvection.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // |
29 | 29 | ||
30 | Foam::autoPtr<Foam::extendedMomentInversion> Foam::extendedMomentInversion::New | ||
30 | Foam::autoPtr<Foam::univariateMomentAdvection> | ||
31 | Foam::univariateMomentAdvection::New | ||
31 | 32 | ( | ( |
32 | 33 | const dictionary& dict, | const dictionary& dict, |
33 | const label nMoments, | ||
34 | const label nSecondaryNodes | ||
34 | const univariateQuadratureApproximation& quadrature, | ||
35 | const surfaceScalarField& phi, | ||
36 | const word& support | ||
35 | 37 | ) | ) |
36 | 38 | { | { |
37 | word extendedMomentInversionType(dict.lookup("extendedMomentInversion")); | ||
39 | word univariateMomentAdvectionType | ||
40 | ( | ||
41 | dict.lookup("univariateMomentAdvection") | ||
42 | ); | ||
38 | 43 | ||
39 | Info<< "Selecting extendedMomentInversion: " | ||
40 | << extendedMomentInversionType << endl; | ||
44 | Info<< "Selecting univariateMomentAdvection: " | ||
45 | << univariateMomentAdvectionType << endl; | ||
41 | 46 | ||
42 | 47 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
43 | dictionaryConstructorTablePtr_->find(extendedMomentInversionType); | ||
48 | dictionaryConstructorTablePtr_->find(univariateMomentAdvectionType); | ||
44 | 49 | ||
45 | 50 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
46 | 51 | { | { |
47 | 52 | FatalErrorInFunction | FatalErrorInFunction |
48 | << "Unknown extendedMomentInversionType type " | ||
49 | << extendedMomentInversionType << endl << endl | ||
50 | << "Valid extendedMomentInversion types are : " << endl | ||
53 | << "Unknown univariateMomentAdvection type " | ||
54 | << univariateMomentAdvectionType << endl << endl | ||
55 | << "Valid univariateMomentAdvection types are : " << endl | ||
51 | 56 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
52 | 57 | << exit(FatalError); | << exit(FatalError); |
53 | 58 | } | } |
54 | 59 | ||
55 | return cstrIter()(dict, nMoments, nSecondaryNodes); | ||
60 | return cstrIter()(dict, quadrature, phi, support); | ||
56 | 61 | } | } |
57 | 62 | ||
58 | 63 |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariateMomentAdvection/univariateMomentAdvection.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.C (similarity 51%) (mode: 100644) (index 31f6fbb..1499ce4) | |||
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) 2014-2017 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" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
26 | #include "univariateMomentAdvection.H" | ||
27 | #include "IOmanip.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(constantAggregation, 0); | ||
38 | |||
39 | addToRunTimeSelectionTable | ||
40 | ( | ||
41 | aggregationKernel, | ||
42 | constantAggregation, | ||
43 | dictionary | ||
44 | ); | ||
45 | } | ||
33 | defineTypeNameAndDebug(univariateMomentAdvection, 0); | ||
34 | defineRunTimeSelectionTable(univariateMomentAdvection, dictionary); | ||
46 | 35 | } | } |
47 | } | ||
48 | |||
49 | 36 | ||
50 | 37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
51 | 38 | ||
52 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
53 | ::constantAggregation | ||
39 | Foam::univariateMomentAdvection::univariateMomentAdvection | ||
54 | 40 | ( | ( |
55 | const dictionary& dict | ||
41 | const dictionary& dict, | ||
42 | const univariateQuadratureApproximation& quadrature, | ||
43 | const surfaceScalarField& phi, | ||
44 | const word& support | ||
56 | 45 | ) | ) |
57 | 46 | : | : |
58 | aggregationKernel(dict) | ||
59 | {} | ||
60 | |||
61 | |||
62 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
63 | |||
64 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | ||
65 | ::~constantAggregation() | ||
66 | {} | ||
67 | |||
68 | |||
69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
70 | |||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka | ||
73 | ( | ||
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
76 | ) const | ||
77 | { | ||
78 | return | ||
79 | tmp<volScalarField> | ||
47 | name_(quadrature.name()), | ||
48 | moments_(quadrature.moments()), | ||
49 | nMoments_(moments_.size()), | ||
50 | divMoments_(nMoments_), | ||
51 | own_ | ||
52 | ( | ||
53 | IOobject | ||
54 | ( | ||
55 | "own", | ||
56 | moments_[0].mesh().time().timeName(), | ||
57 | moments_[0].mesh() | ||
58 | ), | ||
59 | moments_[0].mesh(), | ||
60 | dimensionedScalar("own", dimless, 1.0) | ||
61 | ), | ||
62 | nei_ | ||
63 | ( | ||
64 | IOobject | ||
80 | 65 | ( | ( |
66 | "nei", | ||
67 | moments_[0].mesh().time().timeName(), | ||
68 | moments_[0].mesh() | ||
69 | ), | ||
70 | moments_[0].mesh(), | ||
71 | dimensionedScalar("nei", dimless, -1.0) | ||
72 | ), | ||
73 | phi_(phi), | ||
74 | support_(support), | ||
75 | nDimensions_(1) | ||
76 | { | ||
77 | forAll(divMoments_, momenti) | ||
78 | { | ||
79 | divMoments_.set | ||
80 | ( | ||
81 | momenti, | ||
81 | 82 | new volScalarField | new volScalarField |
82 | 83 | ( | ( |
83 | 84 | IOobject | IOobject |
84 | 85 | ( | ( |
85 | "constantAggregationK", | ||
86 | abscissa1.mesh().time().timeName(), | ||
87 | abscissa1.mesh() | ||
86 | "divMoment" + Foam::name(momenti) + name_, | ||
87 | moments_[0].mesh().time().timeName(), | ||
88 | moments_[0].mesh(), | ||
89 | IOobject::NO_READ, | ||
90 | IOobject::NO_WRITE, | ||
91 | false | ||
88 | 92 | ), | ), |
89 | abscissa1.mesh(), | ||
93 | moments_[0].mesh(), | ||
90 | 94 | dimensionedScalar | dimensionedScalar |
91 | 95 | ( | ( |
92 | "constAggK", | ||
93 | pow3(abscissa1.dimensions())/dimTime, | ||
94 | Ca_.value() | ||
96 | "zero", moments_[momenti].dimensions()/dimTime, 0 | ||
95 | 97 | ) | ) |
96 | 98 | ) | ) |
97 | 99 | ); | ); |
100 | } | ||
98 | 101 | } | } |
99 | 102 | ||
103 | |||
104 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
105 | |||
106 | Foam::univariateMomentAdvection::~univariateMomentAdvection() | ||
107 | {} | ||
108 | |||
109 | |||
110 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
111 | |||
112 | |||
113 | |||
100 | 114 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariateMomentAdvection/univariateMomentAdvection.H added (mode: 100644) (index 0000000..875d358) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | Class | ||
25 | Foam::univariateMomentAdvection | ||
26 | |||
27 | Description | ||
28 | Abstract class for the advection of a univariate moment set. | ||
29 | |||
30 | SourceFiles | ||
31 | univariateMomentAdvection.C | ||
32 | univariateMomentAdvectionI.H | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef univariateMomentAdvection_H | ||
37 | #define univariateMomentAdvection_H | ||
38 | |||
39 | #include "fvCFD.H" | ||
40 | #include "IOdictionary.H" | ||
41 | #include "PtrList.H" | ||
42 | #include "fvMesh.H" | ||
43 | #include "volFields.H" | ||
44 | #include "surfaceFields.H" | ||
45 | #include "quadratureNodes.H" | ||
46 | #include "momentFieldSets.H" | ||
47 | #include "basicFieldMomentInversion.H" | ||
48 | #include "quadratureApproximations.H" | ||
49 | |||
50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
51 | |||
52 | namespace Foam | ||
53 | { | ||
54 | /*---------------------------------------------------------------------------*\ | ||
55 | Class univariateMomentAdvection Declaration | ||
56 | \*---------------------------------------------------------------------------*/ | ||
57 | |||
58 | class univariateMomentAdvection | ||
59 | { | ||
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 | protected: | ||
70 | |||
71 | // Protected data | ||
72 | |||
73 | //- Name of the distribution associated to the quadrature approximation. | ||
74 | const word name_; | ||
75 | |||
76 | //- Reference to the moments to advect | ||
77 | const volUnivariateMomentFieldSet& moments_; | ||
78 | |||
79 | //- Number of moments | ||
80 | const label nMoments_; | ||
81 | |||
82 | //- Advection terms for moment transport equations | ||
83 | PtrList<volScalarField> divMoments_; | ||
84 | |||
85 | //- Field used to find upwind values of the owner | ||
86 | surfaceScalarField own_; | ||
87 | |||
88 | //- Field used to find upwind values of the neighbour | ||
89 | surfaceScalarField nei_; | ||
90 | |||
91 | //- Conservative advection flux | ||
92 | const surfaceScalarField phi_; | ||
93 | |||
94 | //- Support of the distribution function | ||
95 | word support_; | ||
96 | |||
97 | //- Dimensions of the underlying distribution | ||
98 | label nDimensions_; | ||
99 | |||
100 | |||
101 | public: | ||
102 | |||
103 | //- Runtime type information | ||
104 | TypeName("univariateMomentAdvection"); | ||
105 | |||
106 | |||
107 | // Declare runtime construction | ||
108 | |||
109 | declareRunTimeSelectionTable | ||
110 | ( | ||
111 | autoPtr, | ||
112 | univariateMomentAdvection, | ||
113 | dictionary, | ||
114 | ( | ||
115 | const dictionary& dict, | ||
116 | const univariateQuadratureApproximation& quadrature, | ||
117 | const surfaceScalarField& phi, | ||
118 | const word& support | ||
119 | ), | ||
120 | (dict, quadrature, phi, support) | ||
121 | ); | ||
122 | |||
123 | |||
124 | // Constructors | ||
125 | |||
126 | //- Construct from univariateMomentSet | ||
127 | univariateMomentAdvection | ||
128 | ( | ||
129 | const dictionary& dict, | ||
130 | const univariateQuadratureApproximation& quadrature, | ||
131 | const surfaceScalarField& phi, | ||
132 | const word& support | ||
133 | ); | ||
134 | |||
135 | |||
136 | //- Destructor | ||
137 | virtual ~univariateMomentAdvection(); | ||
138 | |||
139 | |||
140 | // Selectors | ||
141 | |||
142 | static autoPtr<univariateMomentAdvection> New | ||
143 | ( | ||
144 | const dictionary& dict, | ||
145 | const univariateQuadratureApproximation& quadrature, | ||
146 | const surfaceScalarField& phi, | ||
147 | const word& support | ||
148 | ); | ||
149 | |||
150 | |||
151 | // Member Functions | ||
152 | |||
153 | //- Return the advection term for the moment transport equation | ||
154 | inline const PtrList<volScalarField>& divMoments() const; | ||
155 | |||
156 | //- Return the maximum Courant number ensuring moment realizability | ||
157 | virtual scalar realizableCo() = 0; | ||
158 | |||
159 | //- Update moment advection | ||
160 | virtual void update() = 0; | ||
161 | |||
162 | }; | ||
163 | |||
164 | |||
165 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
166 | |||
167 | } // End namespace Foam | ||
168 | |||
169 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
170 | |||
171 | #include "univariateMomentAdvectionI.H" | ||
172 | |||
173 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
174 | |||
175 | #endif | ||
176 | |||
177 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/univariateMomentAdvection/univariateMomentAdvectionI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H (similarity 85%) (mode: 100644 -> 100755) (index ddb0a21..e2a40ed) | |||
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) 2014-2017 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& | ||
29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | ||
28 | const Foam::PtrList<Foam::volScalarField>& | ||
29 | Foam::univariateMomentAdvection::divMoments() const | ||
30 | 30 | { | { |
31 | return quadrature_; | ||
31 | return divMoments_; | ||
32 | 32 | } | } |
33 | 33 | ||
34 | |||
35 | 34 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/zeta/zeta.C added (mode: 100644) (index 0000000..3215635) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | #include "zeta.H" | ||
27 | #include "upwind.H" | ||
28 | #include "addToRunTimeSelectionTable.H" | ||
29 | |||
30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
31 | |||
32 | namespace Foam | ||
33 | { | ||
34 | defineTypeNameAndDebug(zeta, 0); | ||
35 | |||
36 | addToRunTimeSelectionTable | ||
37 | ( | ||
38 | univariateMomentAdvection, | ||
39 | zeta, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
45 | |||
46 | Foam::zeta::zeta | ||
47 | ( | ||
48 | const dictionary& dict, | ||
49 | const univariateQuadratureApproximation& quadrature, | ||
50 | const surfaceScalarField& phi, | ||
51 | const word& support | ||
52 | ) | ||
53 | : | ||
54 | univariateMomentAdvection(dict, quadrature, phi, support), | ||
55 | m0_(moments_[0]), | ||
56 | m0Own_ | ||
57 | ( | ||
58 | "m0Own", | ||
59 | fvc::interpolate(m0_, own_, "reconstruct(m0)") | ||
60 | ), | ||
61 | m0Nei_ | ||
62 | ( | ||
63 | "m0Nei", | ||
64 | fvc::interpolate(m0_, nei_, "reconstruct(m0)") | ||
65 | ), | ||
66 | nZetas_(nMoments_ - 1), | ||
67 | zetas_(nZetas_), | ||
68 | zetasNei_(nZetas_), | ||
69 | zetasOwn_(nZetas_), | ||
70 | zetasUpwindNei_(nZetas_), | ||
71 | zetasUpwindOwn_(nZetas_), | ||
72 | zetasCorrNei_(nZetas_), | ||
73 | zetasCorrOwn_(nZetas_), | ||
74 | momentsNei_(nMoments_), | ||
75 | momentsOwn_(nMoments_), | ||
76 | nFacesOutgoingFlux_(m0_.mesh().nCells(), 0), | ||
77 | nRealizableMoments_(m0_.mesh().nCells(), 0), | ||
78 | nRealizableMomentsStar_(m0_.mesh().nCells(), 0), | ||
79 | limiters_(nZetas_), | ||
80 | cellLimiters_(nZetas_), | ||
81 | phi_(phi) | ||
82 | { | ||
83 | // Populating zeta_k fields and interpolated zeta_k fields | ||
84 | forAll(zetas_, zetai) | ||
85 | { | ||
86 | zetas_.set | ||
87 | ( | ||
88 | zetai, | ||
89 | new volScalarField | ||
90 | ( | ||
91 | IOobject | ||
92 | ( | ||
93 | IOobject::groupName | ||
94 | ( | ||
95 | IOobject::groupName("zeta", Foam::name(zetai)), | ||
96 | name_ | ||
97 | ), | ||
98 | phi.mesh().time().timeName(), | ||
99 | phi.mesh(), | ||
100 | IOobject::NO_READ, | ||
101 | IOobject::NO_WRITE | ||
102 | ), | ||
103 | phi.mesh(), | ||
104 | dimensionedScalar("zero", dimless, 0.0) | ||
105 | ) | ||
106 | ); | ||
107 | |||
108 | zetasNei_.set | ||
109 | ( | ||
110 | zetai, | ||
111 | new surfaceScalarField | ||
112 | ( | ||
113 | IOobject | ||
114 | ( | ||
115 | "zetaNei" + Foam::name(zetai), | ||
116 | phi.mesh().time().timeName(), | ||
117 | phi.mesh(), | ||
118 | IOobject::NO_READ, | ||
119 | IOobject::NO_WRITE | ||
120 | ), | ||
121 | phi.mesh(), | ||
122 | dimensionedScalar("zero", dimless, 0.0) | ||
123 | ) | ||
124 | ); | ||
125 | |||
126 | zetasOwn_.set | ||
127 | ( | ||
128 | zetai, | ||
129 | new surfaceScalarField | ||
130 | ( | ||
131 | IOobject | ||
132 | ( | ||
133 | "zetaOwn" + Foam::name(zetai), | ||
134 | phi.mesh().time().timeName(), | ||
135 | phi.mesh(), | ||
136 | IOobject::NO_READ, | ||
137 | IOobject::NO_WRITE | ||
138 | ), | ||
139 | phi.mesh(), | ||
140 | dimensionedScalar("zero", dimless, 0.0) | ||
141 | ) | ||
142 | ); | ||
143 | |||
144 | zetasUpwindNei_.set | ||
145 | ( | ||
146 | zetai, | ||
147 | new surfaceScalarField | ||
148 | ( | ||
149 | IOobject | ||
150 | ( | ||
151 | "zetaUpwindNei" + Foam::name(zetai), | ||
152 | phi.mesh().time().timeName(), | ||
153 | phi.mesh(), | ||
154 | IOobject::NO_READ, | ||
155 | IOobject::NO_WRITE | ||
156 | ), | ||
157 | phi.mesh(), | ||
158 | dimensionedScalar("zero", dimless, 0.0) | ||
159 | ) | ||
160 | ); | ||
161 | |||
162 | zetasUpwindOwn_.set | ||
163 | ( | ||
164 | zetai, | ||
165 | new surfaceScalarField | ||
166 | ( | ||
167 | IOobject | ||
168 | ( | ||
169 | "zetaUpwindOwn" + Foam::name(zetai), | ||
170 | phi.mesh().time().timeName(), | ||
171 | phi.mesh(), | ||
172 | IOobject::NO_READ, | ||
173 | IOobject::NO_WRITE | ||
174 | ), | ||
175 | phi.mesh(), | ||
176 | dimensionedScalar("zero", dimless, 0.0) | ||
177 | ) | ||
178 | ); | ||
179 | |||
180 | zetasCorrNei_.set | ||
181 | ( | ||
182 | zetai, | ||
183 | new surfaceScalarField | ||
184 | ( | ||
185 | IOobject | ||
186 | ( | ||
187 | "zetaCorrNei" + Foam::name(zetai), | ||
188 | phi.mesh().time().timeName(), | ||
189 | phi.mesh(), | ||
190 | IOobject::NO_READ, | ||
191 | IOobject::NO_WRITE | ||
192 | ), | ||
193 | phi.mesh(), | ||
194 | dimensionedScalar("zero", dimless, 0.0) | ||
195 | ) | ||
196 | ); | ||
197 | |||
198 | zetasCorrOwn_.set | ||
199 | ( | ||
200 | zetai, | ||
201 | new surfaceScalarField | ||
202 | ( | ||
203 | IOobject | ||
204 | ( | ||
205 | "zetaCorrOwn" + Foam::name(zetai), | ||
206 | phi.mesh().time().timeName(), | ||
207 | phi.mesh(), | ||
208 | IOobject::NO_READ, | ||
209 | IOobject::NO_WRITE | ||
210 | ), | ||
211 | phi.mesh(), | ||
212 | dimensionedScalar("zero", dimless, 0.0) | ||
213 | ) | ||
214 | ); | ||
215 | |||
216 | limiters_.set | ||
217 | ( | ||
218 | zetai, | ||
219 | new surfaceScalarField | ||
220 | ( | ||
221 | IOobject | ||
222 | ( | ||
223 | "zetaLimiters" + Foam::name(zetai), | ||
224 | phi.mesh().time().timeName(), | ||
225 | phi.mesh(), | ||
226 | IOobject::NO_READ, | ||
227 | IOobject::AUTO_WRITE | ||
228 | ), | ||
229 | phi.mesh(), | ||
230 | dimensionedScalar("zero", dimless, 1.0) | ||
231 | ) | ||
232 | ); | ||
233 | |||
234 | cellLimiters_.set | ||
235 | ( | ||
236 | zetai, | ||
237 | new volScalarField | ||
238 | ( | ||
239 | IOobject | ||
240 | ( | ||
241 | "zetaCellLimiters" + Foam::name(zetai), | ||
242 | phi.mesh().time().timeName(), | ||
243 | phi.mesh(), | ||
244 | IOobject::NO_READ, | ||
245 | IOobject::AUTO_WRITE | ||
246 | ), | ||
247 | phi.mesh(), | ||
248 | dimensionedScalar("zero", dimless, 1.0) | ||
249 | ) | ||
250 | ); | ||
251 | } | ||
252 | |||
253 | // Setting face values of moments | ||
254 | forAll(momentsNei_, momenti) | ||
255 | { | ||
256 | momentsNei_.set | ||
257 | ( | ||
258 | momenti, | ||
259 | new surfaceScalarField | ||
260 | ( | ||
261 | "momentNei" + Foam::name(momenti), | ||
262 | fvc::interpolate(moments_[momenti]) | ||
263 | ) | ||
264 | ); | ||
265 | |||
266 | momentsOwn_.set | ||
267 | ( | ||
268 | momenti, | ||
269 | new surfaceScalarField | ||
270 | ( | ||
271 | "momentOwn" + Foam::name(momenti), | ||
272 | fvc::interpolate(moments_[momenti]) | ||
273 | ) | ||
274 | ); | ||
275 | } | ||
276 | } | ||
277 | |||
278 | |||
279 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
280 | |||
281 | Foam::zeta::~zeta() | ||
282 | {} | ||
283 | |||
284 | |||
285 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
286 | |||
287 | void Foam::zeta::interpolateFields() | ||
288 | { | ||
289 | m0Own_ = fvc::interpolate(moments_[0], own_, "reconstruct(m0)"); | ||
290 | m0Nei_ = fvc::interpolate(moments_[0], nei_, "reconstruct(m0)"); | ||
291 | |||
292 | forAll(zetas_, zetai) | ||
293 | { | ||
294 | zetasNei_[zetai] = | ||
295 | fvc::interpolate(zetas_[zetai], nei_, "reconstruct(zeta)"); | ||
296 | |||
297 | zetasOwn_[zetai] = | ||
298 | fvc::interpolate(zetas_[zetai], own_, "reconstruct(zeta)"); | ||
299 | |||
300 | zetasUpwindNei_[zetai] = | ||
301 | upwind<scalar>(zetas_[zetai].mesh(), nei_).flux(zetas_[zetai]); | ||
302 | |||
303 | zetasUpwindOwn_[zetai] = | ||
304 | upwind<scalar>(zetas_[zetai].mesh(), own_).flux(zetas_[zetai]); | ||
305 | |||
306 | zetasCorrNei_[zetai] = zetasNei_[zetai] - zetasUpwindNei_[zetai]; | ||
307 | zetasCorrOwn_[zetai] = zetasOwn_[zetai] - zetasUpwindOwn_[zetai]; | ||
308 | } | ||
309 | } | ||
310 | |||
311 | void Foam::zeta::zetaToMoments | ||
312 | ( | ||
313 | const scalarList& zetaf, | ||
314 | scalarList& mf, | ||
315 | scalar m0 | ||
316 | ) | ||
317 | { | ||
318 | scalarSquareMatrix S(nMoments_, 0.0); | ||
319 | |||
320 | for (label i = 0; i < nZetas_; i++) | ||
321 | { | ||
322 | S[0][i] = 1.0; | ||
323 | } | ||
324 | |||
325 | for (label i = 1; i < nZetas_; i++) | ||
326 | { | ||
327 | for (label j = i; j < nZetas_; j++) | ||
328 | { | ||
329 | S[i][j] = S[i][j - 1] + zetaf[j - i]*S[i - 1][j]; | ||
330 | } | ||
331 | } | ||
332 | |||
333 | scalarList prod(nMoments_, 1.0); | ||
334 | |||
335 | prod[1] = zetaf[0]; | ||
336 | |||
337 | for (label i = 2; i < nZetas_; i++) | ||
338 | { | ||
339 | prod[i] = prod[i - 1]*zetaf[i - 1]; | ||
340 | } | ||
341 | |||
342 | // Resetting moments to zero | ||
343 | mf = 0.0; | ||
344 | |||
345 | // Computing moments | ||
346 | mf[0] = 1.0; | ||
347 | mf[1] = zetaf[0]; | ||
348 | |||
349 | for (label i = 2; i < nMoments_; i++) | ||
350 | { | ||
351 | for (label j = 0; j <= i/2; j++) | ||
352 | { | ||
353 | mf[i] += prod[i - 2*j]*sqr(S[j][i - j]); | ||
354 | } | ||
355 | } | ||
356 | |||
357 | if (m0 != 1.0) | ||
358 | { | ||
359 | for (label mi = 0; mi < nMoments_; mi++) | ||
360 | { | ||
361 | mf[mi] *= m0; | ||
362 | } | ||
363 | } | ||
364 | } | ||
365 | |||
366 | void Foam::zeta::computeZetaFields() | ||
367 | { | ||
368 | // Cell-center values | ||
369 | forAll(m0_, celli) | ||
370 | { | ||
371 | if (m0_[celli] >= SMALL) | ||
372 | { | ||
373 | univariateMomentSet m(nMoments_, support_); | ||
374 | |||
375 | for (label mi = 0; mi < nMoments_; mi++) | ||
376 | { | ||
377 | m[mi] = moments_[mi][celli]; | ||
378 | } | ||
379 | |||
380 | nRealizableMoments_[celli] = m.nRealizableMoments(); | ||
381 | |||
382 | scalarList zetas(m.zetas()); | ||
383 | |||
384 | for (label zetai = 0; zetai < nZetas_; zetai++) | ||
385 | { | ||
386 | zetas_[zetai][celli] = zetas[zetai]; | ||
387 | |||
388 | if (zetas_[zetai][celli] > 1.0e-7) | ||
389 | { | ||
390 | zetas_[zetai][celli] = zetas[zetai]; | ||
391 | } | ||
392 | else | ||
393 | { | ||
394 | zetas_[zetai][celli] = 0.0; | ||
395 | } | ||
396 | } | ||
397 | } | ||
398 | } | ||
399 | |||
400 | // Boundary conditions | ||
401 | const volScalarField::Boundary& bf = zetas_[0].boundaryField(); | ||
402 | |||
403 | forAll(bf, patchi) | ||
404 | { | ||
405 | const fvPatchScalarField& m0Patch = bf[patchi]; | ||
406 | |||
407 | forAll(m0Patch, facei) | ||
408 | { | ||
409 | if (m0_.boundaryField()[patchi][facei] >= SMALL) | ||
410 | { | ||
411 | univariateMomentSet m(nMoments_, support_); | ||
412 | |||
413 | for (label mi = 0; mi < nMoments_; mi++) | ||
414 | { | ||
415 | m[mi] = moments_[mi].boundaryField()[patchi][facei]; | ||
416 | } | ||
417 | |||
418 | scalarList zetas(m.zetas()); | ||
419 | |||
420 | for (label zetai = 0; zetai < nZetas_; zetai++) | ||
421 | { | ||
422 | volScalarField& zi = zetas_[zetai]; | ||
423 | volScalarField::Boundary& ziBf = zi.boundaryFieldRef(); | ||
424 | ziBf[patchi][facei] = zetas[zetai]; | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
431 | void Foam::zeta::countFacesWithOutgoingFlux() | ||
432 | { | ||
433 | const fvMesh& mesh(phi_.mesh()); | ||
434 | const labelList& own = mesh.faceOwner(); | ||
435 | const labelList& nei = mesh.faceNeighbour(); | ||
436 | |||
437 | nFacesOutgoingFlux_ = 0; | ||
438 | |||
439 | // Counting internal faces with outgoing flux | ||
440 | for (label facei = 0; facei < mesh.nInternalFaces(); facei++) | ||
441 | { | ||
442 | if (phi_[facei] > 0) | ||
443 | { | ||
444 | nFacesOutgoingFlux_[own[facei]] += 1; | ||
445 | } | ||
446 | else if (phi_[facei] < 0) | ||
447 | { | ||
448 | nFacesOutgoingFlux_[nei[facei]] += 1; | ||
449 | } | ||
450 | } | ||
451 | |||
452 | // Adding boundary faces with outgoing flux | ||
453 | const surfaceScalarField::Boundary& phiBf = phi_.boundaryField(); | ||
454 | |||
455 | forAll(phiBf, patchi) | ||
456 | { | ||
457 | const fvsPatchScalarField& phiPf = phiBf[patchi]; | ||
458 | const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); | ||
459 | |||
460 | forAll(phiPf, pFacei) | ||
461 | { | ||
462 | if (phiPf[pFacei] > 0) | ||
463 | { | ||
464 | nFacesOutgoingFlux_[pFaceCells[pFacei]] += 1; | ||
465 | } | ||
466 | } | ||
467 | } | ||
468 | } | ||
469 | |||
470 | void Foam::zeta::limitZetas() | ||
471 | { | ||
472 | const labelUList& owner = phi_.mesh().owner(); | ||
473 | const labelUList& neighb = phi_.mesh().neighbour(); | ||
474 | const scalarField& phiIf = phi_; | ||
475 | const surfaceScalarField::Boundary& phiBf = phi_.boundaryField(); | ||
476 | const label nCells = phi_.mesh().nCells(); | ||
477 | const label nInternalFaces = phi_.mesh().nInternalFaces(); | ||
478 | |||
479 | countFacesWithOutgoingFlux(); | ||
480 | |||
481 | forAll(cellLimiters_, li) | ||
482 | { | ||
483 | forAll(cellLimiters_[0], celli) | ||
484 | { | ||
485 | cellLimiters_[li][celli] = 1.0; | ||
486 | } | ||
487 | } | ||
488 | |||
489 | // First check on m* to identify cells in need of additional limitation | ||
490 | scalarRectangularMatrix mPluses(nMoments_, nCells, 0.0); | ||
491 | |||
492 | // Find m+ (moments reconstructed on cell faces with outgoing flux) | ||
493 | for (label facei = 0; facei < nInternalFaces; facei++) | ||
494 | { | ||
495 | const label own = owner[facei]; | ||
496 | const label nei = neighb[facei]; | ||
497 | |||
498 | if (phi_[facei] > 0.0) | ||
499 | { | ||
500 | for (label mi = 0; mi < nMoments_; mi++) | ||
501 | { | ||
502 | mPluses[mi][own] += momentsOwn_[mi][facei]; | ||
503 | } | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | for (label mi = 0; mi < nMoments_; mi++) | ||
508 | { | ||
509 | mPluses[mi][nei] += momentsNei_[mi][facei]; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | |||
514 | // Adding boundary faces with outgoing flux | ||
515 | forAll(phiBf, patchi) | ||
516 | { | ||
517 | const fvsPatchScalarField& phiPf = phiBf[patchi]; | ||
518 | |||
519 | const labelList& pFaceCells | ||
520 | = phi_.mesh().boundary()[patchi].faceCells(); | ||
521 | |||
522 | forAll(phiPf, pFacei) | ||
523 | { | ||
524 | if (phiPf[pFacei] > 0) | ||
525 | { | ||
526 | for (label mi = 0; mi < nMoments_; mi++) | ||
527 | { | ||
528 | mPluses[mi][pFaceCells[pFacei]] += momentsOwn_[mi][pFacei]; | ||
529 | } | ||
530 | } | ||
531 | } | ||
532 | } | ||
533 | |||
534 | // Compute m* and find how many moments are realizable | ||
535 | univariateMomentSet mStar(nMoments_, support_); | ||
536 | |||
537 | forAll(m0_, celli) | ||
538 | { | ||
539 | if (m0_[celli] > 0) | ||
540 | { | ||
541 | for (label mi = 0; mi < nMoments_; mi++) | ||
542 | { | ||
543 | mStar[mi] | ||
544 | = scalar(nFacesOutgoingFlux_[celli] + 1) | ||
545 | *moments_[mi][celli] - mPluses[mi][celli]; | ||
546 | } | ||
547 | |||
548 | nRealizableMomentsStar_[celli] = mStar.nRealizableMoments(false); | ||
549 | } | ||
550 | else | ||
551 | { | ||
552 | nRealizableMomentsStar_[celli] = nRealizableMoments_[celli]; | ||
553 | } | ||
554 | } | ||
555 | |||
556 | // In each cell where the the number of realizable m* is less than the | ||
557 | // number of realizable m, limitation is attempted | ||
558 | const cellList& mCells(phi_.mesh().cells()); | ||
559 | |||
560 | forAll(m0_, celli) | ||
561 | { | ||
562 | if (nRealizableMomentsStar_[celli] < nRealizableMoments_[celli]) | ||
563 | { | ||
564 | const cell& mCell(mCells[celli]); | ||
565 | |||
566 | // Start search for the zetas to limit | ||
567 | for (label p = 0; p < nRealizableMoments_[celli] - 1; p++) | ||
568 | { | ||
569 | scalarList mPlus(nMoments_, 0.0); | ||
570 | |||
571 | // Check if zeta_p needs limiting by evaluating m* with | ||
572 | // zeta_k, k > p from constant reconstruction | ||
573 | |||
574 | // Update mPlus for a face to update m* | ||
575 | forAll(mCell, fi) | ||
576 | { | ||
577 | const label facei = mCell[fi]; | ||
578 | |||
579 | if (phi_.mesh().isInternalFace(facei)) | ||
580 | { | ||
581 | if (phi_[facei] > 0) | ||
582 | { | ||
583 | scalarList zOwn(nZetas_, 0.0); | ||
584 | scalarList mOwn(nMoments_, 0.0); | ||
585 | |||
586 | for (label zi = 0; zi <= p; zi++) | ||
587 | { | ||
588 | zOwn[zi] = zetasOwn_[zi][facei]; | ||
589 | } | ||
590 | |||
591 | for (label zi = p + 1; zi < nZetas_; zi++) | ||
592 | { | ||
593 | zOwn[zi] = zetasUpwindOwn_[zi][facei]; | ||
594 | } | ||
595 | |||
596 | zetaToMoments(zOwn, mOwn, m0Own_[facei]); | ||
597 | |||
598 | for (label mi = 0; mi < nMoments_; mi++) | ||
599 | { | ||
600 | mPlus[mi] += mOwn[mi]; | ||
601 | } | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | |||
606 | // Compute m* | ||
607 | for (label mi = 0; mi < nMoments_; mi++) | ||
608 | { | ||
609 | mStar[mi] | ||
610 | = scalar(nFacesOutgoingFlux_[celli] + 1) | ||
611 | *moments_[mi][celli] - mPlus[mi]; | ||
612 | } | ||
613 | |||
614 | nRealizableMomentsStar_[celli] | ||
615 | = mStar.nRealizableMoments(false); | ||
616 | |||
617 | // Check if zeta_p needs limitation | ||
618 | if (nRealizableMomentsStar_[celli] < nRealizableMoments_[celli]) | ||
619 | { | ||
620 | mPlus = 0; | ||
621 | |||
622 | // Limit zeta_p | ||
623 | forAll(mCell, fi) | ||
624 | { | ||
625 | const label facei = mCell[fi]; | ||
626 | |||
627 | if (phi_.mesh().isInternalFace(facei)) | ||
628 | { | ||
629 | if (phi_[facei] > 0) | ||
630 | { | ||
631 | zetasOwn_[p][facei] | ||
632 | = zetasUpwindOwn_[p][facei] | ||
633 | + 0.5*(zetasCorrOwn_[p][facei]); | ||
634 | |||
635 | cellLimiters_[p][celli] = 0.5; | ||
636 | |||
637 | scalarList zOwn(nZetas_); | ||
638 | scalarList mOwn(nMoments_, 0.0); | ||
639 | |||
640 | for (label zi = 0; zi < p; zi++) | ||
641 | { | ||
642 | zOwn[zi] = zetasOwn_[zi][facei]; | ||
643 | } | ||
644 | |||
645 | zOwn[p] = zetasOwn_[p][facei]; | ||
646 | |||
647 | for (label zi = p + 1; zi < nZetas_; zi++) | ||
648 | { | ||
649 | zOwn[zi] = zetasUpwindOwn_[zi][facei]; | ||
650 | } | ||
651 | |||
652 | zetaToMoments(zOwn, mOwn, m0Own_[facei]); | ||
653 | |||
654 | for (label mi = 0; mi < nMoments_; mi++) | ||
655 | { | ||
656 | mPlus[mi] += mOwn[mi]; | ||
657 | } | ||
658 | } | ||
659 | } | ||
660 | } | ||
661 | |||
662 | // Compute m* | ||
663 | for (label mi = 0; mi < nMoments_; mi++) | ||
664 | { | ||
665 | mStar[mi] | ||
666 | = scalar(nFacesOutgoingFlux_[celli] + 1) | ||
667 | *moments_[mi][celli] - mPlus[mi]; | ||
668 | } | ||
669 | |||
670 | nRealizableMomentsStar_[celli] | ||
671 | = mStar.nRealizableMoments(false); | ||
672 | |||
673 | if | ||
674 | ( | ||
675 | nRealizableMomentsStar_[celli] | ||
676 | < nRealizableMoments_[celli] | ||
677 | ) | ||
678 | { | ||
679 | cellLimiters_[p][celli] = 0.0; | ||
680 | } | ||
681 | } | ||
682 | } | ||
683 | } | ||
684 | } | ||
685 | |||
686 | // Setting limiters on internal faces based on cell limiters | ||
687 | forAll(phiIf, facei) | ||
688 | { | ||
689 | const label own = owner[facei]; | ||
690 | const label nei = neighb[facei]; | ||
691 | |||
692 | if (phi_[facei] > 0) | ||
693 | { | ||
694 | for (label zi = 0; zi < nZetas_; zi++) | ||
695 | { | ||
696 | limiters_[zi][facei] = cellLimiters_[zi][own]; | ||
697 | } | ||
698 | } | ||
699 | else | ||
700 | { | ||
701 | for (label zi = 0; zi < nZetas_; zi++) | ||
702 | { | ||
703 | limiters_[zi][facei] = cellLimiters_[zi][nei]; | ||
704 | } | ||
705 | } | ||
706 | } | ||
707 | |||
708 | // Setting limiters on boundary faces | ||
709 | forAll(phiBf, patchi) | ||
710 | { | ||
711 | const fvsPatchScalarField& phiPf = phiBf[patchi]; | ||
712 | |||
713 | const labelList& pFaceCells | ||
714 | = phi_.mesh().boundary()[patchi].faceCells(); | ||
715 | |||
716 | forAll(phiPf, pFacei) | ||
717 | { | ||
718 | if (phiPf[pFacei] > 0) | ||
719 | { | ||
720 | for (label zi = 0; zi < nZetas_; zi++) | ||
721 | { | ||
722 | limiters_[zi][pFacei] | ||
723 | = cellLimiters_[zi][pFaceCells[pFacei]]; | ||
724 | } | ||
725 | } | ||
726 | } | ||
727 | } | ||
728 | |||
729 | for (label zi = 1; zi < nZetas_; zi++) | ||
730 | { | ||
731 | zetasOwn_[zi] = zetasUpwindOwn_[zi] + limiters_[zi]*zetasCorrOwn_[zi]; | ||
732 | zetasNei_[zi] = zetasUpwindNei_[zi] + limiters_[zi]*zetasCorrNei_[zi]; | ||
733 | } | ||
734 | } | ||
735 | |||
736 | Foam::scalar Foam::zeta::realizableCo() | ||
737 | { | ||
738 | const fvMesh& mesh(phi_.mesh()); | ||
739 | const labelList& own = mesh.faceOwner(); | ||
740 | const labelList& nei = mesh.faceNeighbour(); | ||
741 | |||
742 | scalarField internalCo(mesh.nCells(), 0.0); | ||
743 | |||
744 | for (label facei = 0; facei < mesh.nInternalFaces(); facei++) | ||
745 | { | ||
746 | if (phi_[facei] > 0) | ||
747 | { | ||
748 | internalCo[own[facei]] += 1; | ||
749 | } | ||
750 | else if (phi_[facei] < 0) | ||
751 | { | ||
752 | internalCo[nei[facei]] += 1; | ||
753 | } | ||
754 | } | ||
755 | |||
756 | internalCo = 1.0/(internalCo + 1.0); | ||
757 | |||
758 | return gMin(internalCo); | ||
759 | } | ||
760 | |||
761 | void Foam::zeta::update() | ||
762 | { | ||
763 | // Compute zeta fields | ||
764 | computeZetaFields(); | ||
765 | |||
766 | // Reconstructing zeta_k on cell faces | ||
767 | interpolateFields(); | ||
768 | |||
769 | // Recompute moments at sides of cell faces | ||
770 | updateMomentFieldsFromZetas(m0Nei_, zetasNei_, momentsNei_); | ||
771 | updateMomentFieldsFromZetas(m0Own_, zetasOwn_, momentsOwn_); | ||
772 | |||
773 | // Apply additional limitation to zeta_k if needed | ||
774 | limitZetas(); | ||
775 | |||
776 | // Recompute moments at sides of cell faces | ||
777 | updateMomentFieldsFromZetas(m0Nei_, zetasNei_, momentsNei_); | ||
778 | updateMomentFieldsFromZetas(m0Own_, zetasOwn_, momentsOwn_); | ||
779 | |||
780 | // Calculate moment advection term | ||
781 | dimensionedScalar zeroPhi("zero", phi_.dimensions(), 0.0); | ||
782 | |||
783 | forAll(divMoments_, divi) | ||
784 | { | ||
785 | volScalarField divMoment | ||
786 | ( | ||
787 | IOobject | ||
788 | ( | ||
789 | "divMoment", | ||
790 | moments_[0].mesh().time().timeName(), | ||
791 | moments_[0].mesh(), | ||
792 | IOobject::NO_READ, | ||
793 | IOobject::NO_WRITE, | ||
794 | false | ||
795 | ), | ||
796 | moments_[0].mesh(), | ||
797 | dimensionedScalar("zero", dimless, 0.0) | ||
798 | ); | ||
799 | |||
800 | surfaceScalarField mFlux | ||
801 | ( | ||
802 | momentsNei_[divi]*min(phi_, zeroPhi) | ||
803 | + momentsOwn_[divi]*max(phi_, zeroPhi) | ||
804 | ); | ||
805 | |||
806 | fvc::surfaceIntegrate(divMoment.ref(), mFlux); | ||
807 | divMoment.ref().dimensions().reset(moments_[divi].dimensions()/dimTime); | ||
808 | |||
809 | divMoments_[divi].replace(0, divMoment); | ||
810 | } | ||
811 | } | ||
812 | |||
813 | void Foam::zeta::updateMomentFieldsFromZetas | ||
814 | ( | ||
815 | const surfaceScalarField m0f, | ||
816 | const PtrList<surfaceScalarField>& zetaf, | ||
817 | PtrList<surfaceScalarField>& mf | ||
818 | ) | ||
819 | { | ||
820 | forAll(zetaf[0], facei) | ||
821 | { | ||
822 | scalarList zf(nZetas_); | ||
823 | |||
824 | for (label zetai = 0; zetai < nZetas_; zetai++) | ||
825 | { | ||
826 | zf[zetai] = zetaf[zetai][facei]; | ||
827 | } | ||
828 | |||
829 | scalarList mFace(nMoments_, 0.0); | ||
830 | zetaToMoments(zf, mFace, m0f[facei]); | ||
831 | |||
832 | for (label mi = 0; mi < nMoments_; mi++) | ||
833 | { | ||
834 | mf[mi][facei] = mFace[mi]; | ||
835 | } | ||
836 | } | ||
837 | |||
838 | // Boundary conditions | ||
839 | const surfaceScalarField::Boundary& bf = zetaf[0].boundaryField(); | ||
840 | |||
841 | forAll(bf, patchi) | ||
842 | { | ||
843 | const fvsPatchScalarField& m0Patch = bf[patchi]; | ||
844 | |||
845 | forAll(m0Patch, facei) | ||
846 | { | ||
847 | scalarList zf(nZetas_); | ||
848 | |||
849 | for (label zetai = 0; zetai < nZetas_; zetai++) | ||
850 | { | ||
851 | zf[zetai] = zetaf[zetai].boundaryField()[patchi][facei]; | ||
852 | } | ||
853 | |||
854 | scalarList mFace(nMoments_, 0.0); | ||
855 | zetaToMoments(zf, mFace, m0f.boundaryField()[patchi][facei]); | ||
856 | |||
857 | for (label mi = 0; mi < nMoments_; mi++) | ||
858 | { | ||
859 | mf[mi].boundaryFieldRef()[patchi][facei] = mFace[mi]; | ||
860 | } | ||
861 | } | ||
862 | } | ||
863 | } | ||
864 | |||
865 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentAdvection/zeta/zeta.H added (mode: 100644) (index 0000000..a7565d7) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | Class | ||
25 | Foam::zeta | ||
26 | |||
27 | Description | ||
28 | Second-order univariate moment advection with zeta kinetic scheme. | ||
29 | |||
30 | References | ||
31 | \verbatim | ||
32 | "Realizable second-order finite-volume schemes for the advection of | ||
33 | moment sets of the particle size distribution" | ||
34 | F Laurent, T. T. Nguyen | ||
35 | Journal of Computational Physics | ||
36 | Volume 337, Pages 309-338, 2017 | ||
37 | \endverbatim | ||
38 | |||
39 | SourceFiles | ||
40 | zeta.C | ||
41 | zetaI.H | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef zeta_H | ||
46 | #define zeta_H | ||
47 | |||
48 | #include "univariateMomentAdvection.H" | ||
49 | |||
50 | |||
51 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
52 | |||
53 | namespace Foam | ||
54 | { | ||
55 | |||
56 | /*---------------------------------------------------------------------------*\ | ||
57 | Class zeta Declaration | ||
58 | \*---------------------------------------------------------------------------*/ | ||
59 | |||
60 | class zeta | ||
61 | : | ||
62 | public univariateMomentAdvection | ||
63 | { | ||
64 | // Private data | ||
65 | |||
66 | //- Reference to zero-order moment field | ||
67 | const volScalarField& m0_; | ||
68 | |||
69 | //- Reconstructed m0 (owner) | ||
70 | surfaceScalarField m0Own_; | ||
71 | |||
72 | //- Reconstructed m0 (neighbour) | ||
73 | surfaceScalarField m0Nei_; | ||
74 | |||
75 | //- Number of zeta_k values | ||
76 | label nZetas_; | ||
77 | |||
78 | //- List of fields of zeta_k (n fields for n + 1 moments) | ||
79 | PtrList<volScalarField> zetas_; | ||
80 | |||
81 | //- List of interpolated zeta_k values (neighbour) | ||
82 | PtrList<surfaceScalarField> zetasNei_; | ||
83 | |||
84 | //- List of interpolated nodes (owner) | ||
85 | PtrList<surfaceScalarField> zetasOwn_; | ||
86 | |||
87 | //- List of interpolated zeta_k values (neighbour) | ||
88 | PtrList<surfaceScalarField> zetasUpwindNei_; | ||
89 | |||
90 | //- List of interpolated nodes (owner) | ||
91 | PtrList<surfaceScalarField> zetasUpwindOwn_; | ||
92 | |||
93 | //- List of interpolated zeta_k values (neighbour) | ||
94 | PtrList<surfaceScalarField> zetasCorrNei_; | ||
95 | |||
96 | //- List of interpolated nodes (owner) | ||
97 | PtrList<surfaceScalarField> zetasCorrOwn_; | ||
98 | |||
99 | //- List of interpolated moments (neighbour) | ||
100 | PtrList<surfaceScalarField> momentsNei_; | ||
101 | |||
102 | //- List of interpolated moments (owner) | ||
103 | PtrList<surfaceScalarField> momentsOwn_; | ||
104 | |||
105 | //- Field to store the number of faces with outgoing flux per each cell | ||
106 | labelField nFacesOutgoingFlux_; | ||
107 | |||
108 | //- Field to store the number of realizable moments in each cell | ||
109 | labelField nRealizableMoments_; | ||
110 | |||
111 | //- Field to store the number of realizable m* in each cell | ||
112 | labelField nRealizableMomentsStar_; | ||
113 | |||
114 | //- List of limiters for zeta_k | ||
115 | PtrList<surfaceScalarField> limiters_; | ||
116 | |||
117 | //- List of cell limiters | ||
118 | PtrList<volScalarField> cellLimiters_; | ||
119 | |||
120 | //- Face velocity | ||
121 | const surfaceScalarField& phi_; | ||
122 | |||
123 | |||
124 | // Private member functions | ||
125 | |||
126 | //- Compute n values of zeta_k from n + 1 moments | ||
127 | void computeZetaFields(); | ||
128 | |||
129 | //- Updates reconstructed moments from the corresponding values of zeta | ||
130 | void updateMomentFieldsFromZetas | ||
131 | ( | ||
132 | const surfaceScalarField m0f, | ||
133 | const PtrList<surfaceScalarField>& zetaf, | ||
134 | PtrList<surfaceScalarField>& mf | ||
135 | ); | ||
136 | |||
137 | //- Compute n + 1 moments from n values of zeta_k | ||
138 | void zetaToMoments | ||
139 | ( | ||
140 | const scalarList& zetaf, | ||
141 | scalarList& mf, | ||
142 | scalar m0 = 1.0 | ||
143 | ); | ||
144 | |||
145 | |||
146 | protected: | ||
147 | |||
148 | // Protected member functions | ||
149 | |||
150 | //- Calculates the number of cells with outgoing flux | ||
151 | void countFacesWithOutgoingFlux(); | ||
152 | |||
153 | //- Computes the limiter used for additional limitation | ||
154 | void limiter(); | ||
155 | |||
156 | //- Reconstructs zeta_k | ||
157 | void interpolateFields(); | ||
158 | |||
159 | //- Applies additional limitation to zeta_k, if needed | ||
160 | void limitZetas(); | ||
161 | |||
162 | |||
163 | public: | ||
164 | |||
165 | //- Runtime type information | ||
166 | TypeName("zeta"); | ||
167 | |||
168 | |||
169 | // Constructors | ||
170 | |||
171 | //- Construct from univariateMomentSet | ||
172 | zeta | ||
173 | ( | ||
174 | const dictionary& dict, | ||
175 | const univariateQuadratureApproximation& quadrature, | ||
176 | const surfaceScalarField& phi, | ||
177 | const word& support | ||
178 | ); | ||
179 | |||
180 | |||
181 | //- Destructor | ||
182 | virtual ~zeta(); | ||
183 | |||
184 | |||
185 | // Public member functions | ||
186 | |||
187 | //- Return the maximum Courant number ensuring moment realizability | ||
188 | virtual scalar realizableCo(); | ||
189 | |||
190 | //- Update moment advection | ||
191 | virtual void update(); | ||
192 | }; | ||
193 | |||
194 | |||
195 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
196 | |||
197 | } // End namespace Foam | ||
198 | |||
199 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
200 | |||
201 | |||
202 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
203 | |||
204 | #endif | ||
205 | |||
206 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/Make/files renamed from multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/Make/files (similarity 55%) (mode: 100644) (index 82f5895..c50c239) | |||
1 | multivariateMomentInversion.C | ||
1 | conditional/conditionalMomentInversion.C | ||
2 | 2 | ||
3 | 3 | LIB = $(FOAM_USER_LIBBIN)/libmultivariateInversion | LIB = $(FOAM_USER_LIBBIN)/libmultivariateInversion |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/Make/options added (mode: 100644) (index 0000000..2fc001e) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../../../Vandermonde/lnInclude \ | ||
4 | -I../../../mappedList \ | ||
5 | -I../../../nDimensionalMappedPtrList \ | ||
6 | -I../../momentSets/lnInclude \ | ||
7 | -I../univariate/basic/lnInclude | ||
8 | |||
9 | LIB_LIBS = \ | ||
10 | -lfiniteVolume \ | ||
11 | -L$(FOAM_USER_LIBBIN) \ | ||
12 | -lmomentSets \ | ||
13 | -lmomentInversion | ||
14 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/conditional/conditionalMomentInversion.C renamed from multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversion.C (similarity 69%) (mode: 100644) (index 298be0f..6c1f99c) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "multivariateMomentInversion.H" | ||
26 | #include "conditionalMomentInversion.H" | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
30 | 30 | ||
31 | Foam::multivariateMomentInversion::multivariateMomentInversion | ||
31 | Foam::conditionalMomentInversion::conditionalMomentInversion | ||
32 | 32 | ( | ( |
33 | const dictionary& dict, | ||
33 | 34 | const label nMoments, | const label nMoments, |
34 | 35 | const Map<label> map, | const Map<label> map, |
35 | 36 | const labelList& nNodes, | const labelList& nNodes, |
... | ... | Foam::multivariateMomentInversion::multivariateMomentInversion | |
44 | 45 | weights_(nDims_), | weights_(nDims_), |
45 | 46 | moments_(nMoments_, nDims_, map), | moments_(nMoments_, nDims_, map), |
46 | 47 | conditionalMoments_(nDims_), | conditionalMoments_(nDims_), |
47 | invVR_(nDims_ - 1) | ||
48 | invVR_(nDims_ - 1), | ||
49 | momentInverter_ | ||
50 | ( | ||
51 | univariateMomentInversion::New(dict.subDict("basicQuadrature")) | ||
52 | ) | ||
48 | 53 | { | { |
49 | 54 | labelList nNodesCM = nNodes_; | labelList nNodesCM = nNodes_; |
50 | 55 | ||
... | ... | Foam::multivariateMomentInversion::multivariateMomentInversion | |
53 | 58 | weights_.set | weights_.set |
54 | 59 | ( | ( |
55 | 60 | dimi, | dimi, |
56 | new nDimensionalMappedList<scalar> | ||
57 | ( | ||
58 | dimi + 1, | ||
59 | nNodes_ | ||
60 | ) | ||
61 | new nDimensionalMappedPtrList<scalar>(dimi + 1, nNodes_) | ||
61 | 62 | ); | ); |
62 | 63 | ||
63 | 64 | abscissae_.set | abscissae_.set |
64 | 65 | ( | ( |
65 | 66 | dimi, | dimi, |
66 | new nDimensionalMappedList<scalar> | ||
67 | ( | ||
68 | dimi + 1, | ||
69 | nNodes_ | ||
70 | ) | ||
67 | new nDimensionalMappedPtrList<scalar>(dimi + 1, nNodes_) | ||
71 | 68 | ); | ); |
72 | 69 | ||
73 | 70 | forAll(abscissae_[dimi], ai) | forAll(abscissae_[dimi], ai) |
74 | 71 | { | { |
75 | weights_[dimi].set | ||
76 | ( | ||
77 | ai, | ||
78 | new scalar(0.0) | ||
79 | ); | ||
80 | |||
81 | abscissae_[dimi].set | ||
82 | ( | ||
83 | ai, | ||
84 | new scalar(0.0) | ||
85 | ); | ||
72 | weights_[dimi].set(ai, new scalar(0)); | ||
73 | abscissae_[dimi].set(ai, new scalar(0)); | ||
86 | 74 | } | } |
87 | |||
88 | 75 | } | } |
89 | 76 | ||
90 | 77 | forAll(conditionalMoments_, dimi) | forAll(conditionalMoments_, dimi) |
... | ... | Foam::multivariateMomentInversion::multivariateMomentInversion | |
92 | 79 | conditionalMoments_.set | conditionalMoments_.set |
93 | 80 | ( | ( |
94 | 81 | dimi, | dimi, |
95 | new PtrList<nDimensionalMappedList<scalar> > | ||
96 | ( | ||
97 | dimi + 1 | ||
98 | ) | ||
82 | new PtrList<nDimensionalMappedPtrList<scalar>>(dimi + 1) | ||
99 | 83 | ); | ); |
100 | 84 | ||
101 | 85 | nNodesCM = nNodes_; | nNodesCM = nNodes_; |
... | ... | Foam::multivariateMomentInversion::multivariateMomentInversion | |
106 | 90 | conditionalMoments_[dimi].set | conditionalMoments_[dimi].set |
107 | 91 | ( | ( |
108 | 92 | dimj, | dimj, |
109 | new nDimensionalMappedList<scalar> | ||
110 | ( | ||
111 | dimi + 1, | ||
112 | nNodesCM | ||
113 | ) | ||
93 | new nDimensionalMappedPtrList<scalar>(dimi + 1, nNodesCM) | ||
114 | 94 | ); | ); |
115 | 95 | ||
116 | 96 | forAll(conditionalMoments_[dimi][dimj], ai) | forAll(conditionalMoments_[dimi][dimj], ai) |
117 | 97 | { | { |
118 | conditionalMoments_[dimi][dimj].set | ||
119 | ( | ||
120 | ai, | ||
121 | new scalar(0.0) | ||
122 | ); | ||
98 | conditionalMoments_[dimi][dimj].set(ai, new scalar(0)); | ||
123 | 99 | } | } |
124 | 100 | } | } |
125 | 101 | } | } |
102 | |||
126 | 103 | forAll(invVR_, dimi) | forAll(invVR_, dimi) |
127 | 104 | { | { |
128 | 105 | invVR_.set | invVR_.set |
129 | 106 | ( | ( |
130 | 107 | dimi, | dimi, |
131 | new nDimensionalMappedList<scalarSquareMatrix> | ||
132 | ( | ||
133 | dimi, | ||
134 | nNodes_ | ||
135 | ) | ||
108 | new nDimensionalMappedPtrList<scalarSquareMatrix>(dimi, nNodes_) | ||
136 | 109 | ); | ); |
137 | 110 | ||
138 | 111 | forAll(invVR_[dimi], ai) | forAll(invVR_[dimi], ai) |
... | ... | Foam::multivariateMomentInversion::multivariateMomentInversion | |
140 | 113 | invVR_[dimi].set | invVR_[dimi].set |
141 | 114 | ( | ( |
142 | 115 | ai, | ai, |
143 | new scalarSquareMatrix | ||
144 | ( | ||
145 | nNodes_[dimi], | ||
146 | scalar(0.0) | ||
147 | ) | ||
116 | new scalarSquareMatrix(nNodes_[dimi], scalar(0)) | ||
148 | 117 | ); | ); |
149 | 118 | } | } |
150 | 119 | } | } |
151 | 120 | ||
152 | 121 | forAll(moments_, mi) | forAll(moments_, mi) |
153 | 122 | { | { |
154 | moments_.set | ||
155 | ( | ||
156 | mi, | ||
157 | new scalar(0.0) | ||
158 | ); | ||
123 | moments_.set(mi, new scalar(0)); | ||
159 | 124 | } | } |
160 | 125 | ||
161 | 126 | // Set all lists to zero | // Set all lists to zero |
... | ... | Foam::multivariateMomentInversion::multivariateMomentInversion | |
165 | 130 | ||
166 | 131 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
167 | 132 | ||
168 | Foam::multivariateMomentInversion::~multivariateMomentInversion() | ||
133 | Foam::conditionalMomentInversion::~conditionalMomentInversion() | ||
169 | 134 | {} | {} |
170 | 135 | ||
171 | 136 | ||
172 | 137 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
173 | 138 | ||
174 | void Foam::multivariateMomentInversion | ||
175 | ::invert(const nDimensionalMappedList<scalar>& moments) | ||
139 | void Foam::conditionalMomentInversion::invert | ||
140 | ( | ||
141 | const nDimensionalMappedPtrList<scalar>& moments | ||
142 | ) | ||
176 | 143 | { | { |
177 | 144 | reset(); | reset(); |
178 | 145 | ||
... | ... | void Foam::multivariateMomentInversion | |
183 | 150 | ||
184 | 151 | // Invert primary direction first | // Invert primary direction first |
185 | 152 | labelList pos(nDims_, 0); | labelList pos(nDims_, 0); |
186 | univariateMomentSet momentsToInvert | ||
187 | ( | ||
188 | 2*nNodes_[0], | ||
189 | 0.0, | ||
190 | "Gauss", | ||
191 | support_[0] | ||
192 | ); | ||
153 | |||
154 | univariateMomentSet momentsToInvert(2*nNodes_[0], support_[0]); | ||
193 | 155 | ||
194 | 156 | for (label mi = 0; mi < 2*nNodes_[0]; mi++) | for (label mi = 0; mi < 2*nNodes_[0]; mi++) |
195 | 157 | { | { |
... | ... | void Foam::multivariateMomentInversion | |
197 | 159 | momentsToInvert[mi] = moments_(pos); | momentsToInvert[mi] = moments_(pos); |
198 | 160 | } | } |
199 | 161 | ||
200 | momentsToInvert.invert(); | ||
162 | momentInverter_().invert(momentsToInvert); | ||
201 | 163 | ||
202 | 164 | for (label nodei = 0; nodei < nNodes_[0]; nodei++) | for (label nodei = 0; nodei < nNodes_[0]; nodei++) |
203 | 165 | { | { |
204 | 166 | // First component of the weights and abscissae only have one direction | // First component of the weights and abscissae only have one direction |
205 | 167 | // Copy from univariateMomentSet to stored copy | // Copy from univariateMomentSet to stored copy |
206 | weights_[0](nodei) = momentsToInvert.weights()[nodei]; | ||
207 | abscissae_[0](nodei) = momentsToInvert.abscissae()[nodei]; | ||
168 | weights_[0](nodei) = momentInverter_().weights()[nodei]; | ||
169 | abscissae_[0](nodei) = momentInverter_().abscissae()[nodei]; | ||
208 | 170 | } | } |
209 | 171 | ||
210 | 172 | // Solve remaining directions | // Solve remaining directions |
... | ... | void Foam::multivariateMomentInversion | |
226 | 188 | } | } |
227 | 189 | } | } |
228 | 190 | ||
229 | void Foam::multivariateMomentInversion::cycleAlphaCM | ||
191 | void Foam::conditionalMomentInversion::cycleAlphaCM | ||
230 | 192 | ( | ( |
231 | 193 | const label dimi, | const label dimi, |
232 | 194 | const label dimj, | const label dimj, |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaCM | |
236 | 198 | { | { |
237 | 199 | if (dimj == ai) | if (dimj == ai) |
238 | 200 | { | { |
239 | cycleAlphaCM(dimi,dimj,ai+1,pos); | ||
201 | cycleAlphaCM(dimi, dimj, ai+1, pos); | ||
240 | 202 | return; | return; |
241 | 203 | } | } |
242 | 204 | else if (ai < dimi) | else if (ai < dimi) |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaCM | |
244 | 206 | for (label i = 0; i < nNodes_[ai]; i++) | for (label i = 0; i < nNodes_[ai]; i++) |
245 | 207 | { | { |
246 | 208 | pos[ai] = i; | pos[ai] = i; |
247 | cycleAlphaCM(dimi,dimj,ai+1,pos); | ||
209 | cycleAlphaCM(dimi, dimj, ai+1, pos); | ||
248 | 210 | } | } |
249 | 211 | return; | return; |
250 | 212 | } | } |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaCM | |
253 | 215 | for (label i = 0; i < 2*nNodes_[dimi]; i++) | for (label i = 0; i < 2*nNodes_[dimi]; i++) |
254 | 216 | { | { |
255 | 217 | pos[dimi] = i; | pos[dimi] = i; |
256 | cycleAlphaCM(dimi,dimj,ai+1,pos); | ||
218 | cycleAlphaCM(dimi, dimj, ai+1, pos); | ||
257 | 219 | } | } |
258 | 220 | return; | return; |
259 | 221 | } | } |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaCM | |
267 | 229 | ||
268 | 230 | if (dimj == 0) | if (dimj == 0) |
269 | 231 | { | { |
270 | labelList posM(nDims_,0); | ||
232 | labelList posM(nDims_, 0); | ||
233 | |||
271 | 234 | for (label mi = 0; mi < pos.size(); mi++) | for (label mi = 0; mi < pos.size(); mi++) |
272 | 235 | { | { |
273 | 236 | posM[mi] = pos[mi]; | posM[mi] = pos[mi]; |
274 | 237 | } | } |
275 | Yold(i,0) = moments_(posM); | ||
238 | |||
239 | Yold(i, 0) = moments_(posM); | ||
276 | 240 | } | } |
277 | 241 | else | else |
278 | 242 | { | { |
279 | Yold(i,0) = | ||
243 | Yold(i, 0) = | ||
280 | 244 | conditionalMoments_[dimi][dimj - 1](pos); | conditionalMoments_[dimi][dimj - 1](pos); |
281 | 245 | } | } |
282 | 246 | } | } |
283 | 247 | ||
284 | 248 | labelList posVR(max(1, dimj), 0); | labelList posVR(max(1, dimj), 0); |
249 | |||
285 | 250 | if (dimj != 0) | if (dimj != 0) |
286 | 251 | { | { |
287 | 252 | for (label i = 0; i < posVR.size(); i++) | for (label i = 0; i < posVR.size(); i++) |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaCM | |
295 | 260 | for (label i = 0; i < nNodes_[dimj]; i++) | for (label i = 0; i < nNodes_[dimj]; i++) |
296 | 261 | { | { |
297 | 262 | pos[dimj] = i; | pos[dimj] = i; |
298 | conditionalMoments_[dimi][dimj](pos) = Ynew(i,0); | ||
263 | conditionalMoments_[dimi][dimj](pos) = Ynew(i, 0); | ||
299 | 264 | } | } |
300 | 265 | } | } |
301 | 266 | } | } |
302 | 267 | ||
303 | void Foam::multivariateMomentInversion::setVR | ||
268 | void Foam::conditionalMomentInversion::setVR | ||
304 | 269 | ( | ( |
305 | 270 | const label dimi, | const label dimi, |
306 | 271 | labelList& pos, | labelList& pos, |
... | ... | void Foam::multivariateMomentInversion::setVR | |
313 | 278 | { | { |
314 | 279 | pos[ai] = i; | pos[ai] = i; |
315 | 280 | ||
316 | setVR(dimi,pos,ai + 1); | ||
281 | setVR(dimi, pos, ai + 1); | ||
317 | 282 | } | } |
318 | 283 | } | } |
319 | 284 | else | else |
... | ... | void Foam::multivariateMomentInversion::setVR | |
321 | 286 | scalarDiagonalMatrix x(nNodes_[dimi], 0.0); | scalarDiagonalMatrix x(nNodes_[dimi], 0.0); |
322 | 287 | scalarSquareMatrix invR(nNodes_[dimi], 0.0); | scalarSquareMatrix invR(nNodes_[dimi], 0.0); |
323 | 288 | ||
324 | for (label i = 0; i < nNodes_[dimi]; i++) | ||
289 | for (label nodei = 0; nodei < nNodes_[dimi]; nodei++) | ||
325 | 290 | { | { |
326 | pos[dimi] = i; | ||
327 | x[i] = abscissae_[dimi](pos); | ||
328 | invR[i][i] = 1.0/weights_[dimi](pos); | ||
291 | if (nodei >= momentInverter_().nNodes()) | ||
292 | { | ||
293 | weights_[dimi](pos) = scalar(0); | ||
294 | abscissae_[dimi](pos) = scalar(0); | ||
295 | continue; | ||
296 | } | ||
297 | |||
298 | pos[dimi] = nodei; | ||
299 | x[nodei] = abscissae_[dimi](pos); | ||
300 | invR[nodei][nodei] = 1.0/weights_[dimi](pos); | ||
329 | 301 | } | } |
330 | 302 | ||
331 | 303 | Vandermonde V(x); | Vandermonde V(x); |
332 | |||
333 | 304 | scalarSquareMatrix invV(V.inv()); | scalarSquareMatrix invV(V.inv()); |
334 | |||
335 | 305 | labelList posVR(max(1, dimi), 0); | labelList posVR(max(1, dimi), 0); |
336 | 306 | ||
337 | 307 | if (dimi > 0) | if (dimi > 0) |
338 | 308 | { | { |
339 | for (label ai = 0; ai < pos.size(); ai++) | ||
309 | for (label ai = 0; ai < posVR.size(); ai++) | ||
340 | 310 | { | { |
341 | 311 | posVR[ai] = pos[ai]; | posVR[ai] = pos[ai]; |
342 | 312 | } | } |
... | ... | void Foam::multivariateMomentInversion::setVR | |
346 | 316 | } | } |
347 | 317 | } | } |
348 | 318 | ||
349 | void Foam::multivariateMomentInversion::cycleAlphaWheeler | ||
319 | void Foam::conditionalMomentInversion::cycleAlphaWheeler | ||
350 | 320 | ( | ( |
351 | 321 | const label dimi, | const label dimi, |
352 | 322 | label ai, | label ai, |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaWheeler | |
359 | 329 | { | { |
360 | 330 | pos[ai] = i; | pos[ai] = i; |
361 | 331 | ||
362 | cycleAlphaWheeler(dimi,ai+1,pos); | ||
332 | cycleAlphaWheeler(dimi, ai + 1, pos); | ||
363 | 333 | } | } |
364 | 334 | ||
365 | 335 | return; | return; |
366 | 336 | } | } |
367 | 337 | else | else |
368 | 338 | { | { |
369 | univariateMomentSet momentsToInvert | ||
370 | ( | ||
371 | 2*nNodes_[dimi], | ||
372 | 0.0, | ||
373 | "Gauss", | ||
374 | support_[dimi] | ||
375 | ); | ||
339 | univariateMomentSet momentsToInvert(2*nNodes_[dimi], support_[dimi]); | ||
376 | 340 | ||
377 | 341 | forAll(momentsToInvert, mi) | forAll(momentsToInvert, mi) |
378 | 342 | { | { |
... | ... | void Foam::multivariateMomentInversion::cycleAlphaWheeler | |
381 | 345 | conditionalMoments_[dimi][dimi - 1](pos); | conditionalMoments_[dimi][dimi - 1](pos); |
382 | 346 | } | } |
383 | 347 | ||
384 | momentsToInvert.invert(); | ||
348 | momentInverter_().invert(momentsToInvert); | ||
385 | 349 | ||
386 | 350 | for (label nodei = 0; nodei < nNodes_[ai]; nodei++) | for (label nodei = 0; nodei < nNodes_[ai]; nodei++) |
387 | 351 | { | { |
388 | 352 | pos[dimi] = nodei; | pos[dimi] = nodei; |
389 | 353 | ||
390 | 354 | weights_[dimi](pos) = | weights_[dimi](pos) = |
391 | momentsToInvert.weights()[nodei]; | ||
355 | momentInverter_().weights()[nodei]; | ||
392 | 356 | ||
393 | 357 | abscissae_[dimi](pos) = | abscissae_[dimi](pos) = |
394 | momentsToInvert.abscissae()[nodei]; | ||
358 | momentInverter_().abscissae()[nodei]; | ||
395 | 359 | } | } |
396 | 360 | return; | return; |
397 | 361 | } | } |
398 | 362 | } | } |
399 | 363 | ||
400 | void Foam::multivariateMomentInversion::reset() | ||
364 | void Foam::conditionalMomentInversion::reset() | ||
401 | 365 | { | { |
402 | 366 | forAll(moments_, mi) | forAll(moments_, mi) |
403 | 367 | { | { |
... | ... | void Foam::multivariateMomentInversion::reset() | |
412 | 376 | { | { |
413 | 377 | for (label j = 0; j < nNodes_[dimi]; j++) | for (label j = 0; j < nNodes_[dimi]; j++) |
414 | 378 | { | { |
415 | invVR_[dimi][ai](i,j) = 0.0; | ||
379 | invVR_[dimi][ai](i, j) = 0.0; | ||
416 | 380 | } | } |
417 | 381 | } | } |
418 | 382 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/conditional/conditionalMomentInversion.H renamed from multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversion.H (similarity 73%) (mode: 100644) (index 76f3b57..8e01088) | |||
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-2017 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::multivariateMomentInversion | ||
25 | Foam::conditionalMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Abstract class to allow run-time selection of the algorithm to be used | ||
29 | for the extended quadrature method of moments. | ||
28 | Implementation of the conditional quadrature method of moments | ||
30 | 29 | ||
31 | 30 | References | References |
32 | 31 | \verbatim | \verbatim |
... | ... | Description | |
37 | 36 | \endverbatim | \endverbatim |
38 | 37 | ||
39 | 38 | SourceFiles | SourceFiles |
40 | multivariateMomentInversion.C | ||
41 | multivariateMomentInversionI.C | ||
39 | conditionalMomentInversion.C | ||
40 | conditionalMomentInversionI.C | ||
42 | 41 | ||
43 | 42 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
44 | 43 | ||
45 | #ifndef multivariateMomentInversion_H | ||
46 | #define multivariateMomentInversion_H | ||
44 | #ifndef conditionalMomentInversion_H | ||
45 | #define conditionalMomentInversion_H | ||
47 | 46 | ||
48 | 47 | ||
49 | 48 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
... | ... | SourceFiles | |
52 | 51 | #include "scalarMatrices.H" | #include "scalarMatrices.H" |
53 | 52 | #include "dictionary.H" | #include "dictionary.H" |
54 | 53 | #include "univariateMomentSet.H" | #include "univariateMomentSet.H" |
54 | #include "univariateMomentInversion.H" | ||
55 | 55 | #include "Vandermonde.H" | #include "Vandermonde.H" |
56 | #include "nDimensionalMappedList.H" | ||
56 | #include "nDimensionalMappedPtrList.H" | ||
57 | 57 | ||
58 | 58 | namespace Foam | namespace Foam |
59 | 59 | { | { |
60 | 60 | ||
61 | 61 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
62 | Class multivariateMomentInversion Declaration | ||
62 | Class conditionalMomentInversion Declaration | ||
63 | 63 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
64 | class multivariateMomentInversion | ||
64 | class conditionalMomentInversion | ||
65 | 65 | { | { |
66 | 66 | // Private member data | // Private member data |
67 | 67 | ||
... | ... | class multivariateMomentInversion | |
78 | 78 | const List<word> support_; | const List<word> support_; |
79 | 79 | ||
80 | 80 | //- Quadratrure abscissae | //- Quadratrure abscissae |
81 | PtrList< nDimensionalMappedList<scalar> > abscissae_; | ||
81 | PtrList<nDimensionalMappedPtrList<scalar>> abscissae_; | ||
82 | 82 | ||
83 | 83 | //- Quadratrure weights | //- Quadratrure weights |
84 | PtrList< nDimensionalMappedList<scalar> > weights_; | ||
84 | PtrList<nDimensionalMappedPtrList<scalar>> weights_; | ||
85 | 85 | ||
86 | 86 | //- Stored moments | //- Stored moments |
87 | nDimensionalMappedList<scalar> moments_; | ||
87 | nDimensionalMappedPtrList<scalar> moments_; | ||
88 | 88 | ||
89 | 89 | //- Stored conditional moments | //- Stored conditional moments |
90 | PtrList<PtrList<nDimensionalMappedList<scalar> > > conditionalMoments_; | ||
90 | PtrList<PtrList<nDimensionalMappedPtrList<scalar>>> conditionalMoments_; | ||
91 | 91 | ||
92 | 92 | //- Inverted VanderMonde matricies | //- Inverted VanderMonde matricies |
93 | PtrList< nDimensionalMappedList<scalarSquareMatrix> > invVR_; | ||
93 | PtrList< nDimensionalMappedPtrList<scalarSquareMatrix>> invVR_; | ||
94 | |||
95 | //- Univariate moment inversion method | ||
96 | autoPtr<univariateMomentInversion> momentInverter_; | ||
97 | |||
94 | 98 | ||
95 | 99 | // Private member functions | // Private member functions |
96 | 100 | ||
... | ... | class multivariateMomentInversion | |
124 | 128 | void reset(); | void reset(); |
125 | 129 | ||
126 | 130 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
127 | //multivariateMomentInversion(const multivariateMomentInversion&); | ||
131 | //conditionalMomentInversion(const conditionalMomentInversion&); | ||
128 | 132 | ||
129 | 133 | //- Disallow default bitwise assignment | //- Disallow default bitwise assignment |
130 | //void operator=(const multivariateMomentInversion&); | ||
134 | //void operator=(const conditionalMomentInversion&); | ||
131 | 135 | ||
132 | 136 | ||
133 | 137 | public: | public: |
... | ... | public: | |
135 | 139 | // Constructors | // Constructors |
136 | 140 | ||
137 | 141 | // Construct from nMoments, momentMap, nNodes, and support type | // Construct from nMoments, momentMap, nNodes, and support type |
138 | multivariateMomentInversion | ||
142 | conditionalMomentInversion | ||
139 | 143 | ( | ( |
144 | const dictionary& dict, | ||
140 | 145 | const label nMoments, | const label nMoments, |
141 | 146 | const Map<label> map, | const Map<label> map, |
142 | 147 | const labelList& nNodes, | const labelList& nNodes, |
... | ... | public: | |
145 | 150 | ||
146 | 151 | ||
147 | 152 | //- Destructor | //- Destructor |
148 | virtual ~multivariateMomentInversion(); | ||
153 | virtual ~conditionalMomentInversion(); | ||
149 | 154 | ||
150 | 155 | ||
151 | 156 | // Member Functions | // Member Functions |
152 | 157 | ||
153 | 158 | //- Invert moments to find weights and abscissae | //- Invert moments to find weights and abscissae |
154 | void invert(const nDimensionalMappedList<scalar>& moments); | ||
159 | void invert(const nDimensionalMappedPtrList<scalar>& moments); | ||
155 | 160 | ||
156 | 161 | //- Return number of moments | //- Return number of moments |
157 | 162 | inline label nMoments(); | inline label nMoments(); |
... | ... | public: | |
160 | 165 | inline const labelList& nNodes(); | inline const labelList& nNodes(); |
161 | 166 | ||
162 | 167 | //- Return mapped quadrature weights for each dimension | //- Return mapped quadrature weights for each dimension |
163 | inline const PtrList<nDimensionalMappedList<scalar> >& weights() const; | ||
168 | inline const PtrList<nDimensionalMappedPtrList<scalar>>& weights() const; | ||
164 | 169 | ||
165 | 170 | //- Return mapped quadrature abscissae for each dimension | //- Return mapped quadrature abscissae for each dimension |
166 | inline const PtrList<nDimensionalMappedList<scalar> >& abscissae() const; | ||
171 | inline const PtrList<nDimensionalMappedPtrList<scalar>>& abscissae() const; | ||
167 | 172 | }; | }; |
168 | 173 | ||
169 | 174 | ||
... | ... | public: | |
174 | 179 | ||
175 | 180 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
176 | 181 | ||
177 | #include "multivariateMomentInversionI.H" | ||
182 | #include "conditionalMomentInversionI.H" | ||
178 | 183 | ||
179 | 184 | #endif | #endif |
180 | 185 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/multivariate/conditional/conditionalMomentInversionI.H renamed from multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/multivariateMomentInversionI.H (similarity 77%) (mode: 100644) (index a9be43b..fcedf9c) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
27 | 27 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
28 | 28 | ||
29 | 29 | //- Return the total number of moments | //- Return the total number of moments |
30 | Foam::label Foam::multivariateMomentInversion::nMoments() | ||
30 | Foam::label Foam::conditionalMomentInversion::nMoments() | ||
31 | 31 | { | { |
32 | 32 | return nMoments_; | return nMoments_; |
33 | 33 | } | } |
34 | 34 | ||
35 | 35 | //- Return the list of nNodes | //- Return the list of nNodes |
36 | const Foam::labelList& Foam::multivariateMomentInversion::nNodes() | ||
36 | const Foam::labelList& Foam::conditionalMomentInversion::nNodes() | ||
37 | 37 | { | { |
38 | 38 | return nNodes_; | return nNodes_; |
39 | 39 | } | } |
40 | 40 | ||
41 | 41 | //- Return mapped list of weights | //- Return mapped list of weights |
42 | const Foam::PtrList< Foam::nDimensionalMappedList< Foam::scalar> >& | ||
43 | Foam::multivariateMomentInversion::weights() const | ||
42 | const Foam::PtrList<Foam::nDimensionalMappedPtrList< Foam::scalar>>& | ||
43 | Foam::conditionalMomentInversion::weights() const | ||
44 | 44 | { | { |
45 | 45 | return weights_; | return weights_; |
46 | 46 | } | } |
47 | 47 | ||
48 | 48 | //- Return mapped list of abscissae | //- Return mapped list of abscissae |
49 | const Foam::PtrList< Foam::nDimensionalMappedList< Foam::scalar> >& | ||
50 | Foam::multivariateMomentInversion::abscissae() const | ||
49 | const Foam::PtrList< Foam::nDimensionalMappedPtrList< Foam::scalar> >& | ||
50 | Foam::conditionalMomentInversion::abscissae() const | ||
51 | 51 | { | { |
52 | 52 | return abscissae_; | return abscissae_; |
53 | 53 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/Make/files added (mode: 100644) (index 0000000..a8ee8fc) | |||
1 | univariateMomentInversion/univariateMomentInversion.C | ||
2 | univariateMomentInversion/newUnivariateMomentInversion.C | ||
3 | gaussMomentInversion/gaussMomentInversion.C | ||
4 | gaussLobattoMomentInversion/gaussLobattoMomentInversion.C | ||
5 | gaussRadauMomentInversion/gaussRadauMomentInversion.C | ||
6 | hyperbolicMomentInversion/hyperbolicMomentInversion.C | ||
7 | |||
8 | LIB = $(FOAM_USER_LIBBIN)/libmomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/Make/options renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/Make/options (similarity 52%) (mode: 100644) (index 240fa11..6a4db85) | |||
1 | 1 | EXE_INC = \ | EXE_INC = \ |
2 | 2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
3 | -I../../eigenSolver/lnInclude \ | ||
4 | -I../univariateMomentSet/lnInclude | ||
3 | -I../../../../eigenSolver/lnInclude \ | ||
4 | -I../../../../mappedList \ | ||
5 | -I../../../momentSets/lnInclude | ||
5 | 6 | ||
6 | 7 | LIB_LIBS = \ | LIB_LIBS = \ |
7 | 8 | -lfiniteVolume \ | -lfiniteVolume \ |
8 | 9 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
9 | 10 | -leigenSolver \ | -leigenSolver \ |
10 | -lmomentSet | ||
11 | -lmomentSets |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussLobattoMomentInversion/gaussLobattoMomentInversion.C added (mode: 100644) (index 0000000..f6f01a4) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | #include "gaussLobattoMomentInversion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
30 | |||
31 | namespace Foam | ||
32 | { | ||
33 | defineTypeNameAndDebug(gaussLobattoMomentInversion, 0); | ||
34 | |||
35 | addToRunTimeSelectionTable | ||
36 | ( | ||
37 | univariateMomentInversion, | ||
38 | gaussLobattoMomentInversion, | ||
39 | dictionary | ||
40 | ); | ||
41 | } | ||
42 | |||
43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
44 | |||
45 | Foam::gaussLobattoMomentInversion::gaussLobattoMomentInversion | ||
46 | ( | ||
47 | const dictionary& dict | ||
48 | ) | ||
49 | : | ||
50 | univariateMomentInversion(dict), | ||
51 | forceRadau_(false) | ||
52 | {} | ||
53 | |||
54 | |||
55 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
56 | |||
57 | Foam::gaussLobattoMomentInversion::~gaussLobattoMomentInversion() | ||
58 | {} | ||
59 | |||
60 | |||
61 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
62 | |||
63 | void Foam::gaussLobattoMomentInversion::correctRecurrence | ||
64 | ( | ||
65 | univariateMomentSet& moments, | ||
66 | scalarList& alpha, | ||
67 | scalarList& beta, | ||
68 | const scalar minKnownAbscissa, | ||
69 | const scalar maxKnownAbscissa | ||
70 | ) | ||
71 | { | ||
72 | if (forceRadau_) | ||
73 | { | ||
74 | scalar p = minKnownAbscissa - alpha[0]; | ||
75 | scalar pMinus1 = 1.0; | ||
76 | scalar p1 = p; | ||
77 | |||
78 | for (label i = 1; i < nNodes_ - 1; i++) | ||
79 | { | ||
80 | p = minKnownAbscissa - alpha[0]*p1 | ||
81 | - beta[i]*pMinus1; | ||
82 | |||
83 | pMinus1 = p1; | ||
84 | p1 = p; | ||
85 | } | ||
86 | |||
87 | alpha[nNodes_ - 1] = | ||
88 | minKnownAbscissa - beta[nNodes_ - 1]*pMinus1/p; | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | scalar pLeft = minKnownAbscissa - alpha[0]; | ||
93 | scalar pRight = maxKnownAbscissa - alpha[0]; | ||
94 | |||
95 | scalar pMinus1Left = 1.0; | ||
96 | scalar pMinus1Right = 1.0; | ||
97 | |||
98 | scalar p1Left = pLeft; | ||
99 | scalar p1Right = pRight; | ||
100 | |||
101 | for (label i = 1; i < nNodes_ - 1; i++) | ||
102 | { | ||
103 | pLeft = (minKnownAbscissa - alpha[i])*p1Left | ||
104 | - beta[i]*pMinus1Left; | ||
105 | |||
106 | pRight = (maxKnownAbscissa - alpha[i])*p1Right | ||
107 | - beta[i]*pMinus1Right; | ||
108 | |||
109 | pMinus1Left = p1Left; | ||
110 | pMinus1Right = p1Right; | ||
111 | p1Left = pLeft; | ||
112 | p1Right = pRight; | ||
113 | } | ||
114 | |||
115 | scalar d = pLeft*pMinus1Right - pRight*pMinus1Left; | ||
116 | |||
117 | alpha[nNodes_ - 1] = | ||
118 | (minKnownAbscissa*pLeft*pMinus1Right | ||
119 | - maxKnownAbscissa*pRight*pMinus1Left)/d; | ||
120 | |||
121 | beta[nNodes_ - 1] = | ||
122 | (maxKnownAbscissa - minKnownAbscissa)*pLeft*pRight/d; | ||
123 | } | ||
124 | } | ||
125 | |||
126 | void Foam::gaussLobattoMomentInversion::calcNQuadratureNodes | ||
127 | ( | ||
128 | univariateMomentSet& moments | ||
129 | ) | ||
130 | { | ||
131 | label nRealizableMoments = moments.nRealizableMoments(); | ||
132 | |||
133 | if (nRealizableMoments > 2) | ||
134 | { | ||
135 | if (nRealizableMoments % 2 == 0) | ||
136 | { | ||
137 | nInvertibleMoments_ = nRealizableMoments; | ||
138 | forceRadau_ = false; | ||
139 | nNodes_ = nInvertibleMoments_/2 + 1; | ||
140 | } | ||
141 | else | ||
142 | { | ||
143 | nInvertibleMoments_ = nRealizableMoments; | ||
144 | forceRadau_ = true; | ||
145 | nNodes_ = nInvertibleMoments_/2 + 1; | ||
146 | } | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | FatalErrorInFunction | ||
151 | << "The moment has size less or equal to 2." << nl | ||
152 | << " Moment set: " << moments | ||
153 | << abort(FatalError); | ||
154 | } | ||
155 | |||
156 | abscissae_.setSize(nNodes_); | ||
157 | weights_.setSize(nNodes_); | ||
158 | } | ||
159 | |||
160 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussLobattoMomentInversion/gaussLobattoMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 56%) (mode: 100644) (index 9254c4b..8089d0c) | |||
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) 2014-2017 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::gaussLobattoMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Performs Gauss-Lobatto quadrature on a moment set with an even number of | ||
29 | moments. | ||
29 | 30 | ||
30 | 31 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
32 | gaussLobattoMomentInversion.C | ||
33 | gaussLobattoMomentInversionI.H | ||
32 | 34 | ||
33 | 35 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 36 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
37 | #ifndef gaussLobattoMomentInversion_H | ||
38 | #define gaussLobattoMomentInversion_H | ||
39 | |||
40 | #include "univariateMomentInversion.H" | ||
37 | 41 | ||
38 | #include "mixingModel.H" | ||
39 | 42 | ||
40 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 44 | ||
42 | 45 | namespace Foam | namespace Foam |
43 | 46 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | 47 | ||
47 | 48 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
49 | Class gaussLobattoMomentInversion Declaration | ||
49 | 50 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 51 | ||
51 | class noMixing | ||
52 | class gaussLobattoMomentInversion | ||
52 | 53 | : | : |
53 | public mixingModel | ||
54 | public univariateMomentInversion | ||
54 | 55 | { | { |
55 | 56 | // Private data | // Private data |
56 | 57 | ||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
58 | // Bool to check if Radau quadrature must be performed | ||
59 | bool forceRadau_; | ||
59 | 60 | ||
60 | 61 | ||
61 | 62 | public: | public: |
62 | 63 | ||
63 | 64 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
65 | TypeName("GaussLobatto"); | ||
65 | 66 | ||
66 | 67 | ||
67 | 68 | // Constructors | // Constructors |
68 | 69 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
70 | //- Construct from univariateMomentSet | ||
71 | gaussLobattoMomentInversion | ||
71 | 72 | ( | ( |
72 | const word& name, | ||
73 | const dictionary& dict, | ||
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
73 | const dictionary& dict | ||
76 | 74 | ); | ); |
77 | 75 | ||
78 | 76 | ||
79 | 77 | //- Destructor | //- Destructor |
80 | virtual ~noMixing(); | ||
78 | virtual ~gaussLobattoMomentInversion(); | ||
79 | |||
81 | 80 | ||
82 | // Member Functions | ||
81 | // Public member functions | ||
82 | |||
83 | //- Modify the recurrence relation for fixed-point quadrature | ||
84 | virtual void correctRecurrence | ||
85 | ( | ||
86 | univariateMomentSet& moments, | ||
87 | scalarList& alpha, | ||
88 | scalarList& beta, | ||
89 | const scalar minKnownAbscissa = 0, | ||
90 | const scalar maxKnownAbscissa = 0 | ||
91 | ); | ||
83 | 92 | ||
84 | //- Solve mixing model | ||
85 | void solve(); | ||
93 | //- Calculates the number of quadrature nodes | ||
94 | virtual void calcNQuadratureNodes | ||
95 | ( | ||
96 | univariateMomentSet& moments | ||
97 | ); | ||
86 | 98 | }; | }; |
87 | 99 | ||
88 | 100 | ||
89 | 101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
90 | 102 | ||
91 | } // End namespace mixingModels | ||
92 | 103 | } // End namespace Foam | } // End namespace Foam |
93 | 104 | ||
105 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
106 | |||
107 | |||
94 | 108 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
95 | 109 | ||
96 | 110 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussMomentInversion/gaussMomentInversion.C copied from file multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C (similarity 58%) (mode: 100644) (index d677437..800a8ce) | |||
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) 2014-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "Brownian.H" | ||
26 | #include "gaussMomentInversion.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | 28 | ||
31 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
32 | 30 | ||
33 | 31 | namespace Foam | namespace Foam |
34 | 32 | { | { |
35 | namespace populationBalanceSubModels | ||
36 | { | ||
37 | namespace aggregationKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(Brownian, 0); | ||
33 | defineTypeNameAndDebug(gaussMomentInversion, 0); | ||
40 | 34 | ||
41 | 35 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
42 | 36 | ( | ( |
43 | aggregationKernel, | ||
44 | Brownian, | ||
37 | univariateMomentInversion, | ||
38 | gaussMomentInversion, | ||
45 | 39 | dictionary | dictionary |
46 | 40 | ); | ); |
47 | 41 | } | } |
48 | } | ||
49 | } | ||
50 | |||
51 | 42 | ||
52 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
53 | 44 | ||
54 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | ||
55 | ::Brownian | ||
45 | Foam::gaussMomentInversion::gaussMomentInversion | ||
56 | 46 | ( | ( |
57 | 47 | const dictionary& dict | const dictionary& dict |
58 | 48 | ) | ) |
59 | 49 | : | : |
60 | aggregationKernel(dict) | ||
50 | univariateMomentInversion(dict) | ||
61 | 51 | {} | {} |
62 | 52 | ||
63 | 53 | ||
64 | 54 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
65 | 55 | ||
66 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | ||
67 | ::~Brownian() | ||
56 | Foam::gaussMomentInversion::~gaussMomentInversion() | ||
68 | 57 | {} | {} |
69 | 58 | ||
70 | 59 | ||
71 | 60 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 61 | ||
73 | Foam::tmp<Foam::volScalarField> | ||
74 | Foam::populationBalanceSubModels::aggregationKernels::Brownian::Ka | ||
62 | void Foam::gaussMomentInversion::correctRecurrence | ||
75 | 63 | ( | ( |
76 | const volScalarField& abscissa1, | ||
77 | const volScalarField& abscissa2 | ||
78 | ) const | ||
64 | univariateMomentSet& moments, | ||
65 | scalarList& alpha, | ||
66 | scalarList& beta, | ||
67 | const scalar minKnownAbscissa, | ||
68 | const scalar maxKnownAbscissa | ||
69 | ) | ||
79 | 70 | { | { |
80 | if (!abscissa1.mesh().foundObject<fluidThermo>(basicThermo::dictName)) | ||
71 | return; // No correction needed for Gauss quadrature | ||
72 | } | ||
73 | |||
74 | void Foam::gaussMomentInversion::calcNQuadratureNodes | ||
75 | ( | ||
76 | univariateMomentSet& moments | ||
77 | ) | ||
78 | { | ||
79 | label nRealizableMoments = moments.nRealizableMoments(); | ||
80 | |||
81 | if (nRealizableMoments >= 2) | ||
82 | { | ||
83 | if (nRealizableMoments % 2 != 0) | ||
84 | { | ||
85 | nInvertibleMoments_ = nRealizableMoments - 1; | ||
86 | } | ||
87 | else | ||
88 | { | ||
89 | nInvertibleMoments_ = nRealizableMoments; | ||
90 | } | ||
91 | } | ||
92 | else | ||
81 | 93 | { | { |
82 | 94 | FatalErrorInFunction | FatalErrorInFunction |
83 | << "No valid thermophysical model found." | ||
95 | << "The moment set has size less or equal to 1." << nl | ||
96 | << " Moment set: " << moments | ||
84 | 97 | << abort(FatalError); | << abort(FatalError); |
85 | 98 | } | } |
86 | 99 | ||
87 | const fluidThermo& flThermo = | ||
88 | abscissa1.mesh().lookupObject<fluidThermo>(basicThermo::dictName); | ||
89 | |||
90 | dimensionedScalar smallAbs("smallAbs", sqr(abscissa1.dimensions()), SMALL); | ||
100 | nNodes_ = nInvertibleMoments_/2; | ||
91 | 101 | ||
92 | return | ||
93 | 2.0*Foam::constant::physicoChemical::k*flThermo.T() | ||
94 | *sqr(abscissa1 + abscissa2)/(3.0*flThermo.mu() | ||
95 | *max(abscissa1*abscissa2, smallAbs)); | ||
102 | abscissae_.setSize(nNodes_); | ||
103 | weights_.setSize(nNodes_); | ||
96 | 104 | } | } |
97 | 105 | ||
98 | 106 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussMomentInversion/gaussMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 59%) (mode: 100644) (index 9254c4b..37de44c) | |||
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) 2014-2017 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::gaussMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Performs Gaussian quadrature on a moment set with an even numer of moments. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | gaussMomentInversion.C | ||
32 | gaussMomentInversionI.H | ||
32 | 33 | ||
33 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 35 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
36 | #ifndef gaussMomentInversion_H | ||
37 | #define gaussMomentInversion_H | ||
38 | |||
39 | #include "univariateMomentInversion.H" | ||
37 | 40 | ||
38 | #include "mixingModel.H" | ||
39 | 41 | ||
40 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 43 | ||
42 | 44 | namespace Foam | namespace Foam |
43 | 45 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | 46 | ||
47 | 47 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
48 | Class gaussMomentInversion Declaration | ||
49 | 49 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 50 | ||
51 | class noMixing | ||
51 | class gaussMomentInversion | ||
52 | 52 | : | : |
53 | public mixingModel | ||
53 | public univariateMomentInversion | ||
54 | 54 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 55 | public: | public: |
62 | 56 | ||
63 | 57 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
58 | TypeName("Gauss"); | ||
65 | 59 | ||
66 | 60 | ||
67 | 61 | // Constructors | // Constructors |
68 | 62 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
63 | //- Construct from univariateMomentSet | ||
64 | gaussMomentInversion | ||
71 | 65 | ( | ( |
72 | const word& name, | ||
73 | const dictionary& dict, | ||
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
66 | const dictionary& dict | ||
76 | 67 | ); | ); |
77 | 68 | ||
78 | 69 | ||
79 | 70 | //- Destructor | //- Destructor |
80 | virtual ~noMixing(); | ||
71 | virtual ~gaussMomentInversion(); | ||
72 | |||
73 | |||
74 | // Public member functions | ||
81 | 75 | ||
82 | // Member Functions | ||
76 | //- Modify the recurrence relation for fixed-point quadrature | ||
77 | virtual void correctRecurrence | ||
78 | ( | ||
79 | univariateMomentSet& moments, | ||
80 | scalarList& alpha, | ||
81 | scalarList& beta, | ||
82 | const scalar minKnownAbscissa = 0, | ||
83 | const scalar maxKnownAbscissa = 0 | ||
84 | ); | ||
83 | 85 | ||
84 | //- Solve mixing model | ||
85 | void solve(); | ||
86 | //- Calculates the number of quadrature nodes | ||
87 | virtual void calcNQuadratureNodes | ||
88 | ( | ||
89 | univariateMomentSet& moments | ||
90 | ); | ||
86 | 91 | }; | }; |
87 | 92 | ||
88 | 93 | ||
89 | 94 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
90 | 95 | ||
91 | } // End namespace mixingModels | ||
92 | 96 | } // End namespace Foam | } // End namespace Foam |
93 | 97 | ||
98 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
99 | |||
100 | |||
94 | 101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
95 | 102 | ||
96 | 103 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussRadauMomentInversion/gaussRadauMomentInversion.C copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/mixingSubModels/mixingKernels/IEM/IEM.C (similarity 50%) (mode: 100644) (index f87f8f4..e9766a6) | |||
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) 2014-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "IEM.H" | ||
26 | #include "gaussRadauMomentInversion.H" | ||
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | #include "fundamentalConstants.H" | ||
30 | 28 | ||
31 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
32 | 30 | ||
33 | 31 | namespace Foam | namespace Foam |
34 | 32 | { | { |
35 | namespace mixingSubModels | ||
36 | { | ||
37 | namespace mixingKernels | ||
38 | { | ||
39 | defineTypeNameAndDebug(IEM, 0); | ||
33 | defineTypeNameAndDebug(gaussRadauMomentInversion, 0); | ||
40 | 34 | ||
41 | 35 | addToRunTimeSelectionTable | addToRunTimeSelectionTable |
42 | 36 | ( | ( |
43 | mixingKernel, | ||
44 | IEM, | ||
37 | univariateMomentInversion, | ||
38 | gaussRadauMomentInversion, | ||
45 | 39 | dictionary | dictionary |
46 | 40 | ); | ); |
47 | 41 | } | } |
48 | } | ||
49 | } | ||
50 | |||
51 | 42 | ||
52 | 43 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
53 | 44 | ||
54 | Foam::mixingSubModels::mixingKernels::IEM | ||
55 | ::IEM | ||
45 | Foam::gaussRadauMomentInversion::gaussRadauMomentInversion | ||
56 | 46 | ( | ( |
57 | 47 | const dictionary& dict | const dictionary& dict |
58 | 48 | ) | ) |
59 | 49 | : | : |
60 | mixingKernel(dict) | ||
50 | univariateMomentInversion(dict), | ||
51 | forceGauss_(false) | ||
61 | 52 | {} | {} |
62 | 53 | ||
63 | 54 | ||
64 | 55 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
65 | 56 | ||
66 | Foam::mixingSubModels::mixingKernels::IEM | ||
67 | ::~IEM() | ||
57 | Foam::gaussRadauMomentInversion::~gaussRadauMomentInversion() | ||
68 | 58 | {} | {} |
69 | 59 | ||
70 | 60 | ||
71 | 61 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 62 | ||
73 | Foam::tmp<Foam::fvScalarMatrix> | ||
74 | Foam::mixingSubModels::mixingKernels::IEM::K | ||
63 | void Foam::gaussRadauMomentInversion::correctRecurrence | ||
75 | 64 | ( | ( |
76 | const volUnivariateMoment& moment, | ||
77 | const volUnivariateMomentFieldSet& moments | ||
78 | ) const | ||
65 | univariateMomentSet& moments, | ||
66 | scalarList& alpha, | ||
67 | scalarList& beta, | ||
68 | const scalar minKnownAbscissa, | ||
69 | const scalar maxKnownAbscissa | ||
70 | ) | ||
79 | 71 | { | { |
80 | typedef compressible::turbulenceModel cmpTurbModel; | ||
81 | |||
82 | if | ||
83 | ( | ||
84 | !moment.mesh().foundObject<cmpTurbModel> | ||
85 | ( | ||
86 | cmpTurbModel::propertiesName | ||
87 | ) | ||
88 | ) | ||
72 | if (!forceGauss_) | ||
89 | 73 | { | { |
90 | FatalErrorInFunction | ||
91 | << "No valid compressible turbulence model found." | ||
92 | << abort(FatalError); | ||
93 | } | ||
74 | scalar p = minKnownAbscissa - alpha[0]; | ||
75 | scalar pMinus1 = 1.0; | ||
76 | scalar p1 = p; | ||
94 | 77 | ||
95 | const compressible::turbulenceModel& flTurb = | ||
96 | moment.mesh().lookupObject<compressible::turbulenceModel> | ||
97 | ( | ||
98 | turbulenceModel::propertiesName | ||
99 | ); | ||
78 | for (label i = 1; i < nNodes_ - 1; i++) | ||
79 | { | ||
80 | p = minKnownAbscissa - alpha[0]*p1 - beta[i]*pMinus1; | ||
100 | 81 | ||
101 | label momentOrder = moment.order(); | ||
82 | pMinus1 = p1; | ||
83 | p1 = p; | ||
84 | } | ||
102 | 85 | ||
103 | tmp<fvScalarMatrix> mixingK | ||
104 | ( | ||
105 | new fvScalarMatrix | ||
106 | ( | ||
107 | moment, | ||
108 | moment.dimensions()*dimVol/dimTime | ||
109 | ) | ||
110 | ); | ||
86 | alpha[nNodes_ - 1] = | ||
87 | minKnownAbscissa - beta[nNodes_ - 1]*pMinus1/p; | ||
88 | } | ||
89 | } | ||
90 | |||
91 | void Foam::gaussRadauMomentInversion::calcNQuadratureNodes | ||
92 | ( | ||
93 | univariateMomentSet& moments | ||
94 | ) | ||
95 | { | ||
96 | label nRealizableMoments = moments.nRealizableMoments(); | ||
111 | 97 | ||
112 | if (momentOrder == 0) | ||
98 | if (nRealizableMoments >= 2) | ||
113 | 99 | { | { |
114 | return mixingK; | ||
100 | if (nRealizableMoments % 2 == 0) | ||
101 | { | ||
102 | nInvertibleMoments_ = nRealizableMoments; | ||
103 | forceGauss_ = true; | ||
104 | nNodes_ = nInvertibleMoments_/2; | ||
105 | } | ||
106 | else | ||
107 | { | ||
108 | nInvertibleMoments_ = nRealizableMoments; | ||
109 | forceGauss_ = false; | ||
110 | nNodes_ = (nInvertibleMoments_ - 1)/2 + 1; | ||
111 | } | ||
115 | 112 | } | } |
116 | 113 | else | else |
117 | 114 | { | { |
118 | mixingK.ref() += momentOrder*Cphi_*flTurb.epsilon()/flTurb.k() | ||
119 | *(moments[momentOrder - 1]*moments[1]) | ||
120 | - fvm::SuSp(momentOrder*Cphi_*flTurb.epsilon()/flTurb.k(), moment); | ||
115 | FatalErrorInFunction | ||
116 | << "The moment has size less or equal to 1." << nl | ||
117 | << " Moment set: " << moments | ||
118 | << abort(FatalError); | ||
121 | 119 | } | } |
122 | 120 | ||
123 | return mixingK; | ||
121 | abscissae_.setSize(nNodes_); | ||
122 | weights_.setSize(nNodes_); | ||
124 | 123 | } | } |
125 | 124 | ||
126 | 125 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/gaussRadauMomentInversion/gaussRadauMomentInversion.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 56%) (mode: 100644) (index 9254c4b..7935fb0) | |||
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) 2014-2017 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::gaussRadauMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Performs Gauss-Lobatto quadrature on a moment set with an even number of | ||
29 | moments. | ||
29 | 30 | ||
30 | 31 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
32 | gaussRadauMomentInversion.C | ||
33 | gaussRadauMomentInversionI.H | ||
32 | 34 | ||
33 | 35 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 36 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
37 | #ifndef gaussRadauMomentInversion_H | ||
38 | #define gaussRadauMomentInversion_H | ||
39 | |||
40 | #include "univariateMomentInversion.H" | ||
37 | 41 | ||
38 | #include "mixingModel.H" | ||
39 | 42 | ||
40 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 44 | ||
42 | 45 | namespace Foam | namespace Foam |
43 | 46 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | 47 | ||
47 | 48 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
49 | Class gaussRadauMomentInversion Declaration | ||
49 | 50 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 51 | ||
51 | class noMixing | ||
52 | class gaussRadauMomentInversion | ||
52 | 53 | : | : |
53 | public mixingModel | ||
54 | public univariateMomentInversion | ||
54 | 55 | { | { |
55 | 56 | // Private data | // Private data |
56 | 57 | ||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
58 | // Bool to check if Gauss quadrature must be performed | ||
59 | bool forceGauss_; | ||
59 | 60 | ||
60 | 61 | ||
61 | 62 | public: | public: |
62 | 63 | ||
63 | 64 | //- Runtime type information | //- Runtime type information |
64 | TypeName("none"); | ||
65 | TypeName("GaussRadau"); | ||
65 | 66 | ||
66 | 67 | ||
67 | 68 | // Constructors | // Constructors |
68 | 69 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
70 | //- Construct from univariateMomentSet | ||
71 | gaussRadauMomentInversion | ||
71 | 72 | ( | ( |
72 | const word& name, | ||
73 | const dictionary& dict, | ||
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
73 | const dictionary& dict | ||
76 | 74 | ); | ); |
77 | 75 | ||
78 | 76 | ||
79 | 77 | //- Destructor | //- Destructor |
80 | virtual ~noMixing(); | ||
78 | virtual ~gaussRadauMomentInversion(); | ||
79 | |||
81 | 80 | ||
82 | // Member Functions | ||
81 | // Public member functions | ||
82 | |||
83 | //- Modify the recurrence relation for fixed-point quadrature | ||
84 | virtual void correctRecurrence | ||
85 | ( | ||
86 | univariateMomentSet& moments, | ||
87 | scalarList& alpha, | ||
88 | scalarList& beta, | ||
89 | const scalar minKnownAbscissa = 0, | ||
90 | const scalar maxKnownAbscissa = 0 | ||
91 | ); | ||
83 | 92 | ||
84 | //- Solve mixing model | ||
85 | void solve(); | ||
93 | //- Calculates the number of quadrature nodes | ||
94 | virtual void calcNQuadratureNodes | ||
95 | ( | ||
96 | univariateMomentSet& moments | ||
97 | ); | ||
86 | 98 | }; | }; |
87 | 99 | ||
88 | 100 | ||
89 | 101 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
90 | 102 | ||
91 | } // End namespace mixingModels | ||
92 | 103 | } // End namespace Foam | } // End namespace Foam |
93 | 104 | ||
105 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
106 | |||
107 | |||
94 | 108 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
95 | 109 | ||
96 | 110 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/hyperbolicMomentInversion/hyperbolicMomentInversion.C added (mode: 100644) (index 0000000..8ac0af8) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | #include "hyperbolicMomentInversion.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
28 | |||
29 | #include "error.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | defineTypeNameAndDebug(hyperbolicMomentInversion, 0); | ||
36 | |||
37 | addToRunTimeSelectionTable | ||
38 | ( | ||
39 | univariateMomentInversion, | ||
40 | hyperbolicMomentInversion, | ||
41 | dictionary | ||
42 | ); | ||
43 | } | ||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
46 | |||
47 | Foam::hyperbolicMomentInversion::hyperbolicMomentInversion | ||
48 | ( | ||
49 | const dictionary& dict | ||
50 | ) | ||
51 | : | ||
52 | univariateMomentInversion(dict), | ||
53 | etaMin_(dict.lookupOrDefault("etaMin", 1.0e-10)), | ||
54 | qMax_(dict.lookupOrDefault("qMax", 30.0)), | ||
55 | smallNegRealizability_ | ||
56 | ( | ||
57 | dict.lookupOrDefault | ||
58 | ( | ||
59 | "smallNegRealizability", | ||
60 | 1.0e-6 | ||
61 | ) | ||
62 | ) | ||
63 | { | ||
64 | nInvertibleMoments_ = 5; | ||
65 | nNodes_ = 3; | ||
66 | weights_.setSize(nNodes_, 0.0); | ||
67 | abscissae_.setSize(nNodes_, 0.0); | ||
68 | } | ||
69 | |||
70 | |||
71 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
72 | |||
73 | Foam::hyperbolicMomentInversion::~hyperbolicMomentInversion() | ||
74 | {} | ||
75 | |||
76 | |||
77 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
78 | |||
79 | void Foam::hyperbolicMomentInversion::correctRecurrence | ||
80 | ( | ||
81 | univariateMomentSet& moments, | ||
82 | scalarList& alpha, | ||
83 | scalarList& beta, | ||
84 | const scalar minKnownAbscissa, | ||
85 | const scalar maxKnownAbscissa | ||
86 | ) | ||
87 | { | ||
88 | NotImplemented; | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | void Foam::hyperbolicMomentInversion::calcNQuadratureNodes | ||
93 | ( | ||
94 | univariateMomentSet& moments | ||
95 | ) | ||
96 | { | ||
97 | nInvertibleMoments_ = 5; | ||
98 | nNodes_ = 3; | ||
99 | } | ||
100 | |||
101 | void Foam::hyperbolicMomentInversion::invert | ||
102 | ( | ||
103 | univariateMomentSet& moments, | ||
104 | const scalar minKnownAbscissa, | ||
105 | const scalar maxKnownAbscissa | ||
106 | ) | ||
107 | { | ||
108 | if (moments[0] < SMALL) | ||
109 | { | ||
110 | weights_[1] = moments[0]; | ||
111 | |||
112 | return; | ||
113 | } | ||
114 | |||
115 | // Compute normalized moments | ||
116 | scalarList normalisedMoments(nInvertibleMoments_); | ||
117 | |||
118 | forAll(normalisedMoments, mi) | ||
119 | { | ||
120 | normalisedMoments[mi] /= moments[0]; | ||
121 | } | ||
122 | |||
123 | scalar meanVelocity = normalisedMoments[1]; | ||
124 | |||
125 | // Compute central moments | ||
126 | scalarList centralMoments(nInvertibleMoments_, 0.0); | ||
127 | |||
128 | centralMoments[0] = 1.0; | ||
129 | centralMoments[2] = normalisedMoments[2] - sqr(meanVelocity); | ||
130 | |||
131 | centralMoments[3] = | ||
132 | normalisedMoments[3] | ||
133 | - 3.0*meanVelocity*normalisedMoments[2] | ||
134 | + 2.0*pow3(meanVelocity); | ||
135 | |||
136 | centralMoments[4] = | ||
137 | normalisedMoments[4] | ||
138 | - 4.0*meanVelocity*normalisedMoments[3] | ||
139 | + 6.0*sqr(meanVelocity)*normalisedMoments[2] | ||
140 | - 3.0*pow4(meanVelocity); | ||
141 | |||
142 | // Compute realizability condition | ||
143 | scalar realizability = | ||
144 | centralMoments[2]*centralMoments[4] | ||
145 | - pow3(centralMoments[2]) | ||
146 | - sqr(centralMoments[3]); | ||
147 | |||
148 | // Manage unrealizable cases | ||
149 | if (centralMoments[2] < 0.0) | ||
150 | { | ||
151 | if (centralMoments[2] < SMALL) | ||
152 | { | ||
153 | WarningInFunction | ||
154 | << "Second-order central moment is negative. C2 = " | ||
155 | << centralMoments[2] | ||
156 | << endl; | ||
157 | |||
158 | for (label ci = 2; ci < nInvertibleMoments_; ci++) | ||
159 | { | ||
160 | centralMoments[ci] = 0.0; | ||
161 | } | ||
162 | } | ||
163 | else if (realizability < 0) | ||
164 | { | ||
165 | if (centralMoments[2] >= etaMin_) | ||
166 | { | ||
167 | scalar c2 = centralMoments[2]; | ||
168 | scalar sqrC2 = sqr(c2); | ||
169 | scalar sqrtC2 = sqrt(c2); | ||
170 | |||
171 | scalar q = centralMoments[3]/(c2*sqrtC2); | ||
172 | scalar eta = centralMoments[4]/sqrC2; | ||
173 | |||
174 | if (mag(q) > SMALL) | ||
175 | { | ||
176 | scalar slope = (eta - 3.0)/q; | ||
177 | scalar sqrtDet = sqrt(8.0 + sqr(slope)); | ||
178 | |||
179 | if (q > 0.0) | ||
180 | { | ||
181 | q = (slope + sqrtDet)/2.0; | ||
182 | } | ||
183 | else | ||
184 | { | ||
185 | q = (slope - sqrtDet)/2.0; | ||
186 | } | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | q = 0.0; | ||
191 | } | ||
192 | |||
193 | eta = 1.0 + sqr(q); | ||
194 | centralMoments[3] = q*c2*sqrtC2; | ||
195 | centralMoments[4] = eta*sqrC2; | ||
196 | |||
197 | if (realizability < smallNegRealizability_) | ||
198 | { | ||
199 | WarningInFunction | ||
200 | << "Fourth-order central moment is too small." | ||
201 | << " Realizability = " << realizability | ||
202 | << endl; | ||
203 | } | ||
204 | } | ||
205 | else | ||
206 | { | ||
207 | centralMoments[3] = 0.0; | ||
208 | centralMoments[4] = sqr(centralMoments[2]); | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | |||
213 | // Find scaled parameters | ||
214 | scalar c2 = centralMoments[2]; | ||
215 | scalar sqrC2 = sqr(c2); | ||
216 | scalar sqrtC2 = sqrt(c2); | ||
217 | scalar q = 0.0; | ||
218 | scalar eta = 0.0; | ||
219 | |||
220 | if (c2 > etaMin_) | ||
221 | { | ||
222 | q = centralMoments[3]/(c2*sqrtC2); | ||
223 | eta = centralMoments[4]/sqrC2; | ||
224 | } | ||
225 | else | ||
226 | { | ||
227 | q = 0.0; | ||
228 | eta = 1.0; | ||
229 | } | ||
230 | |||
231 | // Bind skewness | ||
232 | if (sqr(q) > sqr(qMax_)) | ||
233 | { | ||
234 | scalar slope = (eta - 3.0); | ||
235 | q = qMax_*sign(q); | ||
236 | eta = 3.0 + q*slope; | ||
237 | realizability = eta - sqr(q) - 1.0; | ||
238 | |||
239 | if (realizability < 0.0) | ||
240 | { | ||
241 | eta = 1.0 + sqr(q); | ||
242 | } | ||
243 | } | ||
244 | |||
245 | scalar sqrQ = sqr(q); | ||
246 | scalar sqrtZ = sqrt(4.0*eta - 3.0*sqrQ); | ||
247 | scalar invSqrtZ = 1.0/sqrtZ; | ||
248 | |||
249 | // Compute unscaled abscissae | ||
250 | abscissae_[0] = 0.5*(q - sqrtZ); | ||
251 | abscissae_[1] = 0.0; | ||
252 | abscissae_[2] = 0.5*(q + sqrtZ); | ||
253 | |||
254 | scalar abscissaeProd = max(- abscissae_[0]*abscissae_[2], 1.0 + SMALL); | ||
255 | |||
256 | // Compute weights | ||
257 | weights_[0] = - invSqrtZ/abscissae_[0]; | ||
258 | weights_[1] = 1.0 - 1.0/abscissaeProd; | ||
259 | weights_[2] = invSqrtZ/abscissae_[2]; | ||
260 | |||
261 | // Sum weights | ||
262 | scalar weightSum = 0.0; | ||
263 | forAll(weights_, wi) | ||
264 | { | ||
265 | weightSum += weights_[wi]; | ||
266 | } | ||
267 | |||
268 | // Rescale weights | ||
269 | forAll(weights_, wi) | ||
270 | { | ||
271 | weights_[wi] /= weightSum; | ||
272 | } | ||
273 | |||
274 | scalar scaleFactor = 0.0; | ||
275 | |||
276 | forAll(weights_, wi) | ||
277 | { | ||
278 | scaleFactor += weights_[wi]*sqr(abscissae_[wi])/weightSum; | ||
279 | } | ||
280 | |||
281 | // Rescale abscissae | ||
282 | forAll(abscissae_, ai) | ||
283 | { | ||
284 | abscissae_[ai] /= sqrtC2/scaleFactor; | ||
285 | } | ||
286 | |||
287 | forAll(weights_, wi) | ||
288 | { | ||
289 | weights_[wi] *= moments[0]; | ||
290 | |||
291 | if (weights_[wi] < 0.0) | ||
292 | { | ||
293 | FatalErrorInFunction | ||
294 | << "Negative weight in hyperbolic moment inversion." | ||
295 | << exit(FatalError); | ||
296 | } | ||
297 | |||
298 | abscissae_[wi] += meanVelocity; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/hyperbolicMomentInversion/hyperbolicMomentInversion.H copied from file multiphaseEulerPbeFoam/Vandermonde/Vandermonde.H (similarity 54%) (mode: 100644) (index f5f9ce2..24f2d05) | |||
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) 2014-2017 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::Vandermonde | ||
25 | Foam::hyperbolicMomentInversion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Stores the second row of a Vandermonde matrix, and solves the associated | ||
29 | linear system. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | William H. Press, Saul A. Teukolsky, | ||
34 | William T. Vetterling, and Brian P. Flannery. 1992. | ||
35 | "Numerical Recipes in C (2nd Ed.): The Art of Scientific Computing." | ||
36 | Cambridge University Press, New York, NY, USA. | ||
37 | \endverbatim | ||
28 | Performs three-node hyperbolic moment inversion given five moments. | ||
38 | 29 | ||
39 | 30 | SourceFiles | SourceFiles |
40 | Vandermonde.C | ||
31 | hyperbolicMomentInversion.C | ||
41 | 32 | ||
42 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
43 | 34 | ||
44 | #ifndef Vandermonde_H | ||
45 | #define Vandermonde_H | ||
35 | #ifndef gaussMomentInversion_H | ||
36 | #define gaussMomentInversion_H | ||
46 | 37 | ||
47 | #include "scalarMatrices.H" | ||
38 | #include "univariateMomentInversion.H" | ||
48 | 39 | ||
49 | 40 | ||
50 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
... | ... | namespace Foam | |
53 | 44 | { | { |
54 | 45 | ||
55 | 46 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
56 | Class Vandermonde Declaration | ||
47 | Class hyperbolicMomentInversion Declaration | ||
57 | 48 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
58 | 49 | ||
59 | class Vandermonde | ||
50 | class hyperbolicMomentInversion | ||
60 | 51 | : | : |
61 | public scalarDiagonalMatrix | ||
52 | public univariateMomentInversion | ||
62 | 53 | { | { |
63 | 54 | // Private data | // Private data |
64 | 55 | ||
65 | //- Dimesions of the matrix | ||
66 | const label m_; | ||
56 | //- Minimum value of the variance to compute eta | ||
57 | scalar etaMin_; | ||
58 | |||
59 | //- Maximum normalized skewness | ||
60 | scalar qMax_; | ||
61 | |||
62 | //- Small negative value for realizability | ||
63 | scalar smallNegRealizability_; | ||
64 | |||
67 | 65 | ||
68 | 66 | public: | public: |
69 | 67 | ||
70 | // Constructors | ||
68 | //- Runtime type information | ||
69 | TypeName("hyperbolic"); | ||
71 | 70 | ||
72 | //- Construct from a given vector | ||
73 | Vandermonde | ||
74 | ( | ||
75 | const scalarDiagonalMatrix& A | ||
76 | ); | ||
77 | 71 | ||
78 | //- Construct from a square Vandermonde matrix | ||
79 | Vandermonde | ||
72 | // Constructors | ||
73 | |||
74 | //- Construct from univariateMomentSet | ||
75 | hyperbolicMomentInversion | ||
80 | 76 | ( | ( |
81 | const scalarSquareMatrix& A, | ||
82 | const bool checkVandermonde = false | ||
77 | const dictionary& dict | ||
83 | 78 | ); | ); |
84 | 79 | ||
85 | 80 | ||
86 | 81 | //- Destructor | //- Destructor |
87 | ~Vandermonde(); | ||
82 | virtual ~hyperbolicMomentInversion(); | ||
88 | 83 | ||
89 | 84 | ||
90 | // Member Functions | ||
85 | // Public member functions | ||
91 | 86 | ||
92 | //- Solve the Vandermonde linear system with the given source vector | ||
93 | void solve | ||
87 | //- Modify the recurrence relation for fixed-point quadrature | ||
88 | virtual void correctRecurrence | ||
94 | 89 | ( | ( |
95 | scalarDiagonalMatrix& x, | ||
96 | const scalarDiagonalMatrix& source | ||
90 | univariateMomentSet& moments, | ||
91 | scalarList& alpha, | ||
92 | scalarList& beta, | ||
93 | const scalar minKnownAbscissa = 0, | ||
94 | const scalar maxKnownAbscissa = 0 | ||
97 | 95 | ); | ); |
98 | 96 | ||
99 | //- Invert Vandermonde matrix | ||
100 | scalarSquareMatrix inv(); | ||
101 | |||
102 | |||
103 | // Member Operators | ||
104 | |||
105 | //- Return the complete Vandermonde matrix | ||
106 | scalarSquareMatrix operator()(); | ||
97 | //- Invert the set of moments to compute weights and abscissae | ||
98 | virtual void invert | ||
99 | ( | ||
100 | univariateMomentSet& moments, | ||
101 | const scalar minKnownAbscissa = 0, | ||
102 | const scalar maxKnownAbscissa = 0 | ||
103 | ); | ||
107 | 104 | ||
108 | //- Return a given component of the Vandermonde matrix | ||
109 | scalar operator()(label i, label j); | ||
105 | //- Calculates the number of quadrature nodes | ||
106 | virtual void calcNQuadratureNodes | ||
107 | ( | ||
108 | univariateMomentSet& moments | ||
109 | ); | ||
110 | 110 | }; | }; |
111 | 111 | ||
112 | 112 | ||
... | ... | public: | |
114 | 114 | ||
115 | 115 | } // End namespace Foam | } // End namespace Foam |
116 | 116 | ||
117 | |||
118 | 117 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
119 | 118 | ||
120 | #include "VandermondeI.H" | ||
121 | 119 | ||
122 | 120 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
123 | 121 | ||
124 | 122 | #endif | #endif |
125 | 123 | ||
126 | |||
127 | 124 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/newUnivariateMomentInversion.C copied from file multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/newExtendedMomentInversion.C (similarity 66%) (mode: 100644) (index 8a0f1ec..492a177) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "extendedMomentInversion.H" | ||
26 | #include "univariateMomentInversion.H" | ||
27 | 27 | ||
28 | 28 | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * // |
29 | 29 | ||
30 | Foam::autoPtr<Foam::extendedMomentInversion> Foam::extendedMomentInversion::New | ||
30 | Foam::autoPtr<Foam::univariateMomentInversion> | ||
31 | Foam::univariateMomentInversion::New | ||
31 | 32 | ( | ( |
32 | const dictionary& dict, | ||
33 | const label nMoments, | ||
34 | const label nSecondaryNodes | ||
33 | const dictionary& dict | ||
35 | 34 | ) | ) |
36 | 35 | { | { |
37 | word extendedMomentInversionType(dict.lookup("extendedMomentInversion")); | ||
36 | word univariateMomentInversionType | ||
37 | ( | ||
38 | dict.lookup("univariateMomentInversion") | ||
39 | ); | ||
38 | 40 | ||
39 | Info<< "Selecting extendedMomentInversion: " | ||
40 | << extendedMomentInversionType << endl; | ||
41 | Info<< "Selecting univariateMomentInversion: " | ||
42 | << univariateMomentInversionType << endl; | ||
41 | 43 | ||
42 | 44 | dictionaryConstructorTable::iterator cstrIter = | dictionaryConstructorTable::iterator cstrIter = |
43 | dictionaryConstructorTablePtr_->find(extendedMomentInversionType); | ||
45 | dictionaryConstructorTablePtr_->find(univariateMomentInversionType); | ||
44 | 46 | ||
45 | 47 | if (cstrIter == dictionaryConstructorTablePtr_->end()) | if (cstrIter == dictionaryConstructorTablePtr_->end()) |
46 | 48 | { | { |
47 | 49 | FatalErrorInFunction | FatalErrorInFunction |
48 | << "Unknown extendedMomentInversionType type " | ||
49 | << extendedMomentInversionType << endl << endl | ||
50 | << "Valid extendedMomentInversion types are : " << endl | ||
50 | << "Unknown univariateMomentInversion type " | ||
51 | << univariateMomentInversionType << endl << endl | ||
52 | << "Valid univariateMomentInversion types are : " << endl | ||
51 | 53 | << dictionaryConstructorTablePtr_->sortedToc() | << dictionaryConstructorTablePtr_->sortedToc() |
52 | 54 | << exit(FatalError); | << exit(FatalError); |
53 | 55 | } | } |
54 | 56 | ||
55 | return cstrIter()(dict, nMoments, nSecondaryNodes); | ||
57 | return cstrIter()(dict); | ||
56 | 58 | } | } |
57 | 59 | ||
58 | 60 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversion.C added (mode: 100644) (index 0000000..180879a) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | #include "univariateMomentInversion.H" | ||
27 | #include "IOmanip.H" | ||
28 | |||
29 | #include "eigenSolver.H" | ||
30 | |||
31 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
32 | |||
33 | namespace Foam | ||
34 | { | ||
35 | defineTypeNameAndDebug(univariateMomentInversion, 0); | ||
36 | defineRunTimeSelectionTable(univariateMomentInversion, dictionary); | ||
37 | } | ||
38 | |||
39 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
40 | |||
41 | Foam::univariateMomentInversion::univariateMomentInversion | ||
42 | ( | ||
43 | const dictionary& dict | ||
44 | ) | ||
45 | : | ||
46 | smallM0_(dict.lookupOrDefault("smallM0", 1.0e-12)), | ||
47 | nInvertibleMoments_(), | ||
48 | nNodes_(), | ||
49 | abscissae_(), | ||
50 | weights_() | ||
51 | {} | ||
52 | |||
53 | |||
54 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
55 | |||
56 | Foam::univariateMomentInversion::~univariateMomentInversion() | ||
57 | {} | ||
58 | |||
59 | |||
60 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
61 | |||
62 | void Foam::univariateMomentInversion::JacobiMatrix | ||
63 | ( | ||
64 | univariateMomentSet& moments, | ||
65 | scalarSquareMatrix& z, | ||
66 | const scalar minKnownAbscissa, | ||
67 | const scalar maxKnownAbscissa | ||
68 | ) | ||
69 | { | ||
70 | scalarList alpha(moments.alphaRecurrence()); | ||
71 | scalarList beta(moments.betaRecurrence()); | ||
72 | |||
73 | correctRecurrence | ||
74 | ( | ||
75 | moments, | ||
76 | alpha, | ||
77 | beta, | ||
78 | minKnownAbscissa, | ||
79 | maxKnownAbscissa | ||
80 | ); | ||
81 | |||
82 | for (label i = 0; i < nNodes_ - 1; i++) | ||
83 | { | ||
84 | z[i][i] = alpha[i]; | ||
85 | z[i][i+1] = Foam::sqrt(beta[i+1]); | ||
86 | z[i+1][i] = z[i][i+1]; | ||
87 | } | ||
88 | |||
89 | z[nNodes_ - 1][nNodes_ - 1] = alpha[nNodes_ - 1]; | ||
90 | } | ||
91 | |||
92 | void Foam::univariateMomentInversion::invert | ||
93 | ( | ||
94 | univariateMomentSet& moments, | ||
95 | const scalar minKnownAbscissa, | ||
96 | const scalar maxKnownAbscissa | ||
97 | ) | ||
98 | { | ||
99 | if (moments.isDegenerate()) | ||
100 | { | ||
101 | nNodes_ = 1; | ||
102 | weights_.setSize(nNodes_); | ||
103 | abscissae_.setSize(nNodes_); | ||
104 | weights_[0] = moments[0]; | ||
105 | abscissae_[0] = 0.0; | ||
106 | |||
107 | return; | ||
108 | } | ||
109 | |||
110 | if (moments[0] < smallM0_) | ||
111 | { | ||
112 | nNodes_ = 0; | ||
113 | |||
114 | weights_.setSize(nNodes_); | ||
115 | abscissae_.setSize(nNodes_); | ||
116 | |||
117 | return; | ||
118 | } | ||
119 | |||
120 | calcNQuadratureNodes(moments); | ||
121 | |||
122 | if (nInvertibleMoments_ == 2) | ||
123 | { | ||
124 | weights_[0] = moments[0]; | ||
125 | abscissae_[0] = moments[1]/moments[0]; | ||
126 | |||
127 | return; | ||
128 | } | ||
129 | |||
130 | scalarSquareMatrix z(nNodes_, scalar(0)); | ||
131 | JacobiMatrix(moments, z, minKnownAbscissa, maxKnownAbscissa); | ||
132 | |||
133 | // Computing weights and abscissae | ||
134 | eigenSolver zEig(z, true); | ||
135 | |||
136 | // Computing weights and abscissae | ||
137 | for (label i = 0; i < nNodes_; i++) | ||
138 | { | ||
139 | weights_[i] = moments[0]*sqr(zEig.eigenvectors()[0][i]); | ||
140 | abscissae_[i] = zEig.eigenvaluesRe()[i]; | ||
141 | } | ||
142 | } | ||
143 | |||
144 | |||
145 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversion.H added (mode: 100644) (index 0000000..dbbe3ff) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | Class | ||
25 | Foam::univariateMomentInversion | ||
26 | |||
27 | Description | ||
28 | Abstract class for univariate quadrature on a moment set. | ||
29 | |||
30 | SourceFiles | ||
31 | univariateMomentInversion.C | ||
32 | univariateMomentInversionI.H | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef univariateMomentInversion_H | ||
37 | #define univariateMomentInversion_H | ||
38 | |||
39 | #include "scalarList.H" | ||
40 | #include "scalarMatrices.H" | ||
41 | #include "runTimeSelectionTables.H" | ||
42 | #include "univariateMomentSet.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | /*---------------------------------------------------------------------------*\ | ||
49 | Class univariateMomentInversion Declaration | ||
50 | \*---------------------------------------------------------------------------*/ | ||
51 | |||
52 | class univariateMomentInversion | ||
53 | { | ||
54 | // Private data | ||
55 | |||
56 | scalar smallM0_; | ||
57 | |||
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 | protected: | ||
69 | |||
70 | // Protected data | ||
71 | |||
72 | //- Number of invertible moments for the user-selected quadrature | ||
73 | label nInvertibleMoments_; | ||
74 | |||
75 | //- Number of quadrature nodes | ||
76 | label nNodes_; | ||
77 | |||
78 | //- Quadrature abscissae | ||
79 | scalarList abscissae_; | ||
80 | |||
81 | //- Quadrature weights | ||
82 | scalarList weights_; | ||
83 | |||
84 | |||
85 | // Protected member functions | ||
86 | |||
87 | //- Create Jacobi matrix | ||
88 | void JacobiMatrix | ||
89 | ( | ||
90 | univariateMomentSet& moments, | ||
91 | scalarSquareMatrix& z, | ||
92 | const scalar minKnownAbscissa = 0, | ||
93 | const scalar maxKnownAbscissa = 0 | ||
94 | ); | ||
95 | |||
96 | |||
97 | public: | ||
98 | |||
99 | //- Runtime type information | ||
100 | TypeName("univariateMomentInversion"); | ||
101 | |||
102 | |||
103 | // Declare runtime construction | ||
104 | |||
105 | declareRunTimeSelectionTable | ||
106 | ( | ||
107 | autoPtr, | ||
108 | univariateMomentInversion, | ||
109 | dictionary, | ||
110 | ( | ||
111 | const dictionary& dict | ||
112 | ), | ||
113 | (dict) | ||
114 | ); | ||
115 | |||
116 | |||
117 | // Constructors | ||
118 | |||
119 | //- Construct from univariateMomentSet | ||
120 | univariateMomentInversion | ||
121 | ( | ||
122 | const dictionary& dict | ||
123 | ); | ||
124 | |||
125 | |||
126 | //- Destructor | ||
127 | virtual ~univariateMomentInversion(); | ||
128 | |||
129 | |||
130 | // Selectors | ||
131 | |||
132 | static autoPtr<univariateMomentInversion> New | ||
133 | ( | ||
134 | const dictionary& dict | ||
135 | ); | ||
136 | |||
137 | |||
138 | // Member Functions | ||
139 | |||
140 | //- Calculates the number of quadrature nodes | ||
141 | virtual void calcNQuadratureNodes | ||
142 | ( | ||
143 | univariateMomentSet& moments | ||
144 | ) = 0; | ||
145 | |||
146 | //- Modify the recurrence relation for fixed-point quadrature | ||
147 | virtual void correctRecurrence | ||
148 | ( | ||
149 | univariateMomentSet& moments, | ||
150 | scalarList& alpha, | ||
151 | scalarList& beta, | ||
152 | const scalar minKnownAbscissa = 0, | ||
153 | const scalar maxKnownAbscissa = 0 | ||
154 | ) = 0; | ||
155 | |||
156 | //- Invert the set of moments to compute weights and abscissae | ||
157 | virtual void invert | ||
158 | ( | ||
159 | univariateMomentSet& moments, | ||
160 | const scalar minKnownAbscissa = 0, | ||
161 | const scalar maxKnownAbscissa = 0 | ||
162 | ); | ||
163 | |||
164 | //- Return quadrature abscissae | ||
165 | inline const scalarList& abscissae() const; | ||
166 | |||
167 | //- Return the number of nodes | ||
168 | inline label nNodes() const; | ||
169 | |||
170 | //- Return quadrature weigths | ||
171 | inline const scalarList& weights() const; | ||
172 | |||
173 | }; | ||
174 | |||
175 | |||
176 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
177 | |||
178 | } // End namespace Foam | ||
179 | |||
180 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
181 | |||
182 | #include "univariateMomentInversionI.H" | ||
183 | |||
184 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
185 | |||
186 | #endif | ||
187 | |||
188 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/basic/univariateMomentInversion/univariateMomentInversionI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H (similarity 78%) (mode: 100644 -> 100755) (index ddb0a21..62291f8) | |||
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) 2014-2017 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& | ||
29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | ||
28 | const Foam::scalarList& Foam::univariateMomentInversion::abscissae() const | ||
30 | 29 | { | { |
31 | return quadrature_; | ||
30 | return abscissae_; | ||
32 | 31 | } | } |
33 | 32 | ||
33 | Foam::label Foam::univariateMomentInversion::nNodes() const | ||
34 | { | ||
35 | return nNodes_; | ||
36 | } | ||
37 | |||
38 | const Foam::scalarList& Foam::univariateMomentInversion::weights() const | ||
39 | { | ||
40 | return weights_; | ||
41 | } | ||
34 | 42 | ||
35 | 43 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/Make/files renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/Make/files (similarity 100%) |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/Make/options added (mode: 100644) (index 0000000..54945a3) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../../../../eigenSolver/lnInclude \ | ||
4 | -I../../../../mappedList \ | ||
5 | -I../../../momentSets/lnInclude \ | ||
6 | -I../basic/lnInclude | ||
7 | |||
8 | LIB_LIBS = \ | ||
9 | -lfiniteVolume \ | ||
10 | -L$(FOAM_USER_LIBBIN) \ | ||
11 | -leigenSolver \ | ||
12 | -lmomentSets \ | ||
13 | -lmomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/beta/betaEQMOM.C renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/beta/betaEQMOM.C (similarity 97%) (mode: 100644) (index c6faa11..a005735) | |||
... | ... | void Foam::betaEQMOM::momentsToMomentsStar | |
290 | 290 | Foam::scalar Foam::betaEQMOM::m2N | Foam::scalar Foam::betaEQMOM::m2N |
291 | 291 | ( | ( |
292 | 292 | scalar sigma, | scalar sigma, |
293 | univariateMomentSet momentsStar | ||
293 | const univariateMomentSet& momentsStar | ||
294 | 294 | ) | ) |
295 | 295 | { | { |
296 | label nMomentsStar = momentsStar.size(); | ||
296 | univariateMomentSet mStar(momentsStar); | ||
297 | label nMomentsStar = mStar.size(); | ||
297 | 298 | ||
298 | if (momentsStar.nRealizableMoments() >= nMomentsStar - 1) | ||
299 | if (mStar.nRealizableMoments() >= nMomentsStar - 1) | ||
299 | 300 | { | { |
300 | univariateMomentSet m(nMomentsStar, 0.0, "Gauss", "01"); | ||
301 | momentsStarToMoments(sigma, m, momentsStar); | ||
301 | univariateMomentSet m(nMomentsStar, "01"); | ||
302 | momentsStarToMoments(sigma, m, mStar); | ||
302 | 303 | ||
303 | 304 | return m.last(); | return m.last(); |
304 | 305 | } | } |
... | ... | Foam::scalar Foam::betaEQMOM::m2N | |
308 | 309 | ||
309 | 310 | void Foam::betaEQMOM::recurrenceRelation | void Foam::betaEQMOM::recurrenceRelation |
310 | 311 | ( | ( |
311 | scalarDiagonalMatrix& a, | ||
312 | scalarDiagonalMatrix& b, | ||
312 | scalarList& a, | ||
313 | scalarList& b, | ||
313 | 314 | scalar primaryAbscissa, | scalar primaryAbscissa, |
314 | 315 | scalar sigma | scalar sigma |
315 | 316 | ) | ) |
... | ... | void Foam::betaEQMOM::recurrenceRelation | |
328 | 329 | b[1] = (4.0*(alpha + 1.0)*(beta + 1.0)) | b[1] = (4.0*(alpha + 1.0)*(beta + 1.0)) |
329 | 330 | /(sqr(alpha + beta + 2.0)*(alpha + beta + 3.0)); | /(sqr(alpha + beta + 2.0)*(alpha + beta + 3.0)); |
330 | 331 | ||
331 | for(label i = 2; i < a.size(); i++) | ||
332 | for (label i = 2; i < a.size(); i++) | ||
332 | 333 | { | { |
333 | 334 | nab = 2.0*scalar(i) + alpha + beta; | nab = 2.0*scalar(i) + alpha + beta; |
334 | 335 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/beta/betaEQMOM.H renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/beta/betaEQMOM.H (similarity 94%) (mode: 100644) (index b78a1a1..08f0d9f) | |||
... | ... | public: | |
79 | 79 | ||
80 | 80 | // Constructors | // Constructors |
81 | 81 | ||
82 | //- Construct from a dictionary and label | ||
82 | //- Construct from a dictionary | ||
83 | 83 | betaEQMOM | betaEQMOM |
84 | 84 | ( | ( |
85 | 85 | const dictionary& dict, | const dictionary& dict, |
... | ... | public: | |
119 | 119 | ); | ); |
120 | 120 | ||
121 | 121 | //- Compute the last moment from starred moments | //- Compute the last moment from starred moments |
122 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar); | ||
122 | virtual scalar m2N | ||
123 | ( | ||
124 | scalar sigma, | ||
125 | const univariateMomentSet& momentsStar | ||
126 | ); | ||
123 | 127 | ||
124 | 128 | //- Recurrence relation for polynomials orthogonal to kernel function | //- Recurrence relation for polynomials orthogonal to kernel function |
125 | 129 | virtual void recurrenceRelation | virtual void recurrenceRelation |
126 | 130 | ( | ( |
127 | scalarDiagonalMatrix& a, | ||
128 | scalarDiagonalMatrix& b, | ||
131 | scalarList& a, | ||
132 | scalarList& b, | ||
129 | 133 | scalar primaryAbscissa, | scalar primaryAbscissa, |
130 | 134 | scalar sigma | scalar sigma |
131 | 135 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/extendedMomentInversion/extendedMomentInversion.C renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/extendedMomentInversion.C (similarity 85%) (mode: 100644) (index 8e01246..3283270) | |||
... | ... | Foam::extendedMomentInversion::extendedMomentInversion | |
44 | 44 | const label nSecondaryNodes | const label nSecondaryNodes |
45 | 45 | ) | ) |
46 | 46 | : | : |
47 | momentInverter_ | ||
48 | ( | ||
49 | univariateMomentInversion::New(dict.subDict("basicQuadrature")) | ||
50 | ), | ||
47 | 51 | nMoments_(nMoments), | nMoments_(nMoments), |
48 | 52 | nPrimaryNodes_((nMoments_ - 1)/2), | nPrimaryNodes_((nMoments_ - 1)/2), |
49 | 53 | nSecondaryNodes_(nSecondaryNodes), | nSecondaryNodes_(nSecondaryNodes), |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
105 | 109 | { | { |
106 | 110 | sigma_ = 0.0; | sigma_ = 0.0; |
107 | 111 | nullSigma_ = true; | nullSigma_ = true; |
108 | m.invert(); | ||
109 | secondaryQuadrature(m); | ||
112 | momentInverter_().invert(m); | ||
113 | |||
114 | secondaryQuadrature | ||
115 | ( | ||
116 | momentInverter_().weights(), | ||
117 | momentInverter_().abscissae() | ||
118 | ); | ||
110 | 119 | ||
111 | 120 | return; | return; |
112 | 121 | } | } |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
115 | 124 | { | { |
116 | 125 | // If the number of realizable moments is even, we apply the standard | // If the number of realizable moments is even, we apply the standard |
117 | 126 | // QMOM directly to maximize the number of preserved moments. | // QMOM directly to maximize the number of preserved moments. |
118 | |||
119 | m.invert(); | ||
120 | 127 | sigma_ = 0.0; | sigma_ = 0.0; |
121 | 128 | nullSigma_ = true; | nullSigma_ = true; |
122 | secondaryQuadrature(m); | ||
129 | momentInverter_().invert(m); | ||
130 | |||
131 | secondaryQuadrature | ||
132 | ( | ||
133 | momentInverter_().weights(), | ||
134 | momentInverter_().abscissae() | ||
135 | ); | ||
123 | 136 | } | } |
124 | 137 | else | else |
125 | 138 | { | { |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
132 | 145 | { | { |
133 | 146 | sigma_ = 0.0; | sigma_ = 0.0; |
134 | 147 | nullSigma_ = true; | nullSigma_ = true; |
148 | momentInverter_().invert(m); | ||
135 | 149 | ||
136 | m.invert(); | ||
137 | secondaryQuadrature(m); | ||
150 | secondaryQuadrature | ||
151 | ( | ||
152 | momentInverter_().weights(), | ||
153 | momentInverter_().abscissae() | ||
154 | ); | ||
138 | 155 | ||
139 | 156 | return; | return; |
140 | 157 | } | } |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
143 | 160 | m.resize(nRealizableMoments); | m.resize(nRealizableMoments); |
144 | 161 | ||
145 | 162 | // Local set of starred moments | // Local set of starred moments |
146 | univariateMomentSet mStar | ||
147 | ( | ||
148 | nRealizableMoments, | ||
149 | 0.0, | ||
150 | m.quadratureType(), | ||
151 | m.support() | ||
152 | ); | ||
163 | univariateMomentSet mStar(nRealizableMoments, m.support()); | ||
153 | 164 | ||
154 | 165 | // Compute target function for sigma = 0 | // Compute target function for sigma = 0 |
155 | 166 | scalar sigmaLow = 0.0; | scalar sigmaLow = 0.0; |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
159 | 170 | // Check if sigma = 0 is root | // Check if sigma = 0 is root |
160 | 171 | if (mag(fLow) <= targetFunctionTol_) | if (mag(fLow) <= targetFunctionTol_) |
161 | 172 | { | { |
162 | m.invert(); | ||
163 | 173 | sigma_ = 0.0; | sigma_ = 0.0; |
164 | 174 | nullSigma_ = true; | nullSigma_ = true; |
165 | secondaryQuadrature(m); | ||
175 | momentInverter_().invert(m); | ||
176 | |||
177 | secondaryQuadrature | ||
178 | ( | ||
179 | momentInverter_().weights(), | ||
180 | momentInverter_().abscissae() | ||
181 | ); | ||
166 | 182 | ||
167 | 183 | return; | return; |
168 | 184 | } | } |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
181 | 197 | // If sigma_ is small, use QMOM | // If sigma_ is small, use QMOM |
182 | 198 | if (mag(sigma_) < sigmaMin_) | if (mag(sigma_) < sigmaMin_) |
183 | 199 | { | { |
184 | m.invert(); | ||
185 | 200 | sigma_ = 0.0; | sigma_ = 0.0; |
186 | 201 | nullSigma_ = true; | nullSigma_ = true; |
187 | secondaryQuadrature(m); | ||
202 | momentInverter_().invert(m); | ||
203 | |||
204 | secondaryQuadrature | ||
205 | ( | ||
206 | momentInverter_().weights(), | ||
207 | momentInverter_().abscissae() | ||
208 | ); | ||
188 | 209 | ||
189 | 210 | return; | return; |
190 | 211 | } | } |
191 | 212 | ||
192 | 213 | targetFunction(sigma_, m, mStar); | targetFunction(sigma_, m, mStar); |
193 | secondaryQuadrature(mStar); | ||
214 | secondaryQuadrature // secondary quadrature from mStar | ||
215 | ( | ||
216 | momentInverter_().weights(), | ||
217 | momentInverter_().abscissae() | ||
218 | ); | ||
194 | 219 | ||
195 | 220 | return; | return; |
196 | 221 | } | } |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
232 | 257 | // If sigma_ is small, use QMOM | // If sigma_ is small, use QMOM |
233 | 258 | if (mag(sigma_) < sigmaMin_) | if (mag(sigma_) < sigmaMin_) |
234 | 259 | { | { |
235 | m.invert(); | ||
236 | 260 | sigma_ = 0.0; | sigma_ = 0.0; |
237 | 261 | nullSigma_ = true; | nullSigma_ = true; |
238 | secondaryQuadrature(m); | ||
262 | momentInverter_().invert(m); | ||
263 | |||
264 | secondaryQuadrature | ||
265 | ( | ||
266 | momentInverter_().weights(), | ||
267 | momentInverter_().abscissae() | ||
268 | ); | ||
239 | 269 | ||
240 | 270 | return; | return; |
241 | 271 | } | } |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
248 | 278 | ) | ) |
249 | 279 | { | { |
250 | 280 | // Found a value of sigma that preserves all the moments | // Found a value of sigma that preserves all the moments |
251 | secondaryQuadrature(mStar); | ||
281 | secondaryQuadrature // Secondary quadrature from mStar | ||
282 | ( | ||
283 | momentInverter_().weights(), | ||
284 | momentInverter_().abscissae() | ||
285 | ); | ||
252 | 286 | ||
253 | 287 | return; | return; |
254 | 288 | } | } |
... | ... | void Foam::extendedMomentInversion::invert(const univariateMomentSet& moments) | |
260 | 294 | // If sigma_ is small, use QMOM | // If sigma_ is small, use QMOM |
261 | 295 | if (mag(sigma_) < sigmaMin_) | if (mag(sigma_) < sigmaMin_) |
262 | 296 | { | { |
263 | m.invert(); | ||
264 | 297 | sigma_ = 0.0; | sigma_ = 0.0; |
265 | 298 | nullSigma_ = true; | nullSigma_ = true; |
266 | secondaryQuadrature(m); | ||
299 | momentInverter_().invert(m); | ||
300 | |||
301 | secondaryQuadrature | ||
302 | ( | ||
303 | momentInverter_().weights(), | ||
304 | momentInverter_().abscissae() | ||
305 | ); | ||
267 | 306 | ||
268 | 307 | return; | return; |
269 | 308 | } | } |
270 | 309 | ||
271 | 310 | targetFunction(sigma_, m, mStar); | targetFunction(sigma_, m, mStar); |
272 | secondaryQuadrature(mStar); | ||
311 | |||
312 | secondaryQuadrature // Secondary quadrature from mStar | ||
313 | ( | ||
314 | momentInverter_().weights(), | ||
315 | momentInverter_().abscissae() | ||
316 | ); | ||
273 | 317 | ||
274 | 318 | return; | return; |
275 | 319 | } | } |
... | ... | Foam::scalar Foam::extendedMomentInversion::normalizedMomentError | |
392 | 436 | ||
393 | 437 | targetFunction(sigma, moments, momentsStar); | targetFunction(sigma, moments, momentsStar); |
394 | 438 | ||
395 | univariateMomentSet approximatedMoments | ||
396 | ( | ||
397 | moments.size(), | ||
398 | 0.0, | ||
399 | moments.quadratureType(), | ||
400 | moments.support() | ||
401 | ); | ||
439 | univariateMomentSet approximatedMoments(moments.size(), moments.support()); | ||
402 | 440 | ||
403 | 441 | momentsStarToMoments(sigma, approximatedMoments, momentsStar); | momentsStarToMoments(sigma, approximatedMoments, momentsStar); |
404 | 442 | ||
... | ... | Foam::scalar Foam::extendedMomentInversion::normalizedMomentError | |
412 | 450 | ||
413 | 451 | void Foam::extendedMomentInversion::secondaryQuadrature | void Foam::extendedMomentInversion::secondaryQuadrature |
414 | 452 | ( | ( |
415 | const univariateMomentSet& moments | ||
453 | const scalarList& pWeights, | ||
454 | const scalarList& pAbscissae | ||
416 | 455 | ) | ) |
417 | 456 | { | { |
418 | const scalarDiagonalMatrix& pWeights(moments.weights()); | ||
419 | const scalarDiagonalMatrix& pAbscissae(moments.abscissae()); | ||
420 | |||
421 | 457 | // Copy primary weights and abscissae | // Copy primary weights and abscissae |
422 | 458 | forAll(pWeights, pNodei) | forAll(pWeights, pNodei) |
423 | 459 | { | { |
... | ... | Foam::scalar Foam::extendedMomentInversion::targetFunction | |
520 | 556 | ) | ) |
521 | 557 | { | { |
522 | 558 | momentsToMomentsStar(sigma, moments, momentsStar); | momentsToMomentsStar(sigma, moments, momentsStar); |
523 | momentsStar.invert(); | ||
524 | momentsStar.update(); | ||
559 | |||
560 | momentInverter_().invert(momentsStar); | ||
561 | momentsStar.update | ||
562 | ( | ||
563 | momentInverter_().weights(), | ||
564 | momentInverter_().abscissae() | ||
565 | ); | ||
525 | 566 | ||
526 | 567 | scalar lastMoment = moments.last(); | scalar lastMoment = moments.last(); |
527 | 568 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/extendedMomentInversion/extendedMomentInversion.H renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/extendedMomentInversion.H (similarity 92%) (mode: 100644) (index 899d9ac..73f4217) | |||
... | ... | SourceFiles | |
62 | 62 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
63 | 63 | ||
64 | 64 | #include "scalar.H" | #include "scalar.H" |
65 | #include "scalarList.H" | ||
65 | 66 | #include "scalarMatrices.H" | #include "scalarMatrices.H" |
66 | 67 | #include "dictionary.H" | #include "dictionary.H" |
67 | 68 | #include "runTimeSelectionTables.H" | #include "runTimeSelectionTables.H" |
68 | 69 | #include "univariateMomentSet.H" | #include "univariateMomentSet.H" |
70 | #include "univariateMomentInversion.H" | ||
69 | 71 | ||
70 | 72 | namespace Foam | namespace Foam |
71 | 73 | { | { |
... | ... | namespace Foam | |
76 | 78 | ||
77 | 79 | class extendedMomentInversion | class extendedMomentInversion |
78 | 80 | { | { |
81 | // Private data | ||
82 | |||
83 | //- Univariate moment inversion method | ||
84 | autoPtr<univariateMomentInversion> momentInverter_; | ||
85 | |||
86 | |||
79 | 87 | // Private member functions | // Private member functions |
80 | 88 | ||
81 | 89 | //- Attempt to find a min or max of the target function on an interval | //- Attempt to find a min or max of the target function on an interval |
... | ... | class extendedMomentInversion | |
91 | 99 | void reset(); | void reset(); |
92 | 100 | ||
93 | 101 | //- Compute secondary weigths and abscissae | //- Compute secondary weigths and abscissae |
94 | void secondaryQuadrature(const univariateMomentSet& moments); | ||
102 | void secondaryQuadrature | ||
103 | ( | ||
104 | const scalarList& pWeights, | ||
105 | const scalarList& pAbscissae | ||
106 | ); | ||
95 | 107 | ||
96 | 108 | //- Compute target function whose root is sigma_ | //- Compute target function whose root is sigma_ |
97 | 109 | scalar targetFunction | scalar targetFunction |
... | ... | protected: | |
122 | 134 | label nSecondaryNodes_; | label nSecondaryNodes_; |
123 | 135 | ||
124 | 136 | //- Primary quadrature weights | //- Primary quadrature weights |
125 | scalarDiagonalMatrix primaryWeights_; | ||
137 | scalarList primaryWeights_; | ||
126 | 138 | ||
127 | 139 | //- Primary quadrature abscissae | //- Primary quadrature abscissae |
128 | scalarDiagonalMatrix primaryAbscissae_; | ||
140 | scalarList primaryAbscissae_; | ||
129 | 141 | ||
130 | 142 | //- Parameter sigma of the kernel density function | //- Parameter sigma of the kernel density function |
131 | 143 | scalar sigma_; | scalar sigma_; |
... | ... | protected: | |
191 | 203 | ) = 0; | ) = 0; |
192 | 204 | ||
193 | 205 | //- Compute the last moment from starred moments | //- Compute the last moment from starred moments |
194 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar) = 0; | ||
206 | virtual scalar m2N | ||
207 | ( | ||
208 | scalar sigma, | ||
209 | const univariateMomentSet& momentsStar | ||
210 | ) = 0; | ||
195 | 211 | ||
196 | 212 | //- Compute the normalized moment error | //- Compute the normalized moment error |
197 | 213 | scalar normalizedMomentError | scalar normalizedMomentError |
... | ... | protected: | |
204 | 220 | //- Recurrence relation for polynomials orthogonal to kernel function | //- Recurrence relation for polynomials orthogonal to kernel function |
205 | 221 | virtual void recurrenceRelation | virtual void recurrenceRelation |
206 | 222 | ( | ( |
207 | scalarDiagonalMatrix& a, | ||
208 | scalarDiagonalMatrix& b, | ||
223 | scalarList& a, | ||
224 | scalarList& b, | ||
209 | 225 | scalar primaryAbscissa, | scalar primaryAbscissa, |
210 | 226 | scalar sigma | scalar sigma |
211 | 227 | ) = 0; | ) = 0; |
... | ... | public: | |
296 | 312 | } | } |
297 | 313 | ||
298 | 314 | //- Return primary quadrature weights | //- Return primary quadrature weights |
299 | inline const scalarDiagonalMatrix& primaryWeights() const | ||
315 | inline const scalarList& primaryWeights() const | ||
300 | 316 | { | { |
301 | 317 | return primaryWeights_; | return primaryWeights_; |
302 | 318 | } | } |
303 | 319 | ||
304 | 320 | //- Return primary quadrature abscissae | //- Return primary quadrature abscissae |
305 | inline const scalarDiagonalMatrix& primaryAbscissae() const | ||
321 | inline const scalarList& primaryAbscissae() const | ||
306 | 322 | { | { |
307 | 323 | return primaryAbscissae_; | return primaryAbscissae_; |
308 | 324 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/extendedMomentInversion/newExtendedMomentInversion.C renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/extendedMomentInversion/newExtendedMomentInversion.C (similarity 100%) |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/gamma/gammaEQMOM.C renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/gamma/gammaEQMOM.C (similarity 94%) (mode: 100644) (index d41dd7c..56dd669) | |||
... | ... | void Foam::gammaEQMOM::momentsToMomentsStar | |
185 | 185 | + sigma*(25.0*moments[3] + sigma*(-15.0*moments[2] | + sigma*(25.0*moments[3] + sigma*(-15.0*moments[2] |
186 | 186 | + moments[1]*sigma))); | + moments[1]*sigma))); |
187 | 187 | ||
188 | momentsStar[6] = moments[6] + sigma*(-15.0*moments[5] | ||
188 | momentsStar[6] = moments[6] + sigma*(-15.0*moments[5] | ||
189 | 189 | + sigma*(65.0*moments[4] + sigma*(-90.0*moments[3] | + sigma*(65.0*moments[4] + sigma*(-90.0*moments[3] |
190 | 190 | + sigma*(31.0*moments[2] - moments[1]*sigma)))); | + sigma*(31.0*moments[2] - moments[1]*sigma)))); |
191 | 191 | } | } |
... | ... | void Foam::gammaEQMOM::momentsToMomentsStar | |
197 | 197 | + sigma*(301.0*moments[3] + sigma*(-63.0*moments[2] | + sigma*(301.0*moments[3] + sigma*(-63.0*moments[2] |
198 | 198 | + moments[1]*sigma))))); | + moments[1]*sigma))))); |
199 | 199 | ||
200 | momentsStar[8] = moments[8] + sigma*(-28.0*moments[7] | ||
200 | momentsStar[8] = moments[8] + sigma*(-28.0*moments[7] | ||
201 | 201 | + sigma*(266.0*moments[6] + sigma*(-1050.0*moments[5] | + sigma*(266.0*moments[6] + sigma*(-1050.0*moments[5] |
202 | 202 | + sigma*(1701.0*moments[4] + sigma*(-966.0*moments[3] | + sigma*(1701.0*moments[4] + sigma*(-966.0*moments[3] |
203 | 203 | + sigma*(127.0*moments[2] - moments[1]*sigma)))))); | + sigma*(127.0*moments[2] - moments[1]*sigma)))))); |
... | ... | void Foam::gammaEQMOM::momentsToMomentsStar | |
222 | 222 | Foam::scalar Foam::gammaEQMOM::m2N | Foam::scalar Foam::gammaEQMOM::m2N |
223 | 223 | ( | ( |
224 | 224 | scalar sigma, | scalar sigma, |
225 | univariateMomentSet momentsStar | ||
225 | const univariateMomentSet& momentsStar | ||
226 | 226 | ) | ) |
227 | 227 | { | { |
228 | label nMomentsStar = momentsStar.size(); | ||
228 | univariateMomentSet mStar(momentsStar); | ||
229 | |||
230 | label nMomentsStar = mStar.size(); | ||
229 | 231 | ||
230 | if (momentsStar.nRealizableMoments() >= nMomentsStar - 1) | ||
232 | if (mStar.nRealizableMoments() >= nMomentsStar - 1) | ||
231 | 233 | { | { |
232 | univariateMomentSet m(nMomentsStar, 0.0, "Gauss", "RPlus"); | ||
233 | momentsStarToMoments(sigma, m, momentsStar); | ||
234 | univariateMomentSet m(nMomentsStar, "RPlus"); | ||
235 | momentsStarToMoments(sigma, m, mStar); | ||
234 | 236 | ||
235 | 237 | return m.last(); | return m.last(); |
236 | 238 | } | } |
... | ... | Foam::scalar Foam::gammaEQMOM::m2N | |
240 | 242 | ||
241 | 243 | void Foam::gammaEQMOM::recurrenceRelation | void Foam::gammaEQMOM::recurrenceRelation |
242 | 244 | ( | ( |
243 | scalarDiagonalMatrix& a, | ||
244 | scalarDiagonalMatrix& b, | ||
245 | scalarList& a, | ||
246 | scalarList& b, | ||
245 | 247 | scalar primaryAbscissa, | scalar primaryAbscissa, |
246 | 248 | scalar sigma | scalar sigma |
247 | 249 | ) | ) |
... | ... | Foam::scalar Foam::gammaEQMOM::sigmaMax(univariateMomentSet& moments) | |
266 | 268 | scalar sigmaZeta1 = | scalar sigmaZeta1 = |
267 | 269 | (moments[0]*moments[2] - moments[1]*moments[1])/(moments[0]*moments[1]); | (moments[0]*moments[2] - moments[1]*moments[1])/(moments[0]*moments[1]); |
268 | 270 | ||
269 | return sigmaZeta1;//min(sigmaZeta1, sigmaZeta2); | ||
271 | return sigmaZeta1; | ||
270 | 272 | } | } |
271 | 273 | ||
272 | 274 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/gamma/gammaEQMOM.H renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/gamma/gammaEQMOM.H (similarity 95%) (mode: 100644) (index 16d2e82..fab0b45) | |||
... | ... | public: | |
113 | 113 | ); | ); |
114 | 114 | ||
115 | 115 | //- Compute the last moment from starred moments | //- Compute the last moment from starred moments |
116 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar); | ||
116 | virtual scalar m2N | ||
117 | ( | ||
118 | scalar sigma, | ||
119 | const univariateMomentSet& momentsStar | ||
120 | ); | ||
117 | 121 | ||
118 | 122 | //- Recurrence relation for polynomials orthogonal to kernel function | //- Recurrence relation for polynomials orthogonal to kernel function |
119 | 123 | virtual void recurrenceRelation | virtual void recurrenceRelation |
120 | 124 | ( | ( |
121 | scalarDiagonalMatrix& a, | ||
122 | scalarDiagonalMatrix& b, | ||
125 | scalarList& a, | ||
126 | scalarList& b, | ||
123 | 127 | scalar primaryAbscissa, | scalar primaryAbscissa, |
124 | 128 | scalar sigma | scalar sigma |
125 | 129 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/lognormal/lognormalEQMOM.C renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/lognormal/lognormalEQMOM.C (similarity 85%) (mode: 100644) (index efb8a9d..9d5683b) | |||
... | ... | void Foam::lognormalEQMOM::momentsStarToMoments | |
85 | 85 | ||
86 | 86 | forAll(moments, momenti) | forAll(moments, momenti) |
87 | 87 | { | { |
88 | moments[momenti] = momentsStar[momenti]*Foam::pow(z, momenti*momenti); | ||
88 | moments[momenti] = momentsStar[momenti]*pow(z, momenti*momenti); | ||
89 | 89 | } | } |
90 | 90 | } | } |
91 | 91 | ||
... | ... | void Foam::lognormalEQMOM::momentsToMomentsStar | |
100 | 100 | ||
101 | 101 | forAll(moments, momenti) | forAll(moments, momenti) |
102 | 102 | { | { |
103 | momentsStar[momenti] = moments[momenti]*Foam::pow(z, momenti*momenti); | ||
103 | momentsStar[momenti] = moments[momenti]*pow(z, momenti*momenti); | ||
104 | 104 | } | } |
105 | 105 | } | } |
106 | 106 | ||
107 | 107 | Foam::scalar Foam::lognormalEQMOM::m2N | Foam::scalar Foam::lognormalEQMOM::m2N |
108 | 108 | ( | ( |
109 | 109 | scalar sigma, | scalar sigma, |
110 | univariateMomentSet momentsStar | ||
110 | const univariateMomentSet& momentsStar | ||
111 | 111 | ) | ) |
112 | 112 | { | { |
113 | if (momentsStar.nRealizableMoments() >= momentsStar.size() - 1) | ||
113 | univariateMomentSet mStar(momentsStar); | ||
114 | |||
115 | if (mStar.nRealizableMoments() >= mStar.size() - 1) | ||
114 | 116 | { | { |
115 | 117 | scalar z = exp(sqr(sigma)/2.0); | scalar z = exp(sqr(sigma)/2.0); |
116 | label nNod = momentsStar.size() - 1; | ||
118 | label nNod = mStar.size() - 1; | ||
117 | 119 | ||
118 | return momentsStar.last()*Foam::pow(z, nNod*nNod); | ||
120 | return mStar.last()*pow(z, nNod*nNod); | ||
119 | 121 | } | } |
120 | 122 | ||
121 | 123 | return GREAT; | return GREAT; |
... | ... | Foam::scalar Foam::lognormalEQMOM::m2N | |
123 | 125 | ||
124 | 126 | void Foam::lognormalEQMOM::recurrenceRelation | void Foam::lognormalEQMOM::recurrenceRelation |
125 | 127 | ( | ( |
126 | scalarDiagonalMatrix& a, | ||
127 | scalarDiagonalMatrix& b, | ||
128 | scalarList& a, | ||
129 | scalarList& b, | ||
128 | 130 | scalar primaryAbscissa, | scalar primaryAbscissa, |
129 | 131 | scalar sigma | scalar sigma |
130 | 132 | ) | ) |
... | ... | void Foam::lognormalEQMOM::recurrenceRelation | |
136 | 138 | ||
137 | 139 | for (label ai = 1; ai < a.size(); ai++) | for (label ai = 1; ai < a.size(); ai++) |
138 | 140 | { | { |
139 | a[ai] = ((sqEta + 1)*Foam::pow(sqEta, scalar(ai)) - 1.0) | ||
140 | *Foam::pow(eta, 2.0*scalar(ai) - 1.0); | ||
141 | a[ai] = ((sqEta + 1)*pow(sqEta, scalar(ai)) - 1.0) | ||
142 | *pow(eta, 2.0*scalar(ai) - 1.0); | ||
141 | 143 | } | } |
142 | 144 | ||
143 | 145 | b[0] = 0.0; | b[0] = 0.0; |
144 | 146 | ||
145 | 147 | for (label bi = 1; bi < b.size(); bi++) | for (label bi = 1; bi < b.size(); bi++) |
146 | 148 | { | { |
147 | b[bi] = Foam::pow(eta, 6.0*scalar(bi) - 4.0)*(Foam::pow(sqEta, scalar(bi)) - 1.0); | ||
149 | b[bi] = pow(eta, 6.0*scalar(bi) - 4.0)*(pow(sqEta, scalar(bi)) - 1.0); | ||
148 | 150 | } | } |
149 | 151 | } | } |
150 | 152 |
File multiphaseEulerPbeFoam/quadratureMethods/momentInversion/univariate/extended/lognormal/lognormalEQMOM.H renamed from multiphaseEulerPbeFoam/quadratureMethods/extentedMomentInversion/lognormal/lognormalEQMOM.H (similarity 95%) (mode: 100644) (index c4316a3..a1e1404) | |||
... | ... | public: | |
122 | 122 | ); | ); |
123 | 123 | ||
124 | 124 | //- Compute the last moment from starred moments | //- Compute the last moment from starred moments |
125 | virtual scalar m2N(scalar sigma, univariateMomentSet momentsStar); | ||
125 | virtual scalar m2N | ||
126 | ( | ||
127 | scalar sigma, | ||
128 | const univariateMomentSet& momentsStar | ||
129 | ); | ||
126 | 130 | ||
127 | 131 | //- Recurrence relation for polynomials orthogonal to kernel function | //- Recurrence relation for polynomials orthogonal to kernel function |
128 | 132 | virtual void recurrenceRelation | virtual void recurrenceRelation |
129 | 133 | ( | ( |
130 | scalarDiagonalMatrix& a, | ||
131 | scalarDiagonalMatrix& b, | ||
134 | scalarList& a, | ||
135 | scalarList& b, | ||
132 | 136 | scalar primaryAbscissa, | scalar primaryAbscissa, |
133 | 137 | scalar sigma | scalar sigma |
134 | 138 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/Make/files added (mode: 100644) (index 0000000..0a4ac8d) | |||
1 | momentSet/momentSet.C | ||
2 | univariateMomentSet/univariateMomentSet.C | ||
3 | multivariateMomentSet/multivariateMomentSet.C | ||
4 | |||
5 | LIB = $(FOAM_USER_LIBBIN)/libmomentSets |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/Make/options renamed from multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/Make/options (similarity 52%) (mode: 100644) (index d1b5d52..00af817) | |||
1 | 1 | EXE_INC = \ | EXE_INC = \ |
2 | 2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
3 | -I../../eigenSolver/lnInclude | ||
3 | -I../../mappedList \ | ||
4 | -I../momentSets/lnInclude | ||
4 | 5 | ||
5 | 6 | LIB_LIBS = \ | LIB_LIBS = \ |
6 | 7 | -lfiniteVolume \ | -lfiniteVolume \ |
7 | -L$(FOAM_USER_LIBBIN) \ | ||
8 | -leigenSolver | ||
8 | -L$(FOAM_USER_LIBBIN) |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/momentSet/momentSet.C added (mode: 100644) (index 0000000..aba2aa0) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | #include "momentSet.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | |||
30 | Foam::momentSet::momentSet | ||
31 | ( | ||
32 | const label nMoments, | ||
33 | const label nDimensions, | ||
34 | const labelListList& momentOrders, | ||
35 | const word& support, | ||
36 | const scalar initValue | ||
37 | ) | ||
38 | : | ||
39 | mappedList(nMoments, momentOrders, initValue), | ||
40 | nMoments_(nMoments), | ||
41 | nDimensions_(nDimensions), | ||
42 | momentOrders_(momentOrders), | ||
43 | support_(support) | ||
44 | { | ||
45 | if (support_ != "R" && support_ != "RPlus" && support_ != "01") | ||
46 | { | ||
47 | FatalErrorInFunction | ||
48 | << "The specified support is invalid." << nl | ||
49 | << " Valid supports are: R, RPlus and 01." << nl | ||
50 | << " Moment set: " << (*this) | ||
51 | << abort(FatalError); | ||
52 | } | ||
53 | |||
54 | if (nDimensions_ > 5) | ||
55 | { | ||
56 | FatalErrorInFunction | ||
57 | << "The number of maximum dimensions for the NDF is 5." << nl | ||
58 | << " Specified number of dimensions: " << nDimensions_ | ||
59 | << abort(FatalError); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | Foam::momentSet::momentSet | ||
64 | ( | ||
65 | const scalarList& m, | ||
66 | const label nDimensions, | ||
67 | const labelListList& momentOrders, | ||
68 | const word& support | ||
69 | ) | ||
70 | : | ||
71 | mappedList(m, momentOrders), | ||
72 | nMoments_(m.size()), | ||
73 | nDimensions_(nDimensions), | ||
74 | momentOrders_(momentOrders), | ||
75 | support_(support) | ||
76 | { | ||
77 | if (support_ != "R" && support_ != "RPlus" && support_ != "01") | ||
78 | { | ||
79 | FatalErrorInFunction | ||
80 | << "The specified support is invalid." << nl | ||
81 | << " Valid supports are: R, RPlus and 01." | ||
82 | << abort(FatalError); | ||
83 | } | ||
84 | |||
85 | |||
86 | if (nDimensions_ > 5) | ||
87 | { | ||
88 | FatalErrorInFunction | ||
89 | << "The number of maximum dimensions for the NDF is 5." << nl | ||
90 | << " Specified number of dimensions: " << nDimensions_ | ||
91 | << abort(FatalError); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | |||
96 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
97 | |||
98 | Foam::momentSet::~momentSet() | ||
99 | {} | ||
100 | |||
101 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/momentSet/momentSet.H copied from file multiphaseEulerPbeFoam/Vandermonde/Vandermonde.H (similarity 53%) (mode: 100644) (index f5f9ce2..89227a9) | |||
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) 2014-2017 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::Vandermonde | ||
25 | Foam::momentSet | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Stores the second row of a Vandermonde matrix, and solves the associated | ||
29 | linear system. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | William H. Press, Saul A. Teukolsky, | ||
34 | William T. Vetterling, and Brian P. Flannery. 1992. | ||
35 | "Numerical Recipes in C (2nd Ed.): The Art of Scientific Computing." | ||
36 | Cambridge University Press, New York, NY, USA. | ||
37 | \endverbatim | ||
28 | Stores a generic moment set with the corresponding list of orders. | ||
38 | 29 | ||
39 | 30 | SourceFiles | SourceFiles |
40 | Vandermonde.C | ||
31 | momentSet.C | ||
32 | momentSetI.H | ||
41 | 33 | ||
42 | 34 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
43 | 35 | ||
44 | #ifndef Vandermonde_H | ||
45 | #define Vandermonde_H | ||
46 | |||
47 | #include "scalarMatrices.H" | ||
36 | #ifndef momentSet_H | ||
37 | #define momentSet_H | ||
48 | 38 | ||
39 | #include "labelList.H" | ||
40 | #include "scalarList.H" | ||
41 | #include "mappedList.H" | ||
49 | 42 | ||
50 | 43 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
51 | 44 | ||
... | ... | namespace Foam | |
53 | 46 | { | { |
54 | 47 | ||
55 | 48 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
56 | Class Vandermonde Declaration | ||
49 | Class momentSet Declaration | ||
57 | 50 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
58 | 51 | ||
59 | class Vandermonde | ||
52 | class momentSet | ||
60 | 53 | : | : |
61 | public scalarDiagonalMatrix | ||
54 | public mappedList<scalar> | ||
62 | 55 | { | { |
63 | // Private data | ||
56 | protected: | ||
57 | |||
58 | // Protected data | ||
59 | |||
60 | //- Number of moments | ||
61 | label nMoments_; | ||
62 | |||
63 | //- Number of dimensions of the the NDF associated to the moment set | ||
64 | label nDimensions_; | ||
65 | |||
66 | //- List of moment orders | ||
67 | labelListList momentOrders_; | ||
68 | |||
69 | //- Type of support of the measure associated to the moment set | ||
70 | word support_; | ||
64 | 71 | ||
65 | //- Dimesions of the matrix | ||
66 | const label m_; | ||
67 | 72 | ||
68 | 73 | public: | public: |
69 | 74 | ||
70 | 75 | // Constructors | // Constructors |
71 | 76 | ||
72 | //- Construct from a given vector | ||
73 | Vandermonde | ||
77 | //- Construct from number of moments and initial value | ||
78 | momentSet | ||
74 | 79 | ( | ( |
75 | const scalarDiagonalMatrix& A | ||
80 | const label nMoments, | ||
81 | const label nDimensions, | ||
82 | const labelListList& momentOrders, | ||
83 | const word& support, | ||
84 | const scalar initValue = 0 | ||
76 | 85 | ); | ); |
77 | 86 | ||
78 | //- Construct from a square Vandermonde matrix | ||
79 | Vandermonde | ||
87 | //- Construct from scalarList | ||
88 | momentSet | ||
80 | 89 | ( | ( |
81 | const scalarSquareMatrix& A, | ||
82 | const bool checkVandermonde = false | ||
90 | const scalarList& m, | ||
91 | const label nDimensions, | ||
92 | const labelListList& momentOrders, | ||
93 | const word& support | ||
83 | 94 | ); | ); |
84 | 95 | ||
85 | |||
86 | 96 | //- Destructor | //- Destructor |
87 | ~Vandermonde(); | ||
97 | virtual ~momentSet(); | ||
88 | 98 | ||
89 | 99 | ||
90 | 100 | // Member Functions | // Member Functions |
91 | 101 | ||
92 | //- Solve the Vandermonde linear system with the given source vector | ||
93 | void solve | ||
94 | ( | ||
95 | scalarDiagonalMatrix& x, | ||
96 | const scalarDiagonalMatrix& source | ||
97 | ); | ||
98 | |||
99 | //- Invert Vandermonde matrix | ||
100 | scalarSquareMatrix inv(); | ||
102 | //- Return moment orders | ||
103 | inline const labelListList& momentOrders() const; | ||
101 | 104 | ||
105 | //- Return the number of dimensions of the NDF | ||
106 | inline label nDimensions() const; | ||
102 | 107 | ||
103 | // Member Operators | ||
108 | //- Return the number of moments | ||
109 | inline label nMoments() const; | ||
104 | 110 | ||
105 | //- Return the complete Vandermonde matrix | ||
106 | scalarSquareMatrix operator()(); | ||
107 | |||
108 | //- Return a given component of the Vandermonde matrix | ||
109 | scalar operator()(label i, label j); | ||
111 | //- Return support | ||
112 | inline const word support() const; | ||
110 | 113 | }; | }; |
111 | 114 | ||
112 | 115 | ||
... | ... | public: | |
114 | 117 | ||
115 | 118 | } // End namespace Foam | } // End namespace Foam |
116 | 119 | ||
117 | |||
118 | 120 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
119 | 121 | ||
120 | #include "VandermondeI.H" | ||
122 | #include "momentSetI.H" | ||
121 | 123 | ||
122 | 124 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
123 | 125 | ||
124 | 126 | #endif | #endif |
125 | 127 | ||
126 | |||
127 | 128 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/momentSet/momentSetI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H (similarity 76%) (mode: 100644 -> 100755) (index ddb0a21..02b848e) | |||
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) 2014-2017 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& | ||
29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | ||
28 | const Foam::labelListList& Foam::momentSet::momentOrders() const | ||
30 | 29 | { | { |
31 | return quadrature_; | ||
30 | return momentOrders_; | ||
32 | 31 | } | } |
33 | 32 | ||
33 | Foam::label Foam::momentSet::nMoments() const | ||
34 | { | ||
35 | return nMoments_; | ||
36 | } | ||
37 | |||
38 | Foam::label Foam::momentSet::nDimensions() const | ||
39 | { | ||
40 | return nDimensions_; | ||
41 | } | ||
42 | |||
43 | const Foam::word Foam::momentSet::support() const | ||
44 | { | ||
45 | return support_; | ||
46 | } | ||
34 | 47 | ||
35 | 48 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/multivariateMomentSet/multivariateMomentSet.C copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.C (similarity 67%) (mode: 100644) (index 2c8834d..0148ba2) | |||
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) 2014-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
23 | 23 | ||
24 | 24 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
25 | 25 | ||
26 | #include "noMixing.H" | ||
27 | #include "addToRunTimeSelectionTable.H" | ||
26 | #include "multivariateMomentSet.H" | ||
28 | 27 | ||
29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
30 | 29 | ||
31 | namespace Foam | ||
32 | { | ||
33 | namespace mixingModels | ||
34 | { | ||
35 | defineTypeNameAndDebug(noMixing, 0); | ||
36 | addToRunTimeSelectionTable | ||
30 | Foam::multivariateMomentSet::multivariateMomentSet | ||
31 | ( | ||
32 | const label nMoments, | ||
33 | const labelListList& momentOrders, | ||
34 | const word& support, | ||
35 | const scalar initValue | ||
36 | ) | ||
37 | : | ||
38 | momentSet | ||
37 | 39 | ( | ( |
38 | mixingModel, | ||
39 | noMixing, | ||
40 | dictionary | ||
41 | ); | ||
42 | } | ||
43 | } | ||
44 | |||
45 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
40 | nMoments, | ||
41 | momentOrders[0].size(), | ||
42 | momentOrders, | ||
43 | support, | ||
44 | initValue | ||
45 | ) | ||
46 | {} | ||
46 | 47 | ||
47 | Foam::mixingModels::noMixing::noMixing | ||
48 | Foam::multivariateMomentSet::multivariateMomentSet | ||
48 | 49 | ( | ( |
49 | const word& name, | ||
50 | const dictionary& dict, | ||
51 | const volVectorField& U, | ||
52 | const surfaceScalarField& phi | ||
50 | const scalarList& m, | ||
51 | const labelListList& momentOrders, | ||
52 | const word& support | ||
53 | 53 | ) | ) |
54 | 54 | : | : |
55 | mixingModel(name, dict, U, phi), | ||
56 | name_(name) | ||
55 | momentSet | ||
56 | ( | ||
57 | m, | ||
58 | momentOrders[0].size(), | ||
59 | momentOrders, | ||
60 | support | ||
61 | ) | ||
57 | 62 | {} | {} |
58 | 63 | ||
59 | 64 | ||
60 | 65 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
61 | 66 | ||
62 | Foam::mixingModels::noMixing::~noMixing() | ||
67 | Foam::multivariateMomentSet::~multivariateMomentSet() | ||
63 | 68 | {} | {} |
64 | 69 | ||
65 | 70 | ||
66 | 71 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
67 | 72 | ||
68 | void Foam::mixingModels::noMixing::solve() | ||
69 | { | ||
70 | return; | ||
71 | } | ||
72 | 73 | ||
73 | 74 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/multivariateMomentSet/multivariateMomentSet.H copied from file multiphaseEulerPbeFoam/quadratureMethods/mixingModels/noMixing/noMixing.H (similarity 59%) (mode: 100644) (index 9254c4b..1507dc6) | |||
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) 2014-2017 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::multivariateMomentSet | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Disables the solution of the mixing model. | ||
28 | Stores a multivariate moment set with the corresponding list of orders. | ||
29 | 29 | ||
30 | 30 | SourceFiles | SourceFiles |
31 | noMixing.C | ||
31 | multivariateMomentSet.C | ||
32 | 32 | ||
33 | 33 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
34 | 34 | ||
35 | #ifndef noMixing_H | ||
36 | #define noMixing_H | ||
35 | #ifndef multivariateMomentSet_H | ||
36 | #define multivariateMomentSet_H | ||
37 | 37 | ||
38 | #include "mixingModel.H" | ||
38 | #include "momentSet.H" | ||
39 | #include "Map.H" | ||
39 | 40 | ||
40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 42 | ||
42 | 43 | namespace Foam | namespace Foam |
43 | 44 | { | { |
44 | namespace mixingModels | ||
45 | { | ||
46 | 45 | ||
47 | 46 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
48 | Class noMixing Declaration | ||
47 | Class multivariateMomentSet Declaration | ||
49 | 48 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
50 | 49 | ||
51 | class noMixing | ||
50 | class multivariateMomentSet | ||
52 | 51 | : | : |
53 | public mixingModel | ||
52 | public momentSet | ||
54 | 53 | { | { |
55 | // Private data | ||
56 | |||
57 | //- Name of the noMixing | ||
58 | const word name_; | ||
59 | |||
60 | |||
61 | 54 | public: | public: |
62 | 55 | ||
63 | //- Runtime type information | ||
64 | TypeName("none"); | ||
65 | |||
66 | |||
67 | 56 | // Constructors | // Constructors |
68 | 57 | ||
69 | //- Construct from components | ||
70 | noMixing | ||
58 | //- Construct from number of moments and initial value | ||
59 | multivariateMomentSet | ||
71 | 60 | ( | ( |
72 | const word& name, | ||
73 | const dictionary& dict, | ||
74 | const volVectorField& U, | ||
75 | const surfaceScalarField& phi | ||
61 | const label nMoments, | ||
62 | const labelListList& momentOrders, | ||
63 | const word& support, | ||
64 | const scalar initValue = 0 | ||
76 | 65 | ); | ); |
77 | 66 | ||
67 | //- Construct from scalarList | ||
68 | multivariateMomentSet | ||
69 | ( | ||
70 | const scalarList& m, | ||
71 | const labelListList& momentOrders, | ||
72 | const word& support | ||
73 | ); | ||
78 | 74 | ||
79 | 75 | //- Destructor | //- Destructor |
80 | virtual ~noMixing(); | ||
76 | virtual ~multivariateMomentSet(); | ||
77 | |||
81 | 78 | ||
82 | 79 | // Member Functions | // Member Functions |
83 | 80 | ||
84 | //- Solve mixing model | ||
85 | void solve(); | ||
81 | //- Returns const access to the moment map | ||
82 | inline const Map<label>& momentMap() const; | ||
83 | |||
84 | //- Recalculate the moments from the quadrature nodes | ||
85 | //void update(); | ||
86 | 86 | }; | }; |
87 | 87 | ||
88 | 88 | ||
89 | 89 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
90 | 90 | ||
91 | } // End namespace mixingModels | ||
92 | 91 | } // End namespace Foam | } // End namespace Foam |
93 | 92 | ||
94 | 93 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
95 | 94 | ||
95 | #include "multivariateMomentSetI.H" | ||
96 | |||
97 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
98 | |||
96 | 99 | #endif | #endif |
97 | 100 | ||
98 | 101 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/multivariateMomentSet/multivariateMomentSetI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/univariatePDFTransportModel/univariatePDFTransportModelI.H (similarity 85%) (mode: 100644 -> 100755) (index ddb0a21..28deaba) | |||
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) 2014-2017 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& | ||
29 | Foam::PDFTransportModels::univariatePDFTransportModel::quadrature() const | ||
28 | const Foam::Map<Foam::label>& Foam::multivariateMomentSet::momentMap() const | ||
30 | 29 | { | { |
31 | return quadrature_; | ||
30 | return (*this).map(); | ||
32 | 31 | } | } |
33 | 32 | ||
34 | |||
35 | 33 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/univariateMomentSet/univariateMomentSet.C renamed from multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/univariateMomentSet.C (similarity 63%) (mode: 100644) (index 83083ad..92f9089) | |||
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "univariateMomentSet.H" | #include "univariateMomentSet.H" |
27 | 27 | ||
28 | #include "eigenSolver.H" | ||
29 | |||
30 | 28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
31 | 29 | ||
32 | 30 | Foam::univariateMomentSet::univariateMomentSet | Foam::univariateMomentSet::univariateMomentSet |
33 | 31 | ( | ( |
34 | 32 | const label nMoments, | const label nMoments, |
35 | const scalar initValue, | ||
36 | const word& quadratureType, | ||
37 | 33 | const word& support, | const word& support, |
38 | const scalar knownAbscissa | ||
34 | const scalar initValue, | ||
35 | const label nFixedQuadraturePoints | ||
39 | 36 | ) | ) |
40 | 37 | : | : |
41 | scalarDiagonalMatrix(nMoments, initValue), | ||
42 | nMoments_(nMoments), | ||
38 | momentSet | ||
39 | ( | ||
40 | nMoments, | ||
41 | 1, | ||
42 | makeUnivariateMomentOrders(nMoments), | ||
43 | support, | ||
44 | initValue | ||
45 | ), | ||
43 | 46 | alpha_(), | alpha_(), |
44 | 47 | beta_(), | beta_(), |
45 | quadratureType_(quadratureType), | ||
46 | support_(support), | ||
48 | zeta_(nMoments_ - 1), | ||
47 | 49 | negativeZeta_(0), | negativeZeta_(0), |
48 | 50 | degenerate_(false), | degenerate_(false), |
49 | inverted_(false), | ||
50 | 51 | fullyRealizable_(true), | fullyRealizable_(true), |
51 | 52 | subsetRealizable_(true), | subsetRealizable_(true), |
52 | 53 | onMomentSpaceBoundary_(false), | onMomentSpaceBoundary_(false), |
53 | realizabilityChecked_(false), | ||
54 | quadratureSetUp_(false), | ||
55 | forceGauss_(false), | ||
56 | nInvertibleMoments_(nMoments_), | ||
57 | 54 | nRealizableMoments_(0), | nRealizableMoments_(0), |
58 | nNodes_(0), | ||
59 | knownAbscissa_(knownAbscissa), | ||
60 | weights_(), | ||
61 | abscissae_() | ||
55 | realizabilityChecked_(false) | ||
62 | 56 | { | { |
63 | 57 | if (support_ != "R" && support_ != "RPlus" && support_ != "01") | if (support_ != "R" && support_ != "RPlus" && support_ != "01") |
64 | 58 | { | { |
65 | 59 | FatalErrorInFunction | FatalErrorInFunction |
66 | 60 | << "The specified support is invalid." << nl | << "The specified support is invalid." << nl |
67 | << " Valid supports are: R, RPlus and 01." << nl | ||
68 | << " Moment set: " << (*this) | ||
61 | << " Valid supports are: R, RPlus and 01." | ||
69 | 62 | << abort(FatalError); | << abort(FatalError); |
70 | 63 | } | } |
71 | 64 | ||
72 | if (quadratureType_ != "Gauss" && quadratureType_ != "GaussRadau") | ||
65 | if (nFixedQuadraturePoints < 0 || nFixedQuadraturePoints > 2) | ||
73 | 66 | { | { |
74 | 67 | FatalErrorInFunction | FatalErrorInFunction |
75 | << "The specified quadrature type is invalid." << endl | ||
76 | << "Valid quadrature types are: Gauss and GaussRadau." | ||
68 | << "The specified number of fixed points is not correct." << nl | ||
69 | << " Valid values are: 0, 1 and 2." | ||
77 | 70 | << abort(FatalError); | << abort(FatalError); |
78 | 71 | } | } |
79 | 72 | ||
80 | label recurrenceSize = label((nMoments_ - 2)/2) + 1; | ||
81 | |||
82 | if (quadratureType_ == "GaussRadau") | ||
83 | { | ||
84 | recurrenceSize += 1; | ||
85 | } | ||
73 | label recurrenceSize = | ||
74 | label((nMoments - 2)/2) + 1 + nFixedQuadraturePoints; | ||
86 | 75 | ||
87 | alpha_.setSize(recurrenceSize, scalar(0)); | ||
88 | beta_.setSize(recurrenceSize + 1, scalar(0)); | ||
76 | alpha_.setSize(recurrenceSize, 0); | ||
77 | beta_.setSize(recurrenceSize + 1, 0); | ||
89 | 78 | } | } |
90 | 79 | ||
91 | 80 | Foam::univariateMomentSet::univariateMomentSet | Foam::univariateMomentSet::univariateMomentSet |
92 | 81 | ( | ( |
93 | const scalarDiagonalMatrix& m, | ||
94 | const word& quadratureType, | ||
82 | const scalarList& m, | ||
95 | 83 | const word& support, | const word& support, |
96 | const scalar knownAbscissa | ||
84 | const label nFixedQuadraturePoints | ||
97 | 85 | ) | ) |
98 | 86 | : | : |
99 | scalarDiagonalMatrix(m), | ||
100 | nMoments_(m.size()), | ||
87 | momentSet | ||
88 | ( | ||
89 | m, | ||
90 | 1, | ||
91 | makeUnivariateMomentOrders(m.size()), | ||
92 | support | ||
93 | ), | ||
101 | 94 | alpha_(), | alpha_(), |
102 | 95 | beta_(), | beta_(), |
103 | quadratureType_(quadratureType), | ||
104 | support_(support), | ||
105 | 96 | negativeZeta_(0), | negativeZeta_(0), |
106 | 97 | degenerate_(false), | degenerate_(false), |
107 | inverted_(false), | ||
108 | 98 | fullyRealizable_(true), | fullyRealizable_(true), |
109 | 99 | subsetRealizable_(true), | subsetRealizable_(true), |
110 | 100 | onMomentSpaceBoundary_(false), | onMomentSpaceBoundary_(false), |
111 | realizabilityChecked_(false), | ||
112 | quadratureSetUp_(false), | ||
113 | forceGauss_(false), | ||
114 | nInvertibleMoments_(nMoments_), | ||
115 | 101 | nRealizableMoments_(0), | nRealizableMoments_(0), |
116 | nNodes_(0), | ||
117 | knownAbscissa_(knownAbscissa), | ||
118 | weights_(), | ||
119 | abscissae_() | ||
102 | realizabilityChecked_(false) | ||
120 | 103 | { | { |
121 | 104 | if (support_ != "R" && support_ != "RPlus" && support_ != "01") | if (support_ != "R" && support_ != "RPlus" && support_ != "01") |
122 | 105 | { | { |
... | ... | Foam::univariateMomentSet::univariateMomentSet | |
126 | 109 | << abort(FatalError); | << abort(FatalError); |
127 | 110 | } | } |
128 | 111 | ||
129 | if (quadratureType_ != "Gauss" && quadratureType_ != "GaussRadau") | ||
112 | if (nFixedQuadraturePoints < 0 || nFixedQuadraturePoints > 2) | ||
130 | 113 | { | { |
131 | 114 | FatalErrorInFunction | FatalErrorInFunction |
132 | << "The specified quadrature type is invalid." << endl | ||
133 | << "Valid quadrature types are: Gauss and GaussRadau." | ||
115 | << "The specified number of fixed points /*is*/ not correct." << nl | ||
116 | << " Valid values are: 0, 1 and 2." | ||
134 | 117 | << abort(FatalError); | << abort(FatalError); |
135 | 118 | } | } |
136 | 119 | ||
137 | label recurrenceSize = label((nMoments_ - 2)/2) + 1; | ||
120 | label recurrenceSize = | ||
121 | label((nMoments_ - 2)/2) + 1 + nFixedQuadraturePoints; | ||
138 | 122 | ||
139 | alpha_.setSize(recurrenceSize, scalar(0)); | ||
140 | beta_.setSize(recurrenceSize + 1, scalar(0)); | ||
123 | alpha_.setSize(recurrenceSize, 0); | ||
124 | beta_.setSize(recurrenceSize + 1, 0); | ||
141 | 125 | } | } |
142 | 126 | ||
143 | 127 | ||
... | ... | Foam::univariateMomentSet::univariateMomentSet | |
146 | 130 | Foam::univariateMomentSet::~univariateMomentSet() | Foam::univariateMomentSet::~univariateMomentSet() |
147 | 131 | {} | {} |
148 | 132 | ||
149 | |||
150 | 133 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
151 | 134 | ||
152 | void Foam::univariateMomentSet::invert() | ||
153 | { | ||
154 | if (inverted_) | ||
155 | { | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | if ((*this)[0] < SMALL) | ||
160 | { | ||
161 | nNodes_ = 0; | ||
162 | |||
163 | return; | ||
164 | } | ||
165 | |||
166 | if (isDegenerate()) // || (*this)[0] <= 0.0) | ||
167 | { | ||
168 | //degenerate_ = true; | ||
169 | setupQuadrature(); | ||
170 | weights_[0] = (*this)[0]; | ||
171 | abscissae_[0] = 0.0; | ||
172 | inverted_ = true; | ||
173 | |||
174 | return; | ||
175 | } | ||
176 | |||
177 | if (!realizabilityChecked_) | ||
178 | { | ||
179 | checkRealizability(); | ||
180 | setupQuadrature(true); | ||
181 | } | ||
182 | |||
183 | if (!quadratureSetUp_) | ||
184 | { | ||
185 | setupQuadrature(true); | ||
186 | } | ||
187 | |||
188 | if (nInvertibleMoments_ < 2) | ||
189 | { | ||
190 | FatalErrorInFunction | ||
191 | << "Insufficient number (" << nInvertibleMoments_ | ||
192 | << ") of moments to define quadrature." << nl | ||
193 | << " Moment set: " << (*this) | ||
194 | << abort(FatalError); | ||
195 | } | ||
196 | |||
197 | if (forceGauss_) | ||
198 | { | ||
199 | WarningInFunction | ||
200 | << "Forcing Gauss quadrature. " << nl | ||
201 | << " Originally requested quadrature type: " | ||
202 | << quadratureType_ << nl | ||
203 | << " Number of realizable moments: " | ||
204 | << nRealizableMoments_ << nl | ||
205 | << " Moment set: " << (*this) | ||
206 | << endl; | ||
207 | } | ||
208 | |||
209 | if (nInvertibleMoments_ == 2) | ||
210 | { | ||
211 | weights_[0] = (*this)[0]; | ||
212 | abscissae_[0] = (*this)[1]/(*this)[0]; | ||
213 | |||
214 | inverted_ = true; | ||
215 | |||
216 | return; | ||
217 | } | ||
218 | |||
219 | if (quadratureType_ == "GaussRadau" && !forceGauss_) | ||
220 | { | ||
221 | // Compute P_{N-1} and P_{N-2} by recurrence | ||
222 | // It is assumed the added point has abscissa in zero (xi0 = 0) | ||
223 | scalar p = knownAbscissa_ - alpha_[0]; | ||
224 | scalar pMinus1 = 1.0; | ||
225 | scalar p1 = p; | ||
226 | |||
227 | for (label i = 1; i < nNodes_ - 1; i++) | ||
228 | { | ||
229 | p = knownAbscissa_ - alpha_[0]*p1 - beta_[i]*pMinus1; | ||
230 | pMinus1 = p1; | ||
231 | p1 = p; | ||
232 | } | ||
233 | |||
234 | alpha_[nNodes_ - 1] = knownAbscissa_ - beta_[nNodes_ - 1]*pMinus1/p; | ||
235 | } | ||
236 | |||
237 | scalarSquareMatrix z(nNodes_, scalar(0)); | ||
238 | |||
239 | for (label i = 0; i < nNodes_ - 1; i++) | ||
240 | { | ||
241 | z[i][i] = alpha_[i]; | ||
242 | z[i][i+1] = Foam::sqrt(beta_[i+1]); | ||
243 | z[i+1][i] = z[i][i+1]; | ||
244 | } | ||
245 | |||
246 | z[nNodes_ - 1][nNodes_ - 1] = alpha_[nNodes_ - 1]; | ||
247 | |||
248 | // Computing weights and abscissae | ||
249 | eigenSolver zEig(z, true); | ||
250 | |||
251 | // Computing weights and abscissae | ||
252 | for (label i = 0; i < nNodes_; i++) | ||
253 | { | ||
254 | weights_[i] = (*this)[0]*sqr(zEig.eigenvectors()[0][i]); | ||
255 | abscissae_[i] = zEig.eigenvaluesRe()[i]; | ||
256 | } | ||
257 | |||
258 | inverted_ = true; | ||
259 | } | ||
260 | |||
261 | 135 | void Foam::univariateMomentSet::checkCanonicalMoments | void Foam::univariateMomentSet::checkCanonicalMoments |
262 | 136 | ( | ( |
263 | const scalarDiagonalMatrix& zeta, | ||
137 | const scalarList& zeta, | ||
264 | 138 | const label nZeta | const label nZeta |
265 | 139 | ) | ) |
266 | 140 | { | { |
267 | scalarDiagonalMatrix canonicalMoments(nZeta, 0.0); | ||
141 | scalarList canonicalMoments(nZeta, 0.0); | ||
268 | 142 | ||
269 | 143 | canonicalMoments[0] = zeta[0]; | canonicalMoments[0] = zeta[0]; |
270 | 144 | ||
... | ... | void Foam::univariateMomentSet::checkCanonicalMoments | |
300 | 174 | } | } |
301 | 175 | ||
302 | 176 | onMomentSpaceBoundary_ = false; | onMomentSpaceBoundary_ = false; |
303 | nRealizableMoments_ = nZeta + 1; | ||
177 | nRealizableMoments_ = nZeta; | ||
304 | 178 | } | } |
305 | 179 | ||
306 | void Foam::univariateMomentSet::checkRealizability() | ||
180 | void Foam::univariateMomentSet::checkRealizability | ||
181 | ( | ||
182 | bool fatalErrorOnFailedRealizabilityTest | ||
183 | ) | ||
307 | 184 | { | { |
308 | 185 | if (realizabilityChecked_) | if (realizabilityChecked_) |
309 | 186 | { | { |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
313 | 190 | // If the zero-order moment is negative, exit immediately. | // If the zero-order moment is negative, exit immediately. |
314 | 191 | if ((*this)[0] < 0.0) | if ((*this)[0] < 0.0) |
315 | 192 | { | { |
316 | FatalErrorInFunction | ||
317 | << "The zero-order moment is negative." << nl | ||
318 | << " Moment set: " << (*this) | ||
319 | << abort(FatalError); | ||
193 | if (fatalErrorOnFailedRealizabilityTest) | ||
194 | { | ||
195 | FatalErrorInFunction | ||
196 | << "The zero-order moment is negative." << nl | ||
197 | << " Moment set: " << (*this) | ||
198 | << abort(FatalError); | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | realizabilityChecked_ = true; | ||
203 | negativeZeta_ = 0; | ||
204 | nRealizableMoments_ = 0; | ||
205 | fullyRealizable_ = false; | ||
206 | subsetRealizable_ = false; | ||
207 | onMomentSpaceBoundary_ = false; | ||
208 | |||
209 | return; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | if ((*this)[0] < SMALL && !fatalErrorOnFailedRealizabilityTest) | ||
214 | { | ||
215 | realizabilityChecked_ = true; | ||
216 | negativeZeta_ = 0; | ||
217 | nRealizableMoments_ = 0; | ||
218 | fullyRealizable_ = false; | ||
219 | subsetRealizable_ = false; | ||
220 | onMomentSpaceBoundary_ = false; | ||
221 | |||
222 | return; | ||
320 | 223 | } | } |
321 | 224 | ||
322 | 225 | // Check for the degenerate case where only m0 is defined | // Check for the degenerate case where only m0 is defined |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
333 | 236 | label nR = nN - 2*nD; | label nR = nN - 2*nD; |
334 | 237 | ||
335 | 238 | // Vector of zeta values used to check moment realizability | // Vector of zeta values used to check moment realizability |
336 | scalarDiagonalMatrix zeta(nN); | ||
239 | //scalarList zeta(nN); | ||
240 | zeta_ = 0.0; | ||
337 | 241 | ||
338 | 242 | // Check for the case with only two moments, if support is R+ or [0,1] | // Check for the case with only two moments, if support is R+ or [0,1] |
339 | 243 | // In the case of support over R, only check if beta < 0 | // In the case of support over R, only check if beta < 0 |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
343 | 247 | { | { |
344 | 248 | negativeZeta_ = 0; | negativeZeta_ = 0; |
345 | 249 | nRealizableMoments_ = 2; | nRealizableMoments_ = 2; |
346 | nInvertibleMoments_ = 2; | ||
347 | 250 | fullyRealizable_ = true; | fullyRealizable_ = true; |
348 | 251 | subsetRealizable_ = true; | subsetRealizable_ = true; |
252 | onMomentSpaceBoundary_ = false; | ||
349 | 253 | ||
350 | 254 | return; | return; |
351 | 255 | } | } |
352 | 256 | ||
353 | zeta[0] = (*this)[1]/(*this)[0]; | ||
257 | zeta_[0] = (*this)[1]/(*this)[0]; | ||
354 | 258 | ||
355 | if (zeta[0] <= 0.0) | ||
259 | if (zeta_[0] <= 0.0) | ||
356 | 260 | { | { |
357 | if (isDegenerate() || zeta[0] == 0.0) | ||
261 | if (isDegenerate() || zeta_[0] == 0.0) | ||
358 | 262 | { | { |
359 | 263 | negativeZeta_ = 0; | negativeZeta_ = 0; |
360 | 264 | nRealizableMoments_ = 2; | nRealizableMoments_ = 2; |
361 | nInvertibleMoments_ = 2; | ||
362 | 265 | fullyRealizable_ = true; | fullyRealizable_ = true; |
363 | 266 | subsetRealizable_ = true; | subsetRealizable_ = true; |
364 | 267 | onMomentSpaceBoundary_ = true; | onMomentSpaceBoundary_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
366 | 269 | return; | return; |
367 | 270 | } | } |
368 | 271 | ||
369 | negativeZeta_ = 1; | ||
370 | nRealizableMoments_ = 1; | ||
371 | nInvertibleMoments_ = 0; | ||
372 | fullyRealizable_ = false; | ||
373 | subsetRealizable_ = true; | ||
374 | onMomentSpaceBoundary_ = false; | ||
375 | |||
376 | FatalErrorInFunction | ||
377 | << "Moment set with dimension 2 and only one realizable moment." | ||
272 | if (fatalErrorOnFailedRealizabilityTest) | ||
273 | { | ||
274 | FatalErrorInFunction | ||
275 | << "Moment set with dimension 2 and only one valid moment." | ||
378 | 276 | << nl << " Moment set: " << (*this) | << nl << " Moment set: " << (*this) |
379 | 277 | << abort(FatalError); | << abort(FatalError); |
278 | } | ||
279 | else | ||
280 | { | ||
281 | negativeZeta_ = 1; | ||
282 | nRealizableMoments_ = 1; | ||
283 | fullyRealizable_ = false; | ||
284 | subsetRealizable_ = false; | ||
285 | onMomentSpaceBoundary_ = false; | ||
286 | |||
287 | return; | ||
288 | } | ||
380 | 289 | } | } |
381 | 290 | ||
382 | 291 | if (support_ == "RPlus") | if (support_ == "RPlus") |
383 | 292 | { | { |
384 | 293 | negativeZeta_ = 0; | negativeZeta_ = 0; |
385 | 294 | nRealizableMoments_ = 2; | nRealizableMoments_ = 2; |
386 | nInvertibleMoments_ = 2; | ||
387 | 295 | fullyRealizable_ = true; | fullyRealizable_ = true; |
388 | 296 | subsetRealizable_ = true; | subsetRealizable_ = true; |
389 | 297 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
393 | 301 | } | } |
394 | 302 | else // Support on [0, 1] - Check if canonical moments belong to [0,1] | else // Support on [0, 1] - Check if canonical moments belong to [0,1] |
395 | 303 | { | { |
396 | if (zeta[0] <= 1.0) | ||
304 | if (zeta_[0] <= 1.0) | ||
397 | 305 | { | { |
398 | 306 | nRealizableMoments_ = 2; | nRealizableMoments_ = 2; |
399 | nInvertibleMoments_ = 2; | ||
400 | 307 | fullyRealizable_ = true; | fullyRealizable_ = true; |
401 | 308 | subsetRealizable_ = true; | subsetRealizable_ = true; |
402 | 309 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
403 | 310 | ||
404 | if (zeta[0] < 1.0) | ||
311 | if (zeta_[0] < 1.0) | ||
405 | 312 | { | { |
406 | 313 | onMomentSpaceBoundary_ = false; | onMomentSpaceBoundary_ = false; |
407 | 314 | } | } |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
418 | 325 | { | { |
419 | 326 | negativeZeta_ = 0; | negativeZeta_ = 0; |
420 | 327 | nRealizableMoments_ = 2; | nRealizableMoments_ = 2; |
421 | nInvertibleMoments_ = 2; | ||
422 | 328 | fullyRealizable_ = true; | fullyRealizable_ = true; |
423 | 329 | subsetRealizable_ = true; | subsetRealizable_ = true; |
424 | 330 | onMomentSpaceBoundary_ = true; | onMomentSpaceBoundary_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
426 | 332 | return; | return; |
427 | 333 | } | } |
428 | 334 | ||
429 | negativeZeta_ = 1; | ||
430 | nRealizableMoments_ = 1; | ||
431 | nInvertibleMoments_ = 0; | ||
432 | fullyRealizable_ = false; | ||
433 | subsetRealizable_ = true; | ||
434 | |||
435 | FatalErrorInFunction | ||
436 | << "Moment set with dimension 2 and only one " | ||
437 | << "realizable moment." << nl | ||
438 | << " Moment set: " << (*this) | ||
335 | if (fatalErrorOnFailedRealizabilityTest) | ||
336 | { | ||
337 | FatalErrorInFunction | ||
338 | << "Moment set with dimension 2 and only one valid moment." | ||
339 | << nl << " Moment set: " << (*this) | ||
439 | 340 | << abort(FatalError); | << abort(FatalError); |
341 | } | ||
342 | else | ||
343 | { | ||
344 | negativeZeta_ = 1; | ||
345 | nRealizableMoments_ = 1; | ||
346 | fullyRealizable_ = false; | ||
347 | subsetRealizable_ = false; | ||
348 | onMomentSpaceBoundary_ = false; | ||
349 | |||
350 | return; | ||
351 | } | ||
440 | 352 | } | } |
441 | 353 | } | } |
442 | 354 | } | } |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
458 | 370 | - alpha_[0]*zRecurrence[0][columnI]; | - alpha_[0]*zRecurrence[0][columnI]; |
459 | 371 | } | } |
460 | 372 | ||
461 | zeta[0] = alpha_[0]; | ||
373 | zeta_[0] = alpha_[0]; | ||
462 | 374 | ||
463 | if (!(support_ == "R") && zeta[0] <= 0.0) | ||
375 | if (!(support_ == "R") && zeta_[0] <= 0.0) | ||
464 | 376 | { | { |
465 | if (isDegenerate() || zeta[0] == 0.0) | ||
377 | if (isDegenerate() || zeta_[0] == 0.0) | ||
466 | 378 | { | { |
467 | 379 | negativeZeta_ = 0; | negativeZeta_ = 0; |
468 | 380 | nRealizableMoments_ = 2; | nRealizableMoments_ = 2; |
469 | nInvertibleMoments_ = 2; | ||
470 | 381 | fullyRealizable_ = false; | fullyRealizable_ = false; |
471 | 382 | subsetRealizable_ = true; | subsetRealizable_ = true; |
472 | 383 | onMomentSpaceBoundary_ = true; | onMomentSpaceBoundary_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
474 | 385 | return; | return; |
475 | 386 | } | } |
476 | 387 | ||
477 | negativeZeta_ = 1; | ||
478 | nRealizableMoments_ = 1; | ||
479 | nInvertibleMoments_ = 0; | ||
480 | fullyRealizable_ = false; | ||
481 | subsetRealizable_ = true; | ||
482 | onMomentSpaceBoundary_ = false; | ||
388 | if (fatalErrorOnFailedRealizabilityTest) | ||
389 | { | ||
390 | FatalErrorInFunction | ||
391 | << "Moment set with only one valid moment." | ||
392 | << nl << " Moment set: " << (*this) | ||
393 | << abort(FatalError); | ||
394 | } | ||
395 | else | ||
396 | { | ||
397 | negativeZeta_ = 1; | ||
398 | nRealizableMoments_ = 1; | ||
399 | fullyRealizable_ = false; | ||
400 | subsetRealizable_ = false; | ||
401 | onMomentSpaceBoundary_ = false; | ||
483 | 402 | ||
484 | FatalErrorInFunction | ||
485 | << "Moment set with only one realizable moment." << nl | ||
486 | << " Moment set: " << (*this) | ||
487 | << abort(FatalError); | ||
403 | return; | ||
404 | } | ||
488 | 405 | } | } |
489 | 406 | ||
490 | 407 | for (label zetai = 1; zetai <= nD - 1; zetai++) | for (label zetai = 1; zetai <= nD - 1; zetai++) |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
497 | 414 | if (beta_[zetai] < 0.0) | if (beta_[zetai] < 0.0) |
498 | 415 | { | { |
499 | 416 | nRealizableMoments_ = 2*zetai; | nRealizableMoments_ = 2*zetai; |
500 | calcNInvertibleMoments(); | ||
501 | 417 | fullyRealizable_ = false; | fullyRealizable_ = false; |
502 | 418 | subsetRealizable_ = true; | subsetRealizable_ = true; |
503 | 419 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
507 | 423 | } | } |
508 | 424 | else | else |
509 | 425 | { | { |
510 | zeta[2*zetai - 1] = beta_[zetai]/zeta[2*zetai - 2]; | ||
426 | zeta_[2*zetai - 1] = beta_[zetai]/zeta_[2*zetai - 2]; | ||
511 | 427 | ||
512 | if (zeta[2*zetai - 1] <= 0.0) | ||
428 | if (zeta_[2*zetai - 1] <= 0.0) | ||
513 | 429 | { | { |
514 | 430 | if (support_ == "RPlus") | if (support_ == "RPlus") |
515 | 431 | { | { |
516 | if (zeta[2*zetai - 1] < 0.0) | ||
432 | if (zeta_[2*zetai - 1] < 0.0) | ||
517 | 433 | { | { |
518 | 434 | negativeZeta_ = 2*zetai; | negativeZeta_ = 2*zetai; |
519 | 435 | nRealizableMoments_ = negativeZeta_; | nRealizableMoments_ = negativeZeta_; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
528 | 444 | } | } |
529 | 445 | else // Support on [0,1] | else // Support on [0,1] |
530 | 446 | { | { |
531 | checkCanonicalMoments(zeta, 2*zetai); | ||
447 | checkCanonicalMoments(zeta_, 2*zetai); | ||
532 | 448 | } | } |
533 | 449 | ||
534 | calcNInvertibleMoments(); | ||
535 | 450 | fullyRealizable_ = false; | fullyRealizable_ = false; |
536 | 451 | subsetRealizable_ = true; | subsetRealizable_ = true; |
537 | 452 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
546 | 461 | ||
547 | 462 | if (!(support_ == "R")) | if (!(support_ == "R")) |
548 | 463 | { | { |
549 | zeta[2*zetai] = alpha_[zetai] - zeta[2*zetai - 1]; | ||
464 | zeta_[2*zetai] = alpha_[zetai] - zeta_[2*zetai - 1]; | ||
550 | 465 | ||
551 | if (zeta[2*zetai] <= 0.0) | ||
466 | if (zeta_[2*zetai] <= 0.0) | ||
552 | 467 | { | { |
553 | 468 | if (support_ == "RPlus") | if (support_ == "RPlus") |
554 | 469 | { | { |
555 | if (zeta[2*zetai] < 0.0) | ||
470 | if (zeta_[2*zetai] < 0.0) | ||
556 | 471 | { | { |
557 | 472 | negativeZeta_ = 2*zetai + 1; | negativeZeta_ = 2*zetai + 1; |
558 | 473 | nRealizableMoments_ = negativeZeta_; | nRealizableMoments_ = negativeZeta_; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
567 | 482 | } | } |
568 | 483 | else // Support on [0,1] | else // Support on [0,1] |
569 | 484 | { | { |
570 | checkCanonicalMoments(zeta, 2*zetai + 1); | ||
485 | checkCanonicalMoments(zeta_, 2*zetai + 1); | ||
571 | 486 | } | } |
572 | 487 | ||
573 | calcNInvertibleMoments(); | ||
574 | 488 | fullyRealizable_ = false; | fullyRealizable_ = false; |
575 | 489 | subsetRealizable_ = true; | subsetRealizable_ = true; |
576 | 490 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
597 | 511 | if (beta_[nD] < 0.0) | if (beta_[nD] < 0.0) |
598 | 512 | { | { |
599 | 513 | nRealizableMoments_ = 2*nD; | nRealizableMoments_ = 2*nD; |
600 | calcNInvertibleMoments(); | ||
601 | 514 | fullyRealizable_ = false; | fullyRealizable_ = false; |
602 | 515 | subsetRealizable_ = true; | subsetRealizable_ = true; |
603 | 516 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
607 | 520 | else | else |
608 | 521 | { | { |
609 | 522 | nRealizableMoments_ = nMoments_; | nRealizableMoments_ = nMoments_; |
610 | calcNInvertibleMoments(); | ||
611 | 523 | fullyRealizable_ = true; | fullyRealizable_ = true; |
612 | 524 | subsetRealizable_ = true; | subsetRealizable_ = true; |
613 | 525 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
617 | 529 | } | } |
618 | 530 | else | else |
619 | 531 | { | { |
620 | zeta[2*nD - 1] = beta_[nD]/zeta[2*nD - 2]; | ||
532 | zeta_[2*nD - 1] = beta_[nD]/zeta_[2*nD - 2]; | ||
621 | 533 | ||
622 | if (zeta[2*nD - 1] <= 0.0) | ||
534 | if (zeta_[2*nD - 1] <= 0.0) | ||
623 | 535 | { | { |
624 | 536 | if (support_ == "RPlus") | if (support_ == "RPlus") |
625 | 537 | { | { |
626 | if (zeta[2*nD - 1] < 0.0) | ||
538 | if (zeta_[2*nD - 1] < 0.0) | ||
627 | 539 | { | { |
628 | 540 | negativeZeta_ = 2*nD; | negativeZeta_ = 2*nD; |
629 | 541 | nRealizableMoments_ = negativeZeta_; | nRealizableMoments_ = negativeZeta_; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
638 | 550 | } | } |
639 | 551 | else // Support on [0,1] | else // Support on [0,1] |
640 | 552 | { | { |
641 | checkCanonicalMoments(zeta, 2*nD); | ||
553 | checkCanonicalMoments(zeta_, 2*nD); | ||
642 | 554 | } | } |
643 | 555 | ||
644 | calcNInvertibleMoments(); | ||
645 | 556 | fullyRealizable_ = false; | fullyRealizable_ = false; |
646 | 557 | subsetRealizable_ = true; | subsetRealizable_ = true; |
647 | 558 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
654 | 565 | alpha_[nD] = zRecurrence[nD][nD + 1]/zRecurrence[nD][nD] | alpha_[nD] = zRecurrence[nD][nD + 1]/zRecurrence[nD][nD] |
655 | 566 | - zRecurrence[nD - 1][nD]/zRecurrence[nD - 1][nD - 1]; | - zRecurrence[nD - 1][nD]/zRecurrence[nD - 1][nD - 1]; |
656 | 567 | ||
657 | zeta[2*nD] = alpha_[nD] - zeta[2*nD - 1]; | ||
568 | zeta_[2*nD] = alpha_[nD] - zeta_[2*nD - 1]; | ||
658 | 569 | ||
659 | if (zeta[2*nD] <= 0.0) | ||
570 | if (zeta_[2*nD] <= 0.0) | ||
660 | 571 | { | { |
661 | 572 | if (support_ == "RPlus") | if (support_ == "RPlus") |
662 | 573 | { | { |
663 | if (zeta[2*nD] < 0.0) | ||
574 | if (zeta_[2*nD] < 0.0) | ||
664 | 575 | { | { |
665 | 576 | negativeZeta_ = 2*nD + 1; | negativeZeta_ = 2*nD + 1; |
666 | 577 | nRealizableMoments_ = negativeZeta_; | nRealizableMoments_ = negativeZeta_; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
669 | 580 | } | } |
670 | 581 | else | else |
671 | 582 | { | { |
672 | negativeZeta_ = 0; | ||
583 | negativeZeta_ = nN; | ||
673 | 584 | nRealizableMoments_ = nMoments_; | nRealizableMoments_ = nMoments_; |
674 | 585 | fullyRealizable_ = true; | fullyRealizable_ = true; |
675 | 586 | onMomentSpaceBoundary_ = true; | onMomentSpaceBoundary_ = true; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
677 | 588 | } | } |
678 | 589 | else // Support on [0,1] | else // Support on [0,1] |
679 | 590 | { | { |
680 | checkCanonicalMoments(zeta, 2*nD + 1); | ||
591 | checkCanonicalMoments(zeta_, 2*nD + 1); | ||
681 | 592 | ||
682 | 593 | if (onMomentSpaceBoundary_) | if (onMomentSpaceBoundary_) |
683 | 594 | { | { |
595 | negativeZeta_ = nN; | ||
684 | 596 | fullyRealizable_ = true; | fullyRealizable_ = true; |
685 | 597 | } | } |
686 | 598 | else | else |
687 | 599 | { | { |
600 | negativeZeta_ = 2*nD + 1; | ||
688 | 601 | fullyRealizable_ = false; | fullyRealizable_ = false; |
689 | 602 | } | } |
690 | 603 | } | } |
691 | 604 | ||
692 | calcNInvertibleMoments(); | ||
693 | |||
694 | 605 | subsetRealizable_ = true; | subsetRealizable_ = true; |
695 | 606 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
696 | 607 | ||
697 | 608 | return; | return; |
698 | 609 | } | } |
699 | else // zeta[2*nD] > 0.0 | ||
610 | else // zeta_[2*nD] > 0.0 | ||
700 | 611 | { | { |
701 | 612 | if (support_ == "RPlus") | if (support_ == "RPlus") |
702 | 613 | { | { |
703 | negativeZeta_ = 0; | ||
614 | negativeZeta_ = nN; | ||
704 | 615 | nRealizableMoments_ = nMoments_; | nRealizableMoments_ = nMoments_; |
705 | 616 | fullyRealizable_ = true; | fullyRealizable_ = true; |
706 | 617 | onMomentSpaceBoundary_ = false; | onMomentSpaceBoundary_ = false; |
707 | 618 | } | } |
708 | 619 | else // Support on [0,1] | else // Support on [0,1] |
709 | 620 | { | { |
710 | checkCanonicalMoments(zeta, 2*nD + 1); | ||
621 | checkCanonicalMoments(zeta_, 2*nD + 1); | ||
711 | 622 | ||
712 | 623 | if (onMomentSpaceBoundary_) | if (onMomentSpaceBoundary_) |
713 | 624 | { | { |
625 | negativeZeta_ = nN; | ||
714 | 626 | fullyRealizable_ = true; | fullyRealizable_ = true; |
715 | 627 | } | } |
716 | 628 | else | else |
717 | 629 | { | { |
630 | negativeZeta_ = 2*nD + 1; | ||
718 | 631 | fullyRealizable_ = false; | fullyRealizable_ = false; |
719 | 632 | } | } |
720 | 633 | } | } |
721 | 634 | ||
722 | calcNInvertibleMoments(); | ||
723 | |||
724 | 635 | subsetRealizable_ = true; | subsetRealizable_ = true; |
725 | 636 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
726 | 637 | ||
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
733 | 644 | // of moments is realizable | // of moments is realizable |
734 | 645 | if (support_ == "RPlus") | if (support_ == "RPlus") |
735 | 646 | { | { |
647 | negativeZeta_ = nN; | ||
736 | 648 | fullyRealizable_ = true; | fullyRealizable_ = true; |
737 | 649 | subsetRealizable_ = true; | subsetRealizable_ = true; |
738 | 650 | nRealizableMoments_ = nMoments_; | nRealizableMoments_ = nMoments_; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
740 | 652 | } | } |
741 | 653 | else | else |
742 | 654 | { | { |
743 | checkCanonicalMoments(zeta, nN); | ||
655 | checkCanonicalMoments(zeta_, nN); | ||
744 | 656 | ||
745 | 657 | if (nRealizableMoments_ == nMoments_) | if (nRealizableMoments_ == nMoments_) |
746 | 658 | { | { |
659 | negativeZeta_ = nN; | ||
747 | 660 | fullyRealizable_ = true; | fullyRealizable_ = true; |
748 | 661 | subsetRealizable_ = true; | subsetRealizable_ = true; |
749 | 662 | } | } |
750 | 663 | else | else |
751 | 664 | { | { |
665 | negativeZeta_ = nN; | ||
752 | 666 | fullyRealizable_ = false; | fullyRealizable_ = false; |
753 | 667 | subsetRealizable_ = true; | subsetRealizable_ = true; |
754 | 668 | } | } |
755 | 669 | } | } |
756 | 670 | ||
757 | calcNInvertibleMoments(); | ||
758 | 671 | realizabilityChecked_ = true; | realizabilityChecked_ = true; |
759 | 672 | ||
760 | 673 | return; | return; |
... | ... | void Foam::univariateMomentSet::checkRealizability() | |
762 | 675 | } | } |
763 | 676 | } | } |
764 | 677 | ||
765 | void Foam::univariateMomentSet::calcNInvertibleMoments() | ||
766 | { | ||
767 | if (quadratureType_ == "Gauss") | ||
768 | { | ||
769 | if (nRealizableMoments_ % 2 != 0) | ||
770 | { | ||
771 | nInvertibleMoments_ = nRealizableMoments_ - 1; | ||
772 | } | ||
773 | else | ||
774 | { | ||
775 | nInvertibleMoments_ = nRealizableMoments_; | ||
776 | } | ||
777 | |||
778 | return; | ||
779 | } | ||
780 | else | ||
781 | { | ||
782 | forceGauss_ = false; | ||
783 | nInvertibleMoments_ = nRealizableMoments_; | ||
784 | |||
785 | if (nRealizableMoments_ % 2 == 0) | ||
786 | { | ||
787 | forceGauss_ = true; | ||
788 | } | ||
789 | } | ||
790 | } | ||
791 | |||
792 | void Foam::univariateMomentSet::setupQuadrature | ||
678 | Foam::labelListList Foam::univariateMomentSet::makeUnivariateMomentOrders | ||
793 | 679 | ( | ( |
794 | bool clear, | ||
795 | bool nullMomentSet | ||
680 | const label nMoments | ||
796 | 681 | ) | ) |
797 | 682 | { | { |
798 | if (!realizabilityChecked_) | ||
799 | { | ||
800 | checkRealizability(); | ||
801 | } | ||
683 | labelListList mOrd(nMoments); | ||
802 | 684 | ||
803 | if (degenerate_) | ||
685 | for (label mI = 0; mI < nMoments; mI++) | ||
804 | 686 | { | { |
805 | nNodes_ = 1; | ||
806 | } | ||
807 | else | ||
808 | { | ||
809 | nNodes_ = nInvertibleMoments_/2; | ||
810 | |||
811 | if (quadratureType_ == "GaussRadau" && !forceGauss_) | ||
812 | { | ||
813 | nNodes_ += 1; | ||
814 | } | ||
687 | mOrd[mI] = labelList(1, mI); | ||
815 | 688 | } | } |
816 | 689 | ||
817 | if (clear) | ||
818 | { | ||
819 | weights_.clear(); | ||
820 | abscissae_.clear(); | ||
821 | } | ||
822 | |||
823 | weights_.resize(nNodes_, 0.0); | ||
824 | abscissae_.resize(nNodes_, 0.0); | ||
690 | return mOrd; | ||
825 | 691 | } | } |
826 | 692 | ||
827 | void Foam::univariateMomentSet::update() | ||
693 | void Foam::univariateMomentSet::update | ||
694 | ( | ||
695 | const scalarList& weights, | ||
696 | const scalarList& abscissae | ||
697 | ) | ||
828 | 698 | { | { |
829 | 699 | // Recomputing all the moments (even if they originally were not realizable) | // Recomputing all the moments (even if they originally were not realizable) |
830 | 700 | // from quadrature (projection step). | // from quadrature (projection step). |
... | ... | void Foam::univariateMomentSet::update() | |
832 | 702 | { | { |
833 | 703 | (*this)[momenti] = 0.0; | (*this)[momenti] = 0.0; |
834 | 704 | ||
835 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
705 | for (label nodei = 0; nodei < weights.size(); nodei++) | ||
836 | 706 | { | { |
837 | (*this)[momenti] += weights_[nodei]*Foam::pow(abscissae_[nodei], momenti); | ||
707 | (*this)[momenti] += weights[nodei]*pow(abscissae[nodei], momenti); | ||
838 | 708 | } | } |
839 | 709 | } | } |
840 | 710 | ||
841 | 711 | realizabilityChecked_ = false; | realizabilityChecked_ = false; |
842 | inverted_ = false; | ||
843 | 712 | } | } |
844 | 713 | ||
845 | 714 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/univariateMomentSet/univariateMomentSet.H added (mode: 100644) (index 0000000..9fcc684) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | Class | ||
25 | Foam::univariateMomentSet | ||
26 | |||
27 | Description | ||
28 | Stores a generic moment set with the corresponding list of orders. | ||
29 | |||
30 | SourceFiles | ||
31 | univariateMomentSet.C | ||
32 | univariateMomentSet.H | ||
33 | |||
34 | \*---------------------------------------------------------------------------*/ | ||
35 | |||
36 | #ifndef univariateMomentSet_H | ||
37 | #define univariateMomentSet_H | ||
38 | |||
39 | #include "momentSet.H" | ||
40 | #include "scalarMatrices.H" | ||
41 | |||
42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
43 | |||
44 | namespace Foam | ||
45 | { | ||
46 | |||
47 | /*---------------------------------------------------------------------------*\ | ||
48 | Class univariateMomentSet Declaration | ||
49 | \*---------------------------------------------------------------------------*/ | ||
50 | |||
51 | class univariateMomentSet | ||
52 | : | ||
53 | public momentSet | ||
54 | { | ||
55 | // Private data | ||
56 | |||
57 | //- Alpha coefficients of the recurrence relation | ||
58 | scalarList alpha_; | ||
59 | |||
60 | //- Beta coefficients of the recurrence relation | ||
61 | scalarList beta_; | ||
62 | |||
63 | //- Zeta values to check moment realizability | ||
64 | scalarList zeta_; | ||
65 | |||
66 | //- Position of first negative zeta | ||
67 | label negativeZeta_; | ||
68 | |||
69 | //- Bool to indicate if moment set is degenerate, with only the | ||
70 | // zero-order moment realizable | ||
71 | bool degenerate_; | ||
72 | |||
73 | //- Bool to indicate if the full moment set is realizable | ||
74 | bool fullyRealizable_; | ||
75 | |||
76 | //- Bool to indicate if a subset of the full moment set is realizable | ||
77 | bool subsetRealizable_; | ||
78 | |||
79 | //- Bool to indicate if the moment set is on the boundary of the | ||
80 | // moment space | ||
81 | bool onMomentSpaceBoundary_; | ||
82 | |||
83 | //- Number of realizable moments | ||
84 | label nRealizableMoments_; | ||
85 | |||
86 | |||
87 | // Private member functions | ||
88 | |||
89 | //- Check moment realizability | ||
90 | void checkRealizability | ||
91 | ( | ||
92 | bool fatalErrorOnFailedRealizabilityTest = true | ||
93 | ); | ||
94 | |||
95 | //- Checks canonical moments for measures with support over [0,1] | ||
96 | void checkCanonicalMoments | ||
97 | ( | ||
98 | const scalarList& zeta, | ||
99 | const label nZeta | ||
100 | ); | ||
101 | |||
102 | |||
103 | protected: | ||
104 | |||
105 | // Protected data | ||
106 | |||
107 | //- Bool to indicate moment realizability was checked | ||
108 | bool realizabilityChecked_; | ||
109 | |||
110 | |||
111 | public: | ||
112 | |||
113 | // Constructors | ||
114 | |||
115 | //- Construct from number of moments and initial value | ||
116 | univariateMomentSet | ||
117 | ( | ||
118 | const label nMoments, | ||
119 | const word& support, | ||
120 | const scalar initValue = 0, | ||
121 | const label nFixedQuadraturePoints = 0 | ||
122 | ); | ||
123 | |||
124 | //- Construct from scalarList | ||
125 | univariateMomentSet | ||
126 | ( | ||
127 | const scalarList& m, | ||
128 | const word& support, | ||
129 | const label nFixedQuadraturePoints = 0 | ||
130 | ); | ||
131 | |||
132 | //- Destructor | ||
133 | virtual ~univariateMomentSet(); | ||
134 | |||
135 | |||
136 | // Member Functions | ||
137 | |||
138 | //- Returns alpha coefficients of the recurrence relation | ||
139 | inline const scalarList& alphaRecurrence() const; | ||
140 | |||
141 | //- Returns alpha coefficients of the recurrence relation | ||
142 | inline scalarList& alphaRecurrence(); | ||
143 | |||
144 | //- Returns beta coefficients of the recurrence relation | ||
145 | inline const scalarList& betaRecurrence() const; | ||
146 | |||
147 | //- Returns beta coefficients of the recurrence relation | ||
148 | inline scalarList& betaRecurrence(); | ||
149 | |||
150 | //- Returns zeta_k values for the moment set | ||
151 | inline scalarList& zetas(); | ||
152 | |||
153 | //- Returns degenerate status of the moment set | ||
154 | inline bool isDegenerate(); | ||
155 | |||
156 | //- Return true if the entire moment set is realizable | ||
157 | inline bool isFullyRealizable | ||
158 | ( | ||
159 | bool fatalErrorOnFailedRealizabilityTest = true | ||
160 | ); | ||
161 | |||
162 | //- Return true if some moments are realizable | ||
163 | inline bool isRealizable | ||
164 | ( | ||
165 | bool fatalErrorOnFailedRealizabilityTest = true | ||
166 | ); | ||
167 | |||
168 | //- Return true if a subset of moments is realizable | ||
169 | inline bool isSubsetRealizable | ||
170 | ( | ||
171 | bool fatalErrorOnFailedRealizabilityTest = true | ||
172 | ); | ||
173 | |||
174 | //- Return true if the moment set is on the boundary of the moment space | ||
175 | inline bool isOnMomentSpaceBoundary | ||
176 | ( | ||
177 | bool fatalErrorOnFailedRealizabilityTest = true | ||
178 | ); | ||
179 | |||
180 | inline labelListList makeUnivariateMomentOrders | ||
181 | ( | ||
182 | const label nMoments | ||
183 | ); | ||
184 | |||
185 | //- Return the number of realizable moments | ||
186 | inline label nRealizableMoments | ||
187 | ( | ||
188 | bool fatalErrorOnFailedRealizabilityTest = true | ||
189 | ); | ||
190 | |||
191 | inline label negativeZeta(); | ||
192 | |||
193 | //- Update moments from the corresponding quadrature | ||
194 | virtual void update | ||
195 | ( | ||
196 | const scalarList& weights, | ||
197 | const scalarList& abscissae | ||
198 | ); | ||
199 | |||
200 | //- Const access to element | ||
201 | inline const scalar& operator[](const label index) const; | ||
202 | |||
203 | //- Non-const access to element, reinitializing realizaibility check | ||
204 | inline scalar& operator[](const label index); | ||
205 | |||
206 | //- Const access to the moment of order momentOrder | ||
207 | inline const scalar& operator()(const label momentOrder) const; | ||
208 | |||
209 | //- Non-const access to the moment of order momentOrder | ||
210 | inline scalar& operator()(const label momentOrder); | ||
211 | }; | ||
212 | |||
213 | |||
214 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
215 | |||
216 | } // End namespace Foam | ||
217 | |||
218 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
219 | |||
220 | #include "univariateMomentSetI.H" | ||
221 | |||
222 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
223 | |||
224 | #endif | ||
225 | |||
226 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/momentSets/univariateMomentSet/univariateMomentSetI.H added (mode: 100644) (index 0000000..61e4def) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
27 | |||
28 | const Foam::scalarList& | ||
29 | Foam::univariateMomentSet::alphaRecurrence() const | ||
30 | { | ||
31 | return alpha_; | ||
32 | } | ||
33 | |||
34 | Foam::scalarList& Foam::univariateMomentSet::alphaRecurrence() | ||
35 | { | ||
36 | return alpha_; | ||
37 | } | ||
38 | |||
39 | const Foam::scalarList& Foam::univariateMomentSet::betaRecurrence() const | ||
40 | { | ||
41 | return beta_; | ||
42 | } | ||
43 | |||
44 | Foam::scalarList& Foam::univariateMomentSet::betaRecurrence() | ||
45 | { | ||
46 | return beta_; | ||
47 | } | ||
48 | |||
49 | Foam::label Foam::univariateMomentSet::negativeZeta() | ||
50 | { | ||
51 | return negativeZeta_; | ||
52 | } | ||
53 | |||
54 | Foam::scalarList& Foam::univariateMomentSet::zetas() | ||
55 | { | ||
56 | if (!realizabilityChecked_) | ||
57 | { | ||
58 | checkRealizability(false); | ||
59 | } | ||
60 | |||
61 | return zeta_; | ||
62 | } | ||
63 | |||
64 | bool Foam::univariateMomentSet::isDegenerate() | ||
65 | { | ||
66 | // Checking if moments of order higher than zero are null | ||
67 | // The case when m0 = 0 is already managed | ||
68 | for (Foam::label momentI = 1; momentI < (*this).size(); momentI++) | ||
69 | { | ||
70 | if (mag((*this)[momentI]) > SMALL) | ||
71 | { | ||
72 | degenerate_ = false; | ||
73 | |||
74 | return degenerate_; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | degenerate_ = true; | ||
79 | |||
80 | return degenerate_; | ||
81 | } | ||
82 | |||
83 | bool Foam::univariateMomentSet::isFullyRealizable | ||
84 | ( | ||
85 | bool fatalErrorOnFailedRealizabilityTest | ||
86 | ) | ||
87 | { | ||
88 | if (!realizabilityChecked_) | ||
89 | { | ||
90 | checkRealizability(fatalErrorOnFailedRealizabilityTest); | ||
91 | } | ||
92 | |||
93 | return fullyRealizable_; | ||
94 | } | ||
95 | |||
96 | bool Foam::univariateMomentSet::isRealizable | ||
97 | ( | ||
98 | bool fatalErrorOnFailedRealizabilityTest | ||
99 | ) | ||
100 | { | ||
101 | if (!realizabilityChecked_) | ||
102 | { | ||
103 | checkRealizability(fatalErrorOnFailedRealizabilityTest); | ||
104 | } | ||
105 | |||
106 | bool realizable = fullyRealizable_ || subsetRealizable_; | ||
107 | |||
108 | return realizable; | ||
109 | } | ||
110 | |||
111 | bool Foam::univariateMomentSet::isSubsetRealizable | ||
112 | ( | ||
113 | bool fatalErrorOnFailedRealizabilityTest | ||
114 | ) | ||
115 | { | ||
116 | if (!realizabilityChecked_) | ||
117 | { | ||
118 | checkRealizability(fatalErrorOnFailedRealizabilityTest); | ||
119 | } | ||
120 | |||
121 | return subsetRealizable_; | ||
122 | } | ||
123 | |||
124 | bool Foam::univariateMomentSet::isOnMomentSpaceBoundary | ||
125 | ( | ||
126 | bool fatalErrorOnFailedRealizabilityTest | ||
127 | ) | ||
128 | { | ||
129 | if (!realizabilityChecked_) | ||
130 | { | ||
131 | checkRealizability(fatalErrorOnFailedRealizabilityTest); | ||
132 | } | ||
133 | |||
134 | return onMomentSpaceBoundary_; | ||
135 | } | ||
136 | |||
137 | Foam::label Foam::univariateMomentSet::nRealizableMoments | ||
138 | ( | ||
139 | bool fatalErrorOnFailedRealizabilityTest | ||
140 | ) | ||
141 | { | ||
142 | if (!realizabilityChecked_) | ||
143 | { | ||
144 | checkRealizability(fatalErrorOnFailedRealizabilityTest); | ||
145 | } | ||
146 | |||
147 | return nRealizableMoments_; | ||
148 | } | ||
149 | |||
150 | Foam::scalar& Foam::univariateMomentSet::operator[](const label index) | ||
151 | { | ||
152 | degenerate_ = false; | ||
153 | fullyRealizable_ = true; | ||
154 | subsetRealizable_ = true; | ||
155 | onMomentSpaceBoundary_ = false; | ||
156 | realizabilityChecked_ = false; | ||
157 | |||
158 | return scalarList::operator[](index); | ||
159 | } | ||
160 | |||
161 | const Foam::scalar& | ||
162 | Foam::univariateMomentSet::operator[](const label index) const | ||
163 | { | ||
164 | return scalarList::operator[](index); | ||
165 | } | ||
166 | |||
167 | const Foam::scalar& | ||
168 | Foam::univariateMomentSet::operator()(const label momentOrder) const | ||
169 | { | ||
170 | return operator[](momentOrder); | ||
171 | } | ||
172 | |||
173 | Foam::scalar& Foam::univariateMomentSet::operator()(label momentOrder) | ||
174 | { | ||
175 | return operator[](momentOrder); | ||
176 | } | ||
177 | |||
178 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moment.C changed (mode: 100755) (index 71d3686..1e33c7c) | |||
14 | 14 | standard and extended nodes. | standard and extended nodes. |
15 | 15 | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to |
16 | 16 | improve initialization of nodes. | improve initialization of nodes. |
17 | 2017-03-26 Alberto Passalacqua: Added the capability to recompute the moment | ||
18 | locally. | ||
17 | 19 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
18 | 20 | License | License |
19 | 21 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | Foam::moment<fieldType, nodeType>::listToLabel(const labelList& lst) | |
59 | 61 | ||
60 | 62 | forAll(lst, dimi) | forAll(lst, dimi) |
61 | 63 | { | { |
62 | l += lst[dimi]*Foam::pow(10, lst.size() - dimi - 1.0); | ||
64 | l += lst[dimi]*pow(10, lst.size() - dimi - 1); | ||
63 | 65 | } | } |
64 | 66 | ||
65 | 67 | return l; | return l; |
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
141 | 143 | ||
142 | 144 | const PtrList<nodeType>& nodes = nodes_(); | const PtrList<nodeType>& nodes = nodes_(); |
143 | 145 | ||
144 | bool extendedNode = nodes[0].extended(); | ||
145 | |||
146 | // If nodes do not have extended status, only use primary quadrature. | ||
147 | if (!extendedNode) | ||
146 | // If nodes are not of extended type, only use primary quadrature. | ||
147 | if (!nodes[0].extended()) | ||
148 | 148 | { | { |
149 | 149 | forAll(nodes, pNodei) | forAll(nodes, pNodei) |
150 | 150 | { | { |
151 | 151 | const nodeType& node = nodes[pNodei]; | const nodeType& node = nodes[pNodei]; |
152 | fieldType m = node.primaryWeight(); | ||
152 | 153 | ||
153 | if (!node.extended()) | ||
154 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
154 | 155 | { | { |
155 | fieldType m = node.primaryWeight(); | ||
156 | |||
157 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
158 | { | ||
159 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
160 | |||
161 | tmp<fieldType> abscissaCmpt | ||
162 | = node.primaryAbscissa().component(cmpt); | ||
156 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
163 | 157 | ||
164 | tmp<fieldType> mPow = m*Foam::pow(abscissaCmpt, cmptMomentOrder); | ||
165 | m.dimensions().reset(mPow().dimensions()); | ||
158 | tmp<fieldType> abscissaCmpt | ||
159 | = node.primaryAbscissa().component(cmpt); | ||
166 | 160 | ||
167 | m == mPow; | ||
168 | } | ||
161 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
162 | m.dimensions().reset(mPow().dimensions()); | ||
169 | 163 | ||
170 | *this == *this + m; | ||
164 | m == mPow; | ||
171 | 165 | } | } |
166 | |||
167 | *this == *this + m; | ||
172 | 168 | } | } |
173 | 169 | ||
174 | 170 | return; | return; |
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
178 | 174 | forAll(nodes, pNodei) | forAll(nodes, pNodei) |
179 | 175 | { | { |
180 | 176 | const nodeType& node = nodes[pNodei]; | const nodeType& node = nodes[pNodei]; |
181 | |||
182 | 177 | const fieldType& pW = node.primaryWeight(); | const fieldType& pW = node.primaryWeight(); |
183 | 178 | ||
184 | 179 | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) |
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
192 | 187 | tmp<fieldType> abscissaCmpt | tmp<fieldType> abscissaCmpt |
193 | 188 | = node.secondaryAbscissae()[sNodei].component(cmpt); | = node.secondaryAbscissae()[sNodei].component(cmpt); |
194 | 189 | ||
195 | tmp<fieldType> mPow = m*Foam::pow(abscissaCmpt, cmptMomentOrder); | ||
196 | |||
190 | tmp<fieldType> mPow = m*pow(abscissaCmpt, cmptMomentOrder); | ||
197 | 191 | m.dimensions().reset(mPow().dimensions()); | m.dimensions().reset(mPow().dimensions()); |
198 | |||
199 | 192 | m == mPow; | m == mPow; |
200 | 193 | } | } |
201 | 194 | ||
... | ... | void Foam::moment<fieldType, nodeType>::update() | |
204 | 197 | } | } |
205 | 198 | } | } |
206 | 199 | ||
200 | template <class fieldType, class nodeType> | ||
201 | void Foam::moment<fieldType, nodeType>::updateLocalMoment(label elemi) | ||
202 | { | ||
203 | // Resetting the moment to zero | ||
204 | scalar moment = 0; | ||
205 | |||
206 | const PtrList<nodeType>& nodes = nodes_(); | ||
207 | |||
208 | // If nodes are not of extended type, only use primary quadrature. | ||
209 | if (!nodes[0].extended()) | ||
210 | { | ||
211 | forAll(nodes, pNodei) | ||
212 | { | ||
213 | const nodeType& node = nodes[pNodei]; | ||
214 | scalar m = node.primaryWeight()[elemi]; | ||
215 | |||
216 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
217 | { | ||
218 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
219 | |||
220 | const scalar abscissaCmpt | ||
221 | = node.primaryAbscissa().component(cmpt)()[elemi]; | ||
222 | |||
223 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
224 | } | ||
225 | |||
226 | moment += m; | ||
227 | } | ||
228 | |||
229 | (*this)[elemi] = moment; | ||
230 | |||
231 | return; | ||
232 | } | ||
233 | |||
234 | // Extended quadrature case | ||
235 | forAll(nodes, pNodei) | ||
236 | { | ||
237 | const nodeType& node = nodes[pNodei]; | ||
238 | const scalar pW = node.primaryWeight()[elemi]; | ||
239 | |||
240 | for (label sNodei = 0; sNodei < node.nSecondaryNodes(); sNodei++) | ||
241 | { | ||
242 | scalar m = pW*node.secondaryWeights()[sNodei][elemi]; | ||
243 | |||
244 | for (label cmpt = 0; cmpt < nDimensions_; cmpt++) | ||
245 | { | ||
246 | const label cmptMomentOrder = cmptOrders()[cmpt]; | ||
247 | |||
248 | const scalar abscissaCmpt | ||
249 | = node.secondaryAbscissae()[sNodei].component(cmpt)()[elemi]; | ||
250 | |||
251 | m *= pow(abscissaCmpt, cmptMomentOrder); | ||
252 | } | ||
253 | |||
254 | moment += m; | ||
255 | } | ||
256 | } | ||
257 | |||
258 | (*this)[elemi] = moment; | ||
259 | } | ||
207 | 260 | ||
208 | 261 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moment.H changed (mode: 100755) (index 0f7bb1b..23b4a9c) | |||
14 | 14 | standard and extended nodes. | standard and extended nodes. |
15 | 15 | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to |
16 | 16 | improve initialization of nodes. | improve initialization of nodes. |
17 | 2017-03-26 Alberto Passalacqua: Added the capability to recompute the moment | ||
18 | locally. | ||
17 | 19 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
18 | 20 | License | License |
19 | 21 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | public: | |
197 | 199 | ||
198 | 200 | //- Update the moment from the quadrature nodes | //- Update the moment from the quadrature nodes |
199 | 201 | void update(); | void update(); |
202 | |||
203 | //- Update the moment from the quadrature nodes in a single element | ||
204 | void updateLocalMoment(label elemi); | ||
200 | 205 | }; | }; |
201 | 206 | ||
202 | 207 |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSet.C changed (mode: 100755) (index 9bec759..f570062) | |||
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | 2015-03-10 Alberto Passalacqua: Templated class on the type of moment and of | 2015-03-10 Alberto Passalacqua: Templated class on the type of moment and of |
9 | 9 | quadrature node. | quadrature node. |
10 | 2017-03-26 Alberto Passalacqua: Added the capability to recompute moments | ||
11 | locally. | ||
10 | 12 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
11 | 13 | License | License |
12 | 14 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | Foam::momentFieldSet<momentType, nodeType>::momentFieldSet | |
36 | 38 | const word& distributionName, | const word& distributionName, |
37 | 39 | const dictionary& dict, | const dictionary& dict, |
38 | 40 | const fvMesh& mesh, | const fvMesh& mesh, |
39 | const autoPtr<PtrList<nodeType>>& nodes | ||
41 | const autoPtr<PtrList<nodeType>>& nodes, | ||
42 | const word& support | ||
40 | 43 | ) | ) |
41 | 44 | : | : |
42 | 45 | PtrList<momentType> | PtrList<momentType> |
... | ... | Foam::momentFieldSet<momentType, nodeType>::momentFieldSet | |
48 | 51 | nodes_(nodes), | nodes_(nodes), |
49 | 52 | nDimensions_((*this)[0].nDimensions()), | nDimensions_((*this)[0].nDimensions()), |
50 | 53 | nMoments_((*this).size()), | nMoments_((*this).size()), |
51 | momentMap_(nMoments_) | ||
54 | momentMap_(nMoments_), | ||
55 | support_(support) | ||
52 | 56 | { | { |
53 | // Check on the number of moments and nodes may go here. | ||
54 | // However, to keep the implementation generic, it is moved to a | ||
55 | // higher-level class where the specific quadrature method is implemented. | ||
56 | |||
57 | 57 | // Populate the moment set | // Populate the moment set |
58 | 58 | forAll(*this, mI) | forAll(*this, mI) |
59 | 59 | { | { |
... | ... | Foam::momentFieldSet<momentType, nodeType>::momentFieldSet | |
76 | 76 | const label nMoments, | const label nMoments, |
77 | 77 | const autoPtr<PtrList<nodeType>>& nodes, | const autoPtr<PtrList<nodeType>>& nodes, |
78 | 78 | const label nDimensions, | const label nDimensions, |
79 | const Map<label>& momentMap | ||
79 | const Map<label>& momentMap, | ||
80 | const word& support | ||
80 | 81 | ) | ) |
81 | 82 | : | : |
82 | 83 | PtrList<momentType>(nMoments), | PtrList<momentType>(nMoments), |
... | ... | Foam::momentFieldSet<momentType, nodeType>::momentFieldSet | |
84 | 85 | nodes_(nodes), | nodes_(nodes), |
85 | 86 | nDimensions_(nDimensions), | nDimensions_(nDimensions), |
86 | 87 | nMoments_(nMoments), | nMoments_(nMoments), |
87 | momentMap_(momentMap) | ||
88 | momentMap_(momentMap), | ||
89 | support_(support) | ||
88 | 90 | {} | {} |
89 | 91 | ||
90 | 92 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
... | ... | void Foam::momentFieldSet<momentType, nodeType>::update() | |
105 | 107 | } | } |
106 | 108 | } | } |
107 | 109 | ||
110 | template <class momentType, class nodeType> | ||
111 | void Foam::momentFieldSet<momentType, nodeType> | ||
112 | ::updateLocalMoments(label elemi) | ||
113 | { | ||
114 | forAll(*this, mI) | ||
115 | { | ||
116 | this->operator[](mI).updateLocalMoment(elemi); | ||
117 | } | ||
118 | } | ||
108 | 119 | ||
109 | 120 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSet.H changed (mode: 100755) (index ac1a37d..5e8e567) | |||
9 | 9 | quadrature node. | quadrature node. |
10 | 10 | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to | 2015-06-13 Alberto Passalacqua: Introduced autoPtr to the PtrList of nodes to |
11 | 11 | improve initialization of nodes. | improve initialization of nodes. |
12 | 2017-03-26 Alberto Passalacqua: Added the capability to recompute moments | ||
13 | locally. | ||
12 | 14 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
13 | 15 | License | License |
14 | 16 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | class momentFieldSet | |
90 | 92 | // within the List of moments | // within the List of moments |
91 | 93 | Map<label> momentMap_; | Map<label> momentMap_; |
92 | 94 | ||
95 | //- Support of the measure associated to the moment moment set | ||
96 | word support_; | ||
97 | |||
93 | 98 | ||
94 | 99 | // Private Member Functions | // Private Member Functions |
95 | 100 | ||
... | ... | public: | |
117 | 122 | const word& distributionName, | const word& distributionName, |
118 | 123 | const dictionary& dict, | const dictionary& dict, |
119 | 124 | const fvMesh& mesh, | const fvMesh& mesh, |
120 | const autoPtr<PtrList<nodeType>>& nodes | ||
125 | const autoPtr<PtrList<nodeType>>& nodes, | ||
126 | const word& support | ||
121 | 127 | ); | ); |
122 | 128 | ||
123 | 129 | //- Construct from size, quadrature nodes, dimensions and moment map | //- Construct from size, quadrature nodes, dimensions and moment map |
... | ... | public: | |
129 | 135 | const label nMoments, | const label nMoments, |
130 | 136 | const autoPtr<PtrList<nodeType>>& nodes, | const autoPtr<PtrList<nodeType>>& nodes, |
131 | 137 | const label nDimensions, | const label nDimensions, |
132 | const Map<label>& momentMap | ||
138 | const Map<label>& momentMap, | ||
139 | const word& support | ||
133 | 140 | ); | ); |
134 | 141 | ||
135 | 142 | ||
... | ... | public: | |
176 | 183 | //- Return the dimensionality of the distribution | //- Return the dimensionality of the distribution |
177 | 184 | inline label nDimensions() const; | inline label nDimensions() const; |
178 | 185 | ||
186 | //- Return support of the measure associated to the moment set | ||
187 | inline const word support() const; | ||
188 | |||
179 | 189 | //- Recalculate the moments from the quadrature nodes | //- Recalculate the moments from the quadrature nodes |
180 | 190 | void update(); | void update(); |
181 | 191 | ||
192 | //- Recalculate the moments from the quadrature nodes in an element | ||
193 | void updateLocalMoments(label elemi); | ||
194 | |||
182 | 195 | //- Return the map label of a moment | //- Return the map label of a moment |
183 | 196 | label map(label a, label b, label c) const | label map(label a, label b, label c) const |
184 | 197 | { | { |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSetI.H changed (mode: 100755) (index d24fa7e..a4a9184) | |||
... | ... | License | |
27 | 27 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
28 | 28 | ||
29 | 29 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
30 | // template <class momentType, class nodeType> | ||
31 | // Foam::label | ||
32 | // Foam::momentFieldSet<momentType, nodeType>::dimToCmptOrder(label dim) const | ||
33 | // { | ||
34 | // dim = nDimensions_ - dim - 1; | ||
35 | // | ||
36 | // return pow(10, dim); | ||
37 | // } | ||
38 | 30 | ||
39 | 31 | template <class momentType, class nodeType> | template <class momentType, class nodeType> |
40 | 32 | momentType& Foam::momentFieldSet<momentType, nodeType>::operator()() | momentType& Foam::momentFieldSet<momentType, nodeType>::operator()() |
... | ... | Foam::label Foam::momentFieldSet<momentType, nodeType>::nDimensions() const | |
118 | 110 | return nDimensions_; | return nDimensions_; |
119 | 111 | } | } |
120 | 112 | ||
113 | template <class momentType, class nodeType> | ||
114 | const Foam::word Foam::momentFieldSet<momentType, nodeType>::support() const | ||
115 | { | ||
116 | return support_; | ||
117 | } | ||
121 | 118 | ||
122 | 119 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentFieldSets.H changed (mode: 100644) (index 6227b32..28d922e) | |||
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-2017 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, extendedVolScalarNode> | ||
46 | typedef momentFieldSet<volUnivariateMoment, volScalarNode> | ||
47 | 47 | volUnivariateMomentFieldSet; | volUnivariateMomentFieldSet; |
48 | 48 | ||
49 | typedef momentFieldSet<surfaceUnivariateMoment, extendedSurfaceScalarNode> | ||
49 | typedef momentFieldSet<surfaceUnivariateMoment, surfaceScalarNode> | ||
50 | 50 | surfaceUnivariateMomentFieldSet; | surfaceUnivariateMomentFieldSet; |
51 | 51 | ||
52 | typedef momentFieldSet<basicVolUnivariateMoment, basicVolScalarNode> | ||
53 | basicVolUnivariateMomentFieldSet; | ||
54 | |||
55 | typedef momentFieldSet<basicSurfaceUnivariateMoment, basicSurfaceScalarNode> | ||
56 | basicSurfaceUnivariateMomentFieldSet; | ||
57 | |||
58 | 52 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
59 | 53 | ||
60 | 54 | } // End namespace Foam | } // End namespace Foam |
File multiphaseEulerPbeFoam/quadratureMethods/moments/momentI.H changed (mode: 100755) (index f7da5c9..1af8664) | |||
8 | 8 | 2015-03-09 Alberto Passalacqua: Templated class on the type of field used to | 2015-03-09 Alberto Passalacqua: Templated class on the type of field used to |
9 | 9 | store the moment and on the type of quadrature | store the moment and on the type of quadrature |
10 | 10 | node. | node. |
11 | 2017-03-26 Alberto Passalacqua: Added the capability to recompute the moment | ||
12 | locally. | ||
11 | 13 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
12 | 14 | License | License |
13 | 15 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | License | |
29 | 31 | ||
30 | 32 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
31 | 33 | ||
32 | template <class fieldType, class nodeType> | ||
34 | template <class fieldType, class nodeType> | ||
33 | 35 | const Foam::word& Foam::moment<fieldType, nodeType>::name() const | const Foam::word& Foam::moment<fieldType, nodeType>::name() const |
34 | 36 | { | { |
35 | 37 | return name_; | return name_; |
36 | 38 | } | } |
37 | 39 | ||
38 | template <class fieldType, class nodeType> | ||
40 | template <class fieldType, class nodeType> | ||
39 | 41 | const Foam::word& Foam::moment<fieldType, nodeType>::keyword() const | const Foam::word& Foam::moment<fieldType, nodeType>::keyword() const |
40 | 42 | { | { |
41 | 43 | return name(); | return name(); |
42 | 44 | } | } |
43 | 45 | ||
44 | template <class fieldType, class nodeType> | ||
46 | template <class fieldType, class nodeType> | ||
45 | 47 | Foam::label Foam::moment<fieldType, nodeType>::nDimensions() const | Foam::label Foam::moment<fieldType, nodeType>::nDimensions() const |
46 | 48 | { | { |
47 | 49 | return nDimensions_; | return nDimensions_; |
48 | 50 | } | } |
49 | 51 | ||
50 | template <class fieldType, class nodeType> | ||
52 | template <class fieldType, class nodeType> | ||
51 | 53 | Foam::label Foam::moment<fieldType, nodeType>::order() const | Foam::label Foam::moment<fieldType, nodeType>::order() const |
52 | 54 | { | { |
53 | 55 | return order_; | return order_; |
54 | 56 | } | } |
55 | 57 | ||
56 | template <class fieldType, class nodeType> | ||
57 | const Foam::labelList& | ||
58 | template <class fieldType, class nodeType> | ||
59 | const Foam::labelList& | ||
58 | 60 | Foam::moment<fieldType, nodeType>::cmptOrders() const | Foam::moment<fieldType, nodeType>::cmptOrders() const |
59 | 61 | { | { |
60 | 62 | return cmptOrders_; | return cmptOrders_; |
File multiphaseEulerPbeFoam/quadratureMethods/moments/moments.H changed (mode: 100644) (index 46e0acc..a5848ca) | |||
... | ... | SourceFiles | |
42 | 42 | namespace Foam | namespace Foam |
43 | 43 | { | { |
44 | 44 | ||
45 | typedef moment<volScalarField, extendedVolScalarNode> volUnivariateMoment; | ||
45 | typedef moment<volScalarField, volScalarNode> volUnivariateMoment; | ||
46 | 46 | ||
47 | typedef moment<surfaceScalarField, extendedSurfaceScalarNode> | ||
48 | surfaceUnivariateMoment; | ||
49 | |||
50 | typedef moment<volScalarField, extendedVolScalarNode> basicVolUnivariateMoment; | ||
51 | |||
52 | typedef moment<surfaceScalarField, basicSurfaceScalarNode> | ||
53 | basicSurfaceUnivariateMoment; | ||
47 | typedef moment<surfaceScalarField, surfaceScalarNode> surfaceUnivariateMoment; | ||
54 | 48 | ||
55 | 49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
56 | 50 |
File multiphaseEulerPbeFoam/quadratureMethods/multivariateMomentInversion/Make/options deleted (index 7ddbb38..0000000) | |||
1 | EXE_INC = \ | ||
2 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | ||
3 | -I../univariateMomentSet/lnInclude \ | ||
4 | -I../nDimensionalMappedList \ | ||
5 | -I../../Vandermonde/lnInclude | ||
6 | |||
7 | LIB_LIBS = \ | ||
8 | -lfiniteVolume \ | ||
9 | -L$(FOAM_USER_LIBBIN) \ | ||
10 | -lmomentSet \ | ||
11 | -lvandermonde |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/Make/files changed (mode: 100644) (index 7a1ec1e..4a868d0) | |||
1 | 1 | populationBalanceModel/populationBalanceModel.C | populationBalanceModel/populationBalanceModel.C |
2 | 2 | populationBalanceModel/newPopulationBalanceModel.C | populationBalanceModel/newPopulationBalanceModel.C |
3 | 3 | ||
4 | populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.C | ||
5 | populationBalanceSubModels/daugtherDistributions/daughterDistribution/newDaughterDistribution.C | ||
6 | populationBalanceSubModels/daugtherDistributions/erosion/erosion.C | ||
7 | populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.C | ||
8 | populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.C | ||
9 | populationBalanceSubModels/daugtherDistributions/uniform/uniform.C | ||
10 | populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.C | ||
11 | |||
12 | |||
13 | 4 | populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C | populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C |
14 | 5 | populationBalanceSubModels/aggregationKernels/aggregationKernel/newAggregationKernel.C | populationBalanceSubModels/aggregationKernels/aggregationKernel/newAggregationKernel.C |
15 | 6 | populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C | populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C |
... | ... | populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynam | |
19 | 10 | populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C | populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C |
20 | 11 | populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C | populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C |
21 | 12 | ||
22 | populationBalanceSubModels/coalescenceKernels/coalescenceKernel/coalescenceKernel.C | ||
23 | populationBalanceSubModels/coalescenceKernels/coalescenceKernel/newCoalescenceKernel.C | ||
24 | populationBalanceSubModels/coalescenceKernels/buoyancyInduced/buoyancyInduced.C | ||
25 | |||
26 | 13 | populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C | populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C |
27 | 14 | populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C | populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C |
28 | 15 | populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C | populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C |
... | ... | populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup. | |
31 | 18 | populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.C | populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.C |
32 | 19 | populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.C | populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.C |
33 | 20 | ||
34 | populationBalanceSubModels/growthModels/growthModel/growthModel.C | ||
35 | populationBalanceSubModels/growthModels/growthModel/newGrowthModel.C | ||
36 | populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C | ||
21 | populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.C | ||
22 | populationBalanceSubModels/daugtherDistributions/daughterDistribution/newDaughterDistribution.C | ||
23 | populationBalanceSubModels/daugtherDistributions/erosion/erosion.C | ||
24 | populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.C | ||
25 | populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.C | ||
26 | populationBalanceSubModels/daugtherDistributions/uniform/uniform.C | ||
27 | populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.C | ||
37 | 28 | ||
38 | 29 | populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.C | populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.C |
39 | 30 | populationBalanceSubModels/diffusionModels/diffusionModel/newDiffusionModel.C | populationBalanceSubModels/diffusionModels/diffusionModel/newDiffusionModel.C |
... | ... | populationBalanceSubModels/diffusionModels/noDiffusion/noDiffusion.C | |
41 | 32 | populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C | populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.C |
42 | 33 | populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C | populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.C |
43 | 34 | ||
35 | populationBalanceSubModels/growthModels/growthModel/growthModel.C | ||
36 | populationBalanceSubModels/growthModels/growthModel/newGrowthModel.C | ||
37 | populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C | ||
38 | |||
44 | 39 | populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C | populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.C |
45 | 40 | populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C | populationBalanceSubModels/nucleationModels/nucleationModel/newNucleationModel.C |
46 | 41 | populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C | populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/Make/options changed (mode: 100644) (index 9cc1339..f3531f4) | |||
... | ... | EXE_INC = \ | |
8 | 8 | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ | -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ |
9 | 9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
10 | 10 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
11 | -I../../multiphaseDisperseSystem/lnInclude \ | ||
12 | 11 | -I../../eigenSolver/lnInclude \ | -I../../eigenSolver/lnInclude \ |
13 | -I../univariateMomentSet/lnInclude \ | ||
14 | -I../extentedMomentInversion/lnInclude \ | ||
12 | -I../../mappedList \ | ||
13 | -I../momentSets/lnInclude \ | ||
15 | 14 | -I../quadratureNode \ | -I../quadratureNode \ |
16 | 15 | -I../moments \ | -I../moments \ |
17 | -I../quadratureApproximation/lnInclude \ | ||
18 | -I../PDFTransportModels/lnInclude | ||
16 | -I../momentInversion/univariate/basic/lnInclude \ | ||
17 | -I../momentInversion/univariate/extended/lnInclude \ | ||
18 | -I../fieldMomentInversion/lnInclude \ | ||
19 | -I../quadratureApproximations/lnInclude \ | ||
20 | -I../momentAdvection/lnInclude \ | ||
21 | -I../PDFTransportModels/lnInclude | ||
19 | 22 | ||
20 | 23 | LIB_LIBS = \ | LIB_LIBS = \ |
21 | 24 | -lincompressibleTransportModels \ | -lincompressibleTransportModels \ |
... | ... | LIB_LIBS = \ | |
29 | 32 | -lmeshTools \ | -lmeshTools \ |
30 | 33 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
31 | 34 | -leigenSolver \ | -leigenSolver \ |
32 | -lmomentSet \ | ||
35 | -lmomentSets \ | ||
36 | -lmomentInversion \ | ||
33 | 37 | -lextendedMomentInversion \ | -lextendedMomentInversion \ |
38 | -lfieldMomentInversion \ | ||
34 | 39 | -lquadratureApproximation \ | -lquadratureApproximation \ |
40 | -lmomentAdvection \ | ||
35 | 41 | -lPDFTransportModel | -lPDFTransportModel |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.C changed (mode: 100644) (index 0fc493d..e548f9e) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceModels::noPopulationBalance::noPopulationBalance | |
48 | 48 | ( | ( |
49 | 49 | const word& name, | const word& name, |
50 | 50 | const dictionary& dict, | const dictionary& dict, |
51 | const volVectorField& U, | ||
52 | 51 | const surfaceScalarField& phi | const surfaceScalarField& phi |
53 | 52 | ) | ) |
54 | 53 | : | : |
55 | populationBalanceModel(name, dict, U, phi), | ||
54 | populationBalanceModel(name, dict, phi), | ||
56 | 55 | name_(name) | name_(name) |
57 | 56 | {} | {} |
58 | 57 | ||
... | ... | Foam::populationBalanceModels::noPopulationBalance::~noPopulationBalance() | |
65 | 64 | ||
66 | 65 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
67 | 66 | ||
67 | Foam::scalar | ||
68 | Foam::populationBalanceModels::noPopulationBalance::realizableCo | ||
69 | () | ||
70 | { | ||
71 | return 1.0; | ||
72 | } | ||
73 | |||
68 | 74 | void Foam::populationBalanceModels::noPopulationBalance::solve() | void Foam::populationBalanceModels::noPopulationBalance::solve() |
69 | 75 | { | { |
70 | 76 | return; | return; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/noPopulationBalance/noPopulationBalance.H changed (mode: 100644) (index c7f660c..1d5f501) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
71 | 71 | ( | ( |
72 | 72 | const word& name, | const word& name, |
73 | 73 | const dictionary& dict, | const dictionary& dict, |
74 | const volVectorField& U, | ||
75 | 74 | const surfaceScalarField& phi | const surfaceScalarField& phi |
76 | 75 | ); | ); |
77 | 76 | ||
... | ... | public: | |
81 | 80 | ||
82 | 81 | // Member Functions | // Member Functions |
83 | 82 | ||
83 | //- Return the maximum Courant number ensuring moment realizability | ||
84 | scalar realizableCo(); | ||
85 | |||
84 | 86 | //- Solve population balance equation | //- Solve population balance equation |
85 | 87 | void solve(); | void solve(); |
86 | 88 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/newPopulationBalanceModel.C changed (mode: 100644) (index e66adc1..f80efb8) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceModel::New | |
32 | 32 | ( | ( |
33 | 33 | const word& name, | const word& name, |
34 | 34 | const dictionary& dict, | const dictionary& dict, |
35 | const volVectorField& U, | ||
36 | 35 | const surfaceScalarField& phi | const surfaceScalarField& phi |
37 | 36 | ) | ) |
38 | 37 | { | { |
... | ... | Foam::populationBalanceModel::New | |
61 | 60 | ( | ( |
62 | 61 | name, | name, |
63 | 62 | dict.subDict(populationBalanceModelType + "Coeffs"), | dict.subDict(populationBalanceModelType + "Coeffs"), |
64 | U, | ||
65 | 63 | phi | phi |
66 | 64 | ) | ) |
67 | 65 | ); | ); |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/populationBalanceModel.C changed (mode: 100644) (index 52ed744..43124a9) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceModel::populationBalanceModel | |
40 | 40 | ( | ( |
41 | 41 | const word& name, | const word& name, |
42 | 42 | const dictionary& dict, | const dictionary& dict, |
43 | const volVectorField& U, | ||
44 | 43 | const surfaceScalarField& phi | const surfaceScalarField& phi |
45 | 44 | ) | ) |
46 | 45 | : | : |
... | ... | Foam::populationBalanceModel::populationBalanceModel | |
54 | 53 | Foam::populationBalanceModel::~populationBalanceModel() | Foam::populationBalanceModel::~populationBalanceModel() |
55 | 54 | {} | {} |
56 | 55 | ||
57 | |||
58 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
59 | |||
60 | |||
61 | |||
62 | 56 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceModel/populationBalanceModel.H changed (mode: 100644) (index 5b4bea9..67da931) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
87 | 87 | ( | ( |
88 | 88 | const word& name, | const word& name, |
89 | 89 | const dictionary& dict, | const dictionary& dict, |
90 | const volVectorField& U, | ||
91 | 90 | const surfaceScalarField& phi | const surfaceScalarField& phi |
92 | 91 | ), | ), |
93 | (name, dict, U, phi) | ||
92 | (name, dict, phi) | ||
94 | 93 | ); | ); |
95 | 94 | ||
96 | 95 | ||
... | ... | public: | |
101 | 100 | ( | ( |
102 | 101 | const word& name, | const word& name, |
103 | 102 | const dictionary& dict, | const dictionary& dict, |
104 | const volVectorField& U, | ||
105 | 103 | const surfaceScalarField& phi | const surfaceScalarField& phi |
106 | 104 | ); | ); |
107 | 105 | ||
... | ... | public: | |
113 | 111 | ( | ( |
114 | 112 | const word& name, | const word& name, |
115 | 113 | const dictionary& dict, | const dictionary& dict, |
116 | const volVectorField& U, | ||
117 | 114 | const surfaceScalarField& phi | const surfaceScalarField& phi |
118 | 115 | ); | ); |
119 | 116 | ||
... | ... | public: | |
124 | 121 | ||
125 | 122 | // Member Functions | // Member Functions |
126 | 123 | ||
124 | //- Return the maximum Courant number ensuring moment realizability | ||
125 | virtual scalar realizableCo() = 0; | ||
126 | |||
127 | 127 | //- Solve population balance equation | //- Solve population balance equation |
128 | 128 | virtual void solve() = 0; | virtual void solve() = 0; |
129 | 129 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.C changed (mode: 100644) (index d677437..af45164) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "Brownian.H" | #include "Brownian.H" |
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | 28 | #include "fundamentalConstants.H" | #include "fundamentalConstants.H" |
30 | 29 | ||
31 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
... | ... | namespace aggregationKernels | |
54 | 53 | Foam::populationBalanceSubModels::aggregationKernels::Brownian | Foam::populationBalanceSubModels::aggregationKernels::Brownian |
55 | 54 | ::Brownian | ::Brownian |
56 | 55 | ( | ( |
57 | const dictionary& dict | ||
56 | const dictionary& dict, | ||
57 | const fvMesh& mesh | ||
58 | 58 | ) | ) |
59 | 59 | : | : |
60 | aggregationKernel(dict) | ||
60 | aggregationKernel(dict, mesh), | ||
61 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
62 | T_(flThermo_.T()), | ||
63 | mu_(flThermo_.mu()) | ||
61 | 64 | {} | {} |
62 | 65 | ||
63 | 66 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::Brownian | |
70 | 73 | ||
71 | 74 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 75 | ||
73 | Foam::tmp<Foam::volScalarField> | ||
76 | Foam::scalar | ||
74 | 77 | Foam::populationBalanceSubModels::aggregationKernels::Brownian::Ka | Foam::populationBalanceSubModels::aggregationKernels::Brownian::Ka |
75 | 78 | ( | ( |
76 | const volScalarField& abscissa1, | ||
77 | const volScalarField& abscissa2 | ||
79 | const scalar& abscissa1, | ||
80 | const scalar& abscissa2, | ||
81 | const label celli | ||
78 | 82 | ) const | ) const |
79 | 83 | { | { |
80 | if (!abscissa1.mesh().foundObject<fluidThermo>(basicThermo::dictName)) | ||
81 | { | ||
82 | FatalErrorInFunction | ||
83 | << "No valid thermophysical model found." | ||
84 | << abort(FatalError); | ||
85 | } | ||
86 | |||
87 | const fluidThermo& flThermo = | ||
88 | abscissa1.mesh().lookupObject<fluidThermo>(basicThermo::dictName); | ||
89 | |||
90 | dimensionedScalar smallAbs("smallAbs", sqr(abscissa1.dimensions()), SMALL); | ||
91 | |||
92 | return | ||
93 | 2.0*Foam::constant::physicoChemical::k*flThermo.T() | ||
94 | *sqr(abscissa1 + abscissa2)/(3.0*flThermo.mu() | ||
95 | *max(abscissa1*abscissa2, smallAbs)); | ||
84 | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] | ||
85 | *sqr(abscissa1 + abscissa2)/(3.0*mu_[celli] | ||
86 | *max(abscissa1*abscissa2, SMALL)); | ||
96 | 87 | } | } |
97 | 88 | ||
98 | 89 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/Brownian/Brownian.H changed (mode: 100644) (index 0f4ecbb..484c722) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Brownian aggregation kernel. | Brownian aggregation kernel. |
29 | |||
29 | |||
30 | \f[ | ||
31 | K_a = \frac{2 \kappa T}{3 \mu} \frac{(\xi_i + \xi_j)^2}{\xi_i \xi_j} | ||
32 | \f] | ||
33 | |||
34 | where | ||
35 | |||
36 | \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] | ||
42 | \endvartable | ||
43 | |||
30 | 44 | Reference | Reference |
31 | 45 | \verbatim | \verbatim |
32 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
46 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
33 | 47 | Losunger" | Losunger" |
34 | 48 | M X Smoluchowski | M X Smoluchowski |
35 | 49 | Zeitschrift fur Physikalische Chemie | Zeitschrift fur Physikalische Chemie |
36 | 50 | Volume 92, Pages 129-142, 1917 | Volume 92, Pages 129-142, 1917 |
37 | \endverbatim | ||
51 | \endverbatim | ||
38 | 52 | ||
39 | 53 | SourceFiles | SourceFiles |
40 | 54 | Brownian.C | Brownian.C |
... | ... | SourceFiles | |
45 | 59 | #define Brownian_H | #define Brownian_H |
46 | 60 | ||
47 | 61 | #include "aggregationKernel.H" | #include "aggregationKernel.H" |
62 | #include "turbulentFluidThermoModel.H" | ||
48 | 63 | ||
49 | 64 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
50 | 65 | ||
... | ... | class Brownian | |
63 | 78 | : | : |
64 | 79 | public aggregationKernel | public aggregationKernel |
65 | 80 | { | { |
81 | //- Private data | ||
82 | |||
83 | //- Thermo model | ||
84 | const fluidThermo& flThermo_; | ||
85 | |||
86 | //- Temperature field | ||
87 | const volScalarField& T_; | ||
88 | |||
89 | //- Viscosity field | ||
90 | const volScalarField& mu_; | ||
91 | |||
92 | |||
66 | 93 | public: | public: |
67 | 94 | ||
68 | 95 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
72 | 99 | // Constructors | // Constructors |
73 | 100 | ||
74 | 101 | //- Construct from components | //- Construct from components |
75 | Brownian(const dictionary& dict); | ||
102 | Brownian | ||
103 | ( | ||
104 | const dictionary& dict, | ||
105 | const fvMesh& mesh | ||
106 | ); | ||
76 | 107 | ||
77 | 108 | ||
78 | 109 | //- Destructor | //- Destructor |
... | ... | public: | |
82 | 113 | // Member Functions | // Member Functions |
83 | 114 | ||
84 | 115 | //- Aggregation kernel | //- Aggregation kernel |
85 | virtual tmp<volScalarField> Ka | ||
116 | virtual scalar Ka | ||
86 | 117 | ( | ( |
87 | const volScalarField& abscissa1, | ||
88 | const volScalarField& abscissa2 | ||
118 | const scalar& abscissa1, | ||
119 | const scalar& abscissa2, | ||
120 | const label celli | ||
89 | 121 | ) const; | ) const; |
90 | 122 | ||
91 | 123 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.C changed (mode: 100644) (index a3aef66..1f61bcb) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
42 | 42 | ||
43 | 43 | Foam::populationBalanceSubModels::aggregationKernel::aggregationKernel | Foam::populationBalanceSubModels::aggregationKernel::aggregationKernel |
44 | 44 | ( | ( |
45 | const dictionary& dict | ||
45 | const dictionary& dict, | ||
46 | const fvMesh& mesh | ||
46 | 47 | ) | ) |
47 | 48 | : | : |
48 | 49 | dict_(dict), | dict_(dict), |
50 | mesh_(mesh), | ||
49 | 51 | Ca_ | Ca_ |
50 | 52 | ( | ( |
51 | 53 | dict.lookupOrDefault | dict.lookupOrDefault |
52 | 54 | ( | ( |
53 | "Ca", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | "Ca", | ||
56 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | 57 | ) | ) |
56 | 58 | ) | ) |
57 | 59 | {} | {} |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/aggregationKernel.H changed (mode: 100644) (index eb6de34..8c9215e) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Abstract class for aggregation kernels. | Abstract class for aggregation kernels. |
29 | |||
29 | |||
30 | 30 | SourceFiles | SourceFiles |
31 | 31 | aggregationKernel.C | aggregationKernel.C |
32 | 32 | ||
... | ... | namespace populationBalanceSubModels | |
52 | 52 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 53 | ||
54 | 54 | class aggregationKernel | class aggregationKernel |
55 | { | ||
55 | { | ||
56 | 56 | // Private member functions | // Private member functions |
57 | 57 | ||
58 | 58 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
... | ... | protected: | |
66 | 66 | ||
67 | 67 | // Protected data | // Protected data |
68 | 68 | ||
69 | //- Dictionary | ||
69 | 70 | const dictionary& dict_; | const dictionary& dict_; |
70 | 71 | ||
72 | //- Mesh | ||
73 | const fvMesh& mesh_; | ||
74 | |||
71 | 75 | //- Coefficient of aggregation kernel | //- Coefficient of aggregation kernel |
72 | 76 | const dimensionedScalar Ca_; | const dimensionedScalar Ca_; |
73 | 77 | ||
... | ... | public: | |
84 | 88 | aggregationKernel, | aggregationKernel, |
85 | 89 | dictionary, | dictionary, |
86 | 90 | ( | ( |
87 | const dictionary& dict | ||
91 | const dictionary& dict, | ||
92 | const fvMesh& mesh | ||
88 | 93 | ), | ), |
89 | (dict) | ||
94 | (dict, mesh) | ||
90 | 95 | ); | ); |
91 | 96 | ||
92 | 97 | ||
93 | 98 | // Constructors | // Constructors |
94 | 99 | ||
95 | 100 | //- Construct from components | //- Construct from components |
96 | aggregationKernel(const dictionary& dict); | ||
101 | aggregationKernel | ||
102 | ( | ||
103 | const dictionary& dict, | ||
104 | const fvMesh& mesh | ||
105 | ); | ||
97 | 106 | ||
98 | 107 | ||
99 | 108 | // Selectors | // Selectors |
100 | 109 | ||
101 | 110 | static autoPtr<aggregationKernel> New | static autoPtr<aggregationKernel> New |
102 | 111 | ( | ( |
103 | const dictionary& dict | ||
112 | const dictionary& dict, | ||
113 | const fvMesh& mesh | ||
104 | 114 | ); | ); |
105 | 115 | ||
106 | 116 | ||
... | ... | public: | |
111 | 121 | // Member Functions | // Member Functions |
112 | 122 | ||
113 | 123 | //- Aggregation kernel | //- Aggregation kernel |
114 | virtual tmp<volScalarField> Ka | ||
124 | virtual scalar Ka | ||
115 | 125 | ( | ( |
116 | const volScalarField& abscissa1, | ||
117 | const volScalarField& abscissa2 | ||
126 | const scalar& abscissa1, | ||
127 | const scalar& abscissa2, | ||
128 | const label celli | ||
118 | 129 | ) const = 0; | ) const = 0; |
119 | 130 | }; | }; |
120 | 131 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/aggregationKernel/newAggregationKernel.C changed (mode: 100644) (index aeca6b7..295a7e0) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
30 | 30 | Foam::autoPtr<Foam::populationBalanceSubModels::aggregationKernel> | Foam::autoPtr<Foam::populationBalanceSubModels::aggregationKernel> |
31 | 31 | Foam::populationBalanceSubModels::aggregationKernel::New | Foam::populationBalanceSubModels::aggregationKernel::New |
32 | 32 | ( | ( |
33 | const dictionary& dict | ||
33 | const dictionary& dict, | ||
34 | const fvMesh& mesh | ||
34 | 35 | ) | ) |
35 | 36 | { | { |
36 | 37 | word aggregationKernelType(dict.lookup("aggregationKernel")); | word aggregationKernelType(dict.lookup("aggregationKernel")); |
... | ... | Foam::populationBalanceSubModels::aggregationKernel::New | |
51 | 52 | << abort(FatalError); | << abort(FatalError); |
52 | 53 | } | } |
53 | 54 | ||
54 | return autoPtr<aggregationKernel>(cstrIter()(dict)); | ||
55 | return autoPtr<aggregationKernel>(cstrIter()(dict, mesh)); | ||
55 | 56 | } | } |
56 | 57 | ||
57 | 58 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.C changed (mode: 100644) (index 31f6fbb..15e84e1) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace aggregationKernels | |
52 | 52 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation |
53 | 53 | ::constantAggregation | ::constantAggregation |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | aggregationKernel(dict) | ||
59 | aggregationKernel(dict, mesh) | ||
59 | 60 | {} | {} |
60 | 61 | ||
61 | 62 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation | |
68 | 69 | ||
69 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 71 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::scalar | ||
72 | 73 | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka | Foam::populationBalanceSubModels::aggregationKernels::constantAggregation::Ka |
73 | 74 | ( | ( |
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
75 | const scalar& abscissa1, | ||
76 | const scalar& abscissa2, | ||
77 | const label celli | ||
76 | 78 | ) const | ) const |
77 | { | ||
78 | return | ||
79 | tmp<volScalarField> | ||
80 | ( | ||
81 | new volScalarField | ||
82 | ( | ||
83 | IOobject | ||
84 | ( | ||
85 | "constantAggregationK", | ||
86 | abscissa1.mesh().time().timeName(), | ||
87 | abscissa1.mesh() | ||
88 | ), | ||
89 | abscissa1.mesh(), | ||
90 | dimensionedScalar | ||
91 | ( | ||
92 | "constAggK", | ||
93 | pow3(abscissa1.dimensions())/dimTime, | ||
94 | Ca_.value() | ||
95 | ) | ||
96 | ) | ||
97 | ); | ||
79 | { | ||
80 | return Ca_.value(); | ||
98 | 81 | } | } |
99 | 82 | ||
100 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/constantAggregation/constantAggregation.H changed (mode: 100644) (index 254bd89..3ac668f) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Description | |
28 | 28 | Constant aggregation kernel. The value of the kernel is read from dictionary | Constant aggregation kernel. The value of the kernel is read from dictionary |
29 | 29 | or assumed equal to 1. | or assumed equal to 1. |
30 | 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 | ||
40 | |||
31 | 41 | SourceFiles | SourceFiles |
32 | 42 | constantAggregation.C | constantAggregation.C |
33 | 43 | ||
... | ... | public: | |
64 | 74 | // Constructors | // Constructors |
65 | 75 | ||
66 | 76 | //- Construct from components | //- Construct from components |
67 | constantAggregation(const dictionary& dict); | ||
77 | constantAggregation | ||
78 | ( | ||
79 | const dictionary& dict, | ||
80 | const fvMesh& mesh | ||
81 | ); | ||
68 | 82 | ||
69 | 83 | ||
70 | 84 | //- Destructor | //- Destructor |
... | ... | public: | |
74 | 88 | // Member Functions | // Member Functions |
75 | 89 | ||
76 | 90 | //- Aggregation kernel | //- Aggregation kernel |
77 | virtual tmp<volScalarField> Ka | ||
91 | virtual scalar Ka | ||
78 | 92 | ( | ( |
79 | const volScalarField& abscissa1, | ||
80 | const volScalarField& abscissa2 | ||
93 | const scalar& abscissa1, | ||
94 | const scalar& abscissa2, | ||
95 | const label celli | ||
81 | 96 | ) const; | ) const; |
82 | 97 | ||
83 | 98 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.C changed (mode: 100644) (index 91748e3..e6d5a0a) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace aggregationKernels | |
52 | 52 | Foam::populationBalanceSubModels::aggregationKernels | Foam::populationBalanceSubModels::aggregationKernels |
53 | 53 | ::differentialForceAggregation::differentialForceAggregation | ::differentialForceAggregation::differentialForceAggregation |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | aggregationKernel(dict) | ||
59 | aggregationKernel(dict, mesh) | ||
59 | 60 | {} | {} |
60 | 61 | ||
61 | 62 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels | |
68 | 69 | ||
69 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 71 | ||
71 | Foam::tmp<Foam::volScalarField> Foam::populationBalanceSubModels | ||
72 | ::aggregationKernels::differentialForceAggregation::Ka | ||
72 | Foam::scalar | ||
73 | Foam::populationBalanceSubModels::aggregationKernels:: | ||
74 | differentialForceAggregation::Ka | ||
73 | 75 | ( | ( |
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
76 | const scalar& abscissa1, | ||
77 | const scalar& abscissa2, | ||
78 | const label celli | ||
76 | 79 | ) const | ) const |
77 | 80 | { | { |
78 | tmp<volScalarField> aggK | ||
79 | = Ca_*sqr(abscissa1 + abscissa2)*mag(sqr(abscissa1) - sqr(abscissa2)); | ||
80 | |||
81 | aggK.ref().dimensions().reset(pow3(abscissa1.dimensions())/dimTime); | ||
82 | |||
83 | return aggK; | ||
81 | return Ca_.value()*sqr(abscissa1 + abscissa2) | ||
82 | *mag(sqr(abscissa1) - sqr(abscissa2)); | ||
84 | 83 | } | } |
85 | 84 | ||
86 | 85 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/differentialForceAggregation/differentialForceAggregation.H changed (mode: 100644) (index 0c59b3b..a570a47) | |||
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-2017 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 | ||
26 | ::differentialForceAggregation | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::differentialForceAggregation | ||
27 | 26 | ||
28 | 27 | Description | Description |
29 | Differential force aggregation kernel with user defined coefficient | ||
28 | Differential force aggregation kernel with user defined coefficient | ||
30 | 29 | (default Cagg = 1). | (default Cagg = 1). |
31 | 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 | ||
42 | |||
32 | 43 | SourceFiles | SourceFiles |
33 | 44 | differentialForceAggregation.C | differentialForceAggregation.C |
34 | 45 | ||
... | ... | public: | |
65 | 76 | // Constructors | // Constructors |
66 | 77 | ||
67 | 78 | //- Construct from components | //- Construct from components |
68 | differentialForceAggregation(const dictionary& dict); | ||
79 | differentialForceAggregation | ||
80 | ( | ||
81 | const dictionary& dict, | ||
82 | const fvMesh& mesh | ||
83 | ); | ||
69 | 84 | ||
70 | 85 | ||
71 | 86 | //- Destructor | //- Destructor |
... | ... | public: | |
75 | 90 | // Member Functions | // Member Functions |
76 | 91 | ||
77 | 92 | //- Aggregation kernel | //- Aggregation kernel |
78 | virtual tmp<volScalarField> Ka | ||
93 | virtual scalar Ka | ||
79 | 94 | ( | ( |
80 | const volScalarField& abscissa1, | ||
81 | const volScalarField& abscissa2 | ||
95 | const scalar& abscissa1, | ||
96 | const scalar& abscissa2, | ||
97 | const label celli | ||
82 | 98 | ) const; | ) const; |
83 | 99 | ||
84 | 100 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.C changed (mode: 100644) (index be80659..8e50a55) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace aggregationKernels | |
52 | 52 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation |
53 | 53 | ::hydrodynamicAggregation | ::hydrodynamicAggregation |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | aggregationKernel(dict) | ||
59 | aggregationKernel(dict, mesh) | ||
59 | 60 | {} | {} |
60 | 61 | ||
61 | 62 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | |
68 | 69 | ||
69 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 71 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | ||
73 | ::Ka | ||
72 | Foam::scalar | ||
73 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation:: | ||
74 | Ka | ||
74 | 75 | ( | ( |
75 | const volScalarField& abscissa1, | ||
76 | const volScalarField& abscissa2 | ||
76 | const scalar& abscissa1, | ||
77 | const scalar& abscissa2, | ||
78 | const label celli | ||
77 | 79 | ) const | ) const |
78 | { | ||
79 | return Ca_*pow3(abscissa1 + abscissa2); | ||
80 | { | ||
81 | return Ca_.value()*pow3(abscissa1 + abscissa2); | ||
80 | 82 | } | } |
81 | 83 | ||
82 | 84 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/hydrodynamicAggregation/hydrodynamicAggregation.H changed (mode: 100644) (index c8e203d..2bae39e) | |||
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-2017 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 | ||
26 | ::hydrodynamicAggregationAggregation | ||
25 | Foam::populationBalanceSubModels::aggregationKernels::hydrodynamicAggregation | ||
27 | 26 | ||
28 | 27 | Description | Description |
29 | Hydrodynamic aggregation kernel with user defined coefficient | ||
28 | Hydrodynamic aggregation kernel with user defined coefficient | ||
30 | 29 | (default Cagg = 1). | (default Cagg = 1). |
31 | 30 | ||
31 | \f[ | ||
32 | K_a = C_a (\xi_i + \xi_j)^3 | ||
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 | ||
42 | |||
32 | 43 | SourceFiles | SourceFiles |
33 | 44 | hydrodynamicAggregation.C | hydrodynamicAggregation.C |
34 | 45 | ||
... | ... | public: | |
65 | 76 | // Constructors | // Constructors |
66 | 77 | ||
67 | 78 | //- Construct from components | //- Construct from components |
68 | hydrodynamicAggregation(const dictionary& dict); | ||
79 | hydrodynamicAggregation | ||
80 | ( | ||
81 | const dictionary& dict, | ||
82 | const fvMesh& mesh | ||
83 | ); | ||
69 | 84 | ||
70 | 85 | ||
71 | 86 | //- Destructor | //- Destructor |
... | ... | public: | |
75 | 90 | // Member Functions | // Member Functions |
76 | 91 | ||
77 | 92 | //- Aggregation kernel | //- Aggregation kernel |
78 | virtual tmp<volScalarField> Ka | ||
93 | virtual scalar Ka | ||
79 | 94 | ( | ( |
80 | const volScalarField& abscissa1, | ||
81 | const volScalarField& abscissa2 | ||
95 | const scalar& abscissa1, | ||
96 | const scalar& abscissa2, | ||
97 | const label celli | ||
82 | 98 | ) const; | ) const; |
83 | 99 | ||
84 | 100 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.C changed (mode: 100644) (index 6e91fe6..be56267) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace aggregationKernels | |
52 | 52 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation |
53 | 53 | ::sumAggregation | ::sumAggregation |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | aggregationKernel(dict) | ||
59 | aggregationKernel(dict, mesh) | ||
59 | 60 | {} | {} |
60 | 61 | ||
61 | 62 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation | |
68 | 69 | ||
69 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 71 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::scalar | ||
72 | 73 | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation::Ka | Foam::populationBalanceSubModels::aggregationKernels::sumAggregation::Ka |
73 | 74 | ( | ( |
74 | const volScalarField& abscissa1, | ||
75 | const volScalarField& abscissa2 | ||
75 | const scalar& abscissa1, | ||
76 | const scalar& abscissa2, | ||
77 | const label celli | ||
76 | 78 | ) const | ) const |
77 | { | ||
78 | return Ca_*(pow3(abscissa1) + pow3(abscissa2)); | ||
79 | { | ||
80 | return Ca_.value()*(pow3(abscissa1) + pow3(abscissa2)); | ||
79 | 81 | } | } |
80 | 82 | ||
81 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/sumAggregation/sumAggregation.H changed (mode: 100644) (index a5e3f2e..c61cf09) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Sum aggregation kernel with user defined coefficient (default Cagg = 1). | Sum aggregation kernel with user defined coefficient (default Cagg = 1). |
29 | 29 | ||
30 | \f[ | ||
31 | K_a = C_a (\xi_i^3 + \xi_j^3) | ||
32 | \f] | ||
33 | |||
34 | where | ||
35 | |||
36 | \vartable | ||
37 | C_a | Aggregation coefficient [1/s] | ||
38 | \xi_i | Abscissa of particle i [m] | ||
39 | \xi_j | Abscissa of particle j [m] | ||
40 | \endvartable | ||
41 | |||
30 | 42 | SourceFiles | SourceFiles |
31 | 43 | sumAggregation.C | sumAggregation.C |
32 | 44 | ||
... | ... | public: | |
63 | 75 | // Constructors | // Constructors |
64 | 76 | ||
65 | 77 | //- Construct from components | //- Construct from components |
66 | sumAggregation(const dictionary& dict); | ||
78 | sumAggregation | ||
79 | ( | ||
80 | const dictionary& dict, | ||
81 | const fvMesh& mesh | ||
82 | ); | ||
67 | 83 | ||
68 | 84 | ||
69 | 85 | //- Destructor | //- Destructor |
... | ... | public: | |
73 | 89 | // Member Functions | // Member Functions |
74 | 90 | ||
75 | 91 | //- Aggregation kernel | //- Aggregation kernel |
76 | virtual tmp<volScalarField> Ka | ||
92 | virtual scalar Ka | ||
77 | 93 | ( | ( |
78 | const volScalarField& abscissa1, | ||
79 | const volScalarField& abscissa2 | ||
94 | const scalar& abscissa1, | ||
95 | const scalar& abscissa2, | ||
96 | const label celli | ||
80 | 97 | ) const; | ) const; |
81 | 98 | ||
82 | 99 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.C changed (mode: 100644) (index 6aaa378..b8aaafa) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "turbulentBrownian.H" | #include "turbulentBrownian.H" |
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | 28 | #include "fundamentalConstants.H" | #include "fundamentalConstants.H" |
30 | 29 | ||
31 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
... | ... | namespace aggregationKernels | |
54 | 53 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian |
55 | 54 | ::turbulentBrownian | ::turbulentBrownian |
56 | 55 | ( | ( |
57 | const dictionary& dict | ||
56 | const dictionary& dict, | ||
57 | const fvMesh& mesh | ||
58 | 58 | ) | ) |
59 | 59 | : | : |
60 | aggregationKernel(dict) | ||
60 | aggregationKernel(dict, mesh), | ||
61 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
62 | flTurb_ | ||
63 | ( | ||
64 | mesh_.lookupObject<compressible::turbulenceModel> | ||
65 | ( | ||
66 | turbulenceModel::propertiesName | ||
67 | ) | ||
68 | ), | ||
69 | T_(flThermo_.T()), | ||
70 | rho_(flThermo_.rho()), | ||
71 | mu_(flThermo_.mu()), | ||
72 | epsilon_(flTurb_.epsilon()) | ||
61 | 73 | {} | {} |
62 | 74 | ||
63 | 75 | ||
... | ... | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | |
70 | 82 | ||
71 | 83 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 84 | ||
73 | Foam::tmp<Foam::volScalarField> | ||
85 | Foam::scalar | ||
74 | 86 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian::Ka | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian::Ka |
75 | 87 | ( | ( |
76 | const volScalarField& abscissa1, | ||
77 | const volScalarField& abscissa2 | ||
88 | const scalar& abscissa1, | ||
89 | const scalar& abscissa2, | ||
90 | const label celli | ||
78 | 91 | ) const | ) const |
79 | 92 | { | { |
80 | if (!abscissa1.db().foundObject<fluidThermo>(basicThermo::dictName)) | ||
81 | { | ||
82 | FatalErrorInFunction | ||
83 | << "No valid thermophysical model found." | ||
84 | << abort(FatalError); | ||
85 | } | ||
86 | |||
87 | const fluidThermo& flThermo = | ||
88 | abscissa1.db().lookupObject<fluidThermo>(basicThermo::dictName); | ||
89 | |||
90 | typedef compressible::turbulenceModel cmpTurbModel; | ||
91 | |||
92 | if | ||
93 | ( | ||
94 | !abscissa1.db().foundObject<cmpTurbModel> | ||
95 | ( | ||
96 | cmpTurbModel::propertiesName | ||
97 | ) | ||
98 | ) | ||
99 | { | ||
100 | FatalErrorInFunction | ||
101 | << "No valid compressible turbulence model found." | ||
102 | << abort(FatalError); | ||
103 | } | ||
104 | |||
105 | const compressible::turbulenceModel& flTurb = | ||
106 | abscissa1.db().lookupObject<compressible::turbulenceModel> | ||
107 | ( | ||
108 | turbulenceModel::propertiesName | ||
109 | ); | ||
110 | |||
111 | dimensionedScalar smallAbs("smallAbs", sqr(abscissa1.dimensions()), SMALL); | ||
112 | |||
113 | return | ||
114 | 2.0*Foam::constant::physicoChemical::k*flThermo.T() | ||
115 | *sqr(abscissa1 + abscissa2)/(3.0*flThermo.mu() | ||
116 | *max(abscissa1*abscissa2, smallAbs)) | ||
117 | + 4.0/3.0*pow3(abscissa1 + abscissa2) | ||
118 | *sqrt(3.0*Foam::constant::mathematical::pi*flTurb.epsilon() | ||
119 | /(10.0*flTurb.nu())); | ||
93 | return 2.0*Foam::constant::physicoChemical::k.value()*T_[celli] | ||
94 | *sqr(abscissa1 + abscissa2)/(3.0*mu_[celli] | ||
95 | *max(abscissa1*abscissa2, SMALL)) + 4.0/3.0*pow3(abscissa1 + abscissa2) | ||
96 | *sqrt(3.0*Foam::constant::mathematical::pi*epsilon_[celli] | ||
97 | /(10.0*mu_[celli]/rho_[celli])); | ||
120 | 98 | } | } |
121 | 99 | ||
122 | 100 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/aggregationKernels/turbulentBrownian/turbulentBrownian.H changed (mode: 100644) (index 103dc66..56e3df3) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
25 | 25 | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian | Foam::populationBalanceSubModels::aggregationKernels::turbulentBrownian |
26 | 26 | ||
27 | 27 | Description | Description |
28 | Brownian aggregation kernel supplemented kernel for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
28 | Brownian aggregation kernel supplemented for particles in turbulent | ||
29 | flows in conditions when the particle size is smaller than the local | ||
30 | 30 | Kolmogorov scale. | Kolmogorov scale. |
31 | |||
31 | |||
32 | \f[ | ||
33 | K_a = \frac{2 \kappa T}{3 \mu} \frac{(\xi_i + \xi_j)^2}{\xi_i \xi_j} | ||
34 | + \frac{4}{3} (\xi_i + \xi_j)^3 | ||
35 | \sqrt{\frac{3 \pi \varepsilon}{10 \nu}} | ||
36 | \f] | ||
37 | |||
38 | where | ||
39 | |||
40 | \vartable | ||
41 | T | Absolute Temperature [K] | ||
42 | \varepsilon | Turbulent dissipation rate [m2/s3] | ||
43 | \kappa | Boltzmann's constant [J/K] | ||
44 | \mu | Molecular dynamic iscosity [Pa s] | ||
45 | \nu | Turbulent Kinematic viscosity [m2/s] | ||
46 | \xi_i | Abscissa of particle i [m] | ||
47 | \xi_j | Abscissa of particle j [m] | ||
48 | \endvartable | ||
49 | |||
32 | 50 | References | References |
33 | 51 | \verbatim | \verbatim |
34 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
52 | "Versuch Einer Mathematischen Theorie Der Koagulationskinetic Kolloider | ||
35 | 53 | Losunger" | Losunger" |
36 | 54 | M X Smoluchowski | M X Smoluchowski |
37 | 55 | Zeitschrift fur Physikalische Chemie | Zeitschrift fur Physikalische Chemie |
38 | 56 | Volume 92, Pages 129-142, 1917 | Volume 92, Pages 129-142, 1917 |
39 | \endverbatim | ||
40 | |||
57 | \endverbatim | ||
58 | |||
41 | 59 | \verbatim | \verbatim |
42 | "Kinetics of turbulent coagulation studied by means of end-over-end | ||
60 | "Kinetics of turbulent coagulation studied by means of end-over-end | ||
43 | 61 | rotation" | rotation" |
44 | 62 | Y Adachi, M A Cohen Stuart, R Fokkink | Y Adachi, M A Cohen Stuart, R Fokkink |
45 | 63 | Journal of Colloid and Interface Science | Journal of Colloid and Interface Science |
46 | 64 | Volume 165, Pages 310-317, 1994 | Volume 165, Pages 310-317, 1994 |
47 | \endverbatim | ||
65 | \endverbatim | ||
48 | 66 | ||
49 | 67 | SourceFiles | SourceFiles |
50 | 68 | turbulentBrownian.C | turbulentBrownian.C |
... | ... | SourceFiles | |
55 | 73 | #define turbulentBrownian_H | #define turbulentBrownian_H |
56 | 74 | ||
57 | 75 | #include "aggregationKernel.H" | #include "aggregationKernel.H" |
76 | #include "turbulentFluidThermoModel.H" | ||
58 | 77 | ||
59 | 78 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
60 | 79 | ||
... | ... | class turbulentBrownian | |
73 | 92 | : | : |
74 | 93 | public aggregationKernel | public aggregationKernel |
75 | 94 | { | { |
95 | // Private data | ||
96 | |||
97 | //- Thermo model | ||
98 | const fluidThermo& flThermo_; | ||
99 | |||
100 | //- Turbulence model | ||
101 | const compressible::turbulenceModel& flTurb_; | ||
102 | |||
103 | //- Temperature field | ||
104 | const volScalarField& T_; | ||
105 | |||
106 | //- Density field | ||
107 | const volScalarField& rho_; | ||
108 | |||
109 | //- Dynamic viscosity field | ||
110 | const volScalarField& mu_; | ||
111 | |||
112 | //- Turbulent dissipation rate field | ||
113 | const volScalarField& epsilon_; | ||
114 | |||
115 | |||
76 | 116 | public: | public: |
77 | 117 | ||
78 | 118 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
82 | 122 | // Constructors | // Constructors |
83 | 123 | ||
84 | 124 | //- Construct from components | //- Construct from components |
85 | turbulentBrownian(const dictionary& dict); | ||
125 | turbulentBrownian | ||
126 | ( | ||
127 | const dictionary& dict, | ||
128 | const fvMesh& mesh | ||
129 | ); | ||
86 | 130 | ||
87 | 131 | ||
88 | 132 | //- Destructor | //- Destructor |
... | ... | public: | |
92 | 136 | // Member Functions | // Member Functions |
93 | 137 | ||
94 | 138 | //- Aggregation kernel | //- Aggregation kernel |
95 | virtual tmp<volScalarField> Ka | ||
139 | virtual scalar Ka | ||
96 | 140 | ( | ( |
97 | const volScalarField& abscissa1, | ||
98 | const volScalarField& abscissa2 | ||
141 | const scalar& abscissa1, | ||
142 | const scalar& abscissa2, | ||
143 | const label celli | ||
99 | 144 | ) const; | ) const; |
100 | 145 | ||
101 | 146 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.C changed (mode: 100644) (index e218f77..6a78b95) | |||
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "AyaziShamlou.H" | #include "AyaziShamlou.H" |
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | 28 | ||
30 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
31 | 30 | ||
... | ... | namespace breakupKernels | |
53 | 52 | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou |
54 | 53 | ::AyaziShamlou | ::AyaziShamlou |
55 | 54 | ( | ( |
56 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
57 | 57 | ) | ) |
58 | 58 | : | : |
59 | breakupKernel(dict), | ||
59 | breakupKernel(dict, mesh), | ||
60 | 60 | A_(dict.lookup("A")), | A_(dict.lookup("A")), |
61 | 61 | df_(dict.lookup("df")), | df_(dict.lookup("df")), |
62 | 62 | H0_(dict.lookup("H0")), | H0_(dict.lookup("H0")), |
63 | primarySize_(dict.lookup("primarySize")) | ||
63 | primarySize_(dict.lookup("primarySize")), | ||
64 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
65 | flTurb_ | ||
66 | ( | ||
67 | mesh_.lookupObject<compressible::turbulenceModel> | ||
68 | ( | ||
69 | turbulenceModel::propertiesName | ||
70 | ) | ||
71 | ), | ||
72 | epsilon_(flTurb_.epsilon()), | ||
73 | mu_(flThermo_.mu()), | ||
74 | rho_(flThermo_.rho()) | ||
64 | 75 | {} | {} |
65 | 76 | ||
66 | 77 | ||
... | ... | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou::~AyaziShamlou() | |
72 | 83 | ||
73 | 84 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
74 | 85 | ||
75 | Foam::tmp<Foam::volScalarField> | ||
86 | Foam::scalar | ||
76 | 87 | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou::Kb | Foam::populationBalanceSubModels::breakupKernels::AyaziShamlou::Kb |
77 | 88 | ( | ( |
78 | const volScalarField& abscissa | ||
89 | const scalar& abscissa, | ||
90 | const label celli | ||
79 | 91 | ) const | ) const |
80 | 92 | { | { |
81 | if (!abscissa.db().foundObject<fluidThermo>(basicThermo::dictName)) | ||
82 | { | ||
83 | FatalErrorInFunction | ||
84 | << "No valid thermophysical model found." | ||
85 | << abort(FatalError); | ||
86 | } | ||
87 | |||
88 | const fluidThermo& flThermo = | ||
89 | abscissa.db().lookupObject<fluidThermo>(basicThermo::dictName); | ||
90 | |||
91 | typedef compressible::turbulenceModel cmpTurbModel; | ||
92 | |||
93 | if | ||
94 | ( | ||
95 | !abscissa.db().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 cmpTurbModel& flTurb = | ||
107 | abscissa.db().lookupObject<cmpTurbModel> | ||
108 | ( | ||
109 | turbulenceModel::propertiesName | ||
110 | ); | ||
111 | |||
112 | 93 | // Interparticle force | // Interparticle force |
113 | dimensionedScalar F = A_*primarySize_/(12.0*sqr(H0_)); | ||
94 | scalar F = A_.value()*primarySize_.value()/(12.0*sqr(H0_.value())); | ||
114 | 95 | ||
115 | 96 | // Coefficient of volume fraction (Vanni, 2000) | // Coefficient of volume fraction (Vanni, 2000) |
116 | dimensionedScalar C = 0.41*df_ - 0.211; | ||
97 | scalar C = 0.41*df_.value() - 0.211; | ||
117 | 98 | ||
118 | 99 | // Volume fraction of solid within aggregates | // Volume fraction of solid within aggregates |
119 | volScalarField phiL(C*Foam::pow(abscissa/primarySize_, df_ - 3.0)); | ||
100 | scalar phiL = C*pow(abscissa/primarySize_.value(), df_.value() - 3.0); | ||
120 | 101 | ||
121 | 102 | // Coordination number | // Coordination number |
122 | volScalarField kc(15.0*Foam::pow(phiL, 1.2)); | ||
103 | scalar kc = 15.0*pow(phiL, 1.2); | ||
123 | 104 | ||
124 | 105 | // Aggregation strength | // Aggregation strength |
125 | volScalarField sigma(9.0*kc*phiL*F/(8.0*sqr(primarySize_) | ||
126 | *Foam::constant::mathematical::pi)); | ||
106 | scalar sigma = 9.0*kc*phiL*F/(8.0*sqr(primarySize_.value()) | ||
107 | *Foam::constant::mathematical::pi); | ||
127 | 108 | ||
128 | volScalarField epsilonByNu(flTurb.epsilon()/flThermo.nu()); | ||
109 | scalar epsilonByNu = epsilon_[celli]*rho_[celli]/mu_[celli]; | ||
129 | 110 | ||
130 | volScalarField tau(flThermo.mu()*sqrt(epsilonByNu)); | ||
111 | scalar tau = mu_[celli]*sqrt(epsilonByNu); | ||
131 | 112 | ||
132 | 113 | return sqrt(epsilonByNu/15.0)*exp(-sigma/tau); | return sqrt(epsilonByNu/15.0)*exp(-sigma/tau); |
133 | 114 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/AyaziShamlou/AyaziShamlou.H changed (mode: 100644) (index 582e3b7..3fecc66) | |||
... | ... | SourceFiles | |
45 | 45 | #define AyaziShamlou_H | #define AyaziShamlou_H |
46 | 46 | ||
47 | 47 | #include "breakupKernel.H" | #include "breakupKernel.H" |
48 | #include "turbulentFluidThermoModel.H" | ||
48 | 49 | ||
49 | 50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
50 | 51 | ||
... | ... | private: | |
79 | 80 | //- Primary particle size | //- Primary particle size |
80 | 81 | dimensionedScalar primarySize_; | dimensionedScalar primarySize_; |
81 | 82 | ||
83 | //- Thermo model | ||
84 | const fluidThermo& flThermo_; | ||
85 | |||
86 | //- Turbulence model | ||
87 | const compressible::turbulenceModel& flTurb_; | ||
88 | |||
89 | //- Turbulent dissipation rate | ||
90 | const volScalarField& epsilon_; | ||
91 | |||
92 | //- Dynamic viscosity | ||
93 | const volScalarField& mu_; | ||
94 | |||
95 | //- Density | ||
96 | const volScalarField& rho_; | ||
97 | |||
98 | |||
82 | 99 | public: | public: |
83 | 100 | ||
84 | 101 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
88 | 105 | // Constructors | // Constructors |
89 | 106 | ||
90 | 107 | //- Construct from components | //- Construct from components |
91 | AyaziShamlou(const dictionary& dict); | ||
108 | AyaziShamlou | ||
109 | ( | ||
110 | const dictionary& dict, | ||
111 | const fvMesh& mesh | ||
112 | ); | ||
92 | 113 | ||
93 | 114 | ||
94 | 115 | //- Destructor | //- Destructor |
... | ... | public: | |
98 | 119 | // Member Functions | // Member Functions |
99 | 120 | ||
100 | 121 | //- Breakup kernel | //- Breakup kernel |
101 | virtual tmp<volScalarField> Kb | ||
122 | virtual scalar Kb | ||
102 | 123 | ( | ( |
103 | const volScalarField& abscissa | ||
124 | const scalar& abscissa, | ||
125 | const label celli | ||
104 | 126 | ) const; | ) const; |
105 | 127 | ||
106 | 128 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.C changed (mode: 100644) (index 891c5c6..de460d6) | |||
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "LuoSvendsen.H" | #include "LuoSvendsen.H" |
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | 28 | ||
30 | 29 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
31 | 30 | ||
... | ... | namespace breakupKernels | |
53 | 52 | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen |
54 | 53 | ::LuoSvendsen | ::LuoSvendsen |
55 | 54 | ( | ( |
56 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
57 | 57 | ) | ) |
58 | 58 | : | : |
59 | breakupKernel(dict), | ||
59 | breakupKernel(dict, mesh), | ||
60 | 60 | Cb_(dict.lookup("Cb")), | Cb_(dict.lookup("Cb")), |
61 | 61 | epsilonExp_(readScalar(dict.lookup("epsilonExp"))), | epsilonExp_(readScalar(dict.lookup("epsilonExp"))), |
62 | 62 | nuExp_(readScalar(dict.lookup("nuExp"))), | nuExp_(readScalar(dict.lookup("nuExp"))), |
63 | sizeExp_(readScalar(dict.lookup("sizeExp"))) | ||
63 | sizeExp_(readScalar(dict.lookup("sizeExp"))), | ||
64 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
65 | flTurb_ | ||
66 | ( | ||
67 | mesh_.lookupObject<compressible::turbulenceModel> | ||
68 | ( | ||
69 | turbulenceModel::propertiesName | ||
70 | ) | ||
71 | ), | ||
72 | epsilon_(flTurb_.epsilon()), | ||
73 | mu_(flThermo_.mu()), | ||
74 | rho_(flThermo_.rho()) | ||
64 | 75 | {} | {} |
65 | 76 | ||
66 | 77 | ||
... | ... | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen::~LuoSvendsen() | |
72 | 83 | ||
73 | 84 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
74 | 85 | ||
75 | Foam::tmp<Foam::volScalarField> | ||
86 | Foam::scalar | ||
76 | 87 | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen::Kb | Foam::populationBalanceSubModels::breakupKernels::LuoSvendsen::Kb |
77 | 88 | ( | ( |
78 | const volScalarField& abscissa | ||
89 | const scalar& abscissa, | ||
90 | const label celli | ||
79 | 91 | ) const | ) const |
80 | 92 | { | { |
81 | typedef compressible::turbulenceModel cmpTurbModel; | ||
82 | |||
83 | if | ||
84 | ( | ||
85 | !abscissa.db().foundObject<cmpTurbModel> | ||
86 | ( | ||
87 | cmpTurbModel::propertiesName | ||
88 | ) | ||
89 | ) | ||
90 | { | ||
91 | FatalErrorInFunction | ||
92 | << "No valid compressible turbulence model found." | ||
93 | << abort(FatalError); | ||
94 | } | ||
95 | |||
96 | const cmpTurbModel& flTurb = | ||
97 | abscissa.db().lookupObject<cmpTurbModel> | ||
98 | ( | ||
99 | cmpTurbModel::propertiesName | ||
100 | ); | ||
101 | |||
102 | return Cb_*Foam::pow(flTurb.epsilon(), epsilonExp_) | ||
103 | *Foam::pow(flTurb.nu(), nuExp_)*Foam::pow(abscissa, sizeExp_); | ||
93 | return Cb_.value()*pow(epsilon_[celli], epsilonExp_) | ||
94 | *pow(mu_[celli]/rho_[celli], nuExp_)*pow(abscissa, sizeExp_); | ||
104 | 95 | } | } |
105 | 96 | ||
106 | 97 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/LuoSvendsen/LuoSvendsen.H changed (mode: 100644) (index 6ba095d..c2fbfe0) | |||
... | ... | Description | |
35 | 35 | Volume 42, Pages 1225-1233, 1996 | Volume 42, Pages 1225-1233, 1996 |
36 | 36 | \endverbatim | \endverbatim |
37 | 37 | ||
38 | |||
39 | |||
40 | 38 | SourceFiles | SourceFiles |
41 | 39 | LuoSvendsen.C | LuoSvendsen.C |
42 | 40 | ||
... | ... | SourceFiles | |
46 | 44 | #define LuoSvendsen_H | #define LuoSvendsen_H |
47 | 45 | ||
48 | 46 | #include "breakupKernel.H" | #include "breakupKernel.H" |
47 | #include "turbulentFluidThermoModel.H" | ||
49 | 48 | ||
50 | 49 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
51 | 50 | ||
... | ... | private: | |
80 | 79 | //- Exponent of the abscissa | //- Exponent of the abscissa |
81 | 80 | scalar sizeExp_; | scalar sizeExp_; |
82 | 81 | ||
82 | //- Thermo model | ||
83 | const fluidThermo& flThermo_; | ||
84 | |||
85 | //- Turbulence model | ||
86 | const compressible::turbulenceModel& flTurb_; | ||
87 | |||
88 | //- Turbulent dissipation rate | ||
89 | const volScalarField& epsilon_; | ||
90 | |||
91 | //- Dynamic viscosity | ||
92 | const volScalarField& mu_; | ||
93 | |||
94 | //- Density | ||
95 | const volScalarField& rho_; | ||
96 | |||
83 | 97 | public: | public: |
84 | 98 | ||
85 | 99 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
89 | 103 | // Constructors | // Constructors |
90 | 104 | ||
91 | 105 | //- Construct from components | //- Construct from components |
92 | LuoSvendsen(const dictionary& dict); | ||
106 | LuoSvendsen | ||
107 | ( | ||
108 | const dictionary& dict, | ||
109 | const fvMesh& mesh | ||
110 | ); | ||
93 | 111 | ||
94 | 112 | ||
95 | 113 | //- Destructor | //- Destructor |
... | ... | public: | |
99 | 117 | // Member Functions | // Member Functions |
100 | 118 | ||
101 | 119 | //- Breakup kernel | //- Breakup kernel |
102 | virtual tmp<volScalarField> Kb | ||
120 | virtual scalar Kb | ||
103 | 121 | ( | ( |
104 | const volScalarField& abscissa | ||
122 | const scalar& abscissa, | ||
123 | const label celli | ||
105 | 124 | ) const; | ) const; |
106 | 125 | ||
107 | 126 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.C changed (mode: 100644) (index 5da20f6..1e4bf64) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | namespace populationBalanceSubModels | |
42 | 42 | ||
43 | 43 | Foam::populationBalanceSubModels::breakupKernel::breakupKernel | Foam::populationBalanceSubModels::breakupKernel::breakupKernel |
44 | 44 | ( | ( |
45 | const dictionary& dict | ||
45 | const dictionary& dict, | ||
46 | const fvMesh& mesh | ||
46 | 47 | ) | ) |
47 | 48 | : | : |
48 | 49 | dict_(dict), | dict_(dict), |
50 | mesh_(mesh), | ||
49 | 51 | Cb_ | Cb_ |
50 | 52 | ( | ( |
51 | 53 | dict.lookupOrDefault | dict.lookupOrDefault |
52 | 54 | ( | ( |
53 | "Cb", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | "Cb", | ||
56 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | 57 | ) | ) |
56 | 58 | ) | ) |
57 | 59 | {} | {} |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/breakupKernel.H changed (mode: 100644) (index dcba2f7..762ff4c) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Abstract class for breakup kernels. | Abstract class for breakup kernels. |
29 | |||
29 | |||
30 | 30 | SourceFiles | SourceFiles |
31 | 31 | breakupKernel.C | breakupKernel.C |
32 | 32 | ||
... | ... | namespace populationBalanceSubModels | |
52 | 52 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 53 | ||
54 | 54 | class breakupKernel | class breakupKernel |
55 | { | ||
55 | { | ||
56 | 56 | // Private member functions | // Private member functions |
57 | 57 | ||
58 | 58 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
... | ... | protected: | |
66 | 66 | ||
67 | 67 | // Protected data | // Protected data |
68 | 68 | ||
69 | //- Dictionary | ||
69 | 70 | const dictionary& dict_; | const dictionary& dict_; |
70 | 71 | ||
72 | //- Mesh | ||
73 | const fvMesh& mesh_; | ||
74 | |||
71 | 75 | //- Coefficient of aggregation kernel | //- Coefficient of aggregation kernel |
72 | 76 | const dimensionedScalar Cb_; | const dimensionedScalar Cb_; |
73 | 77 | ||
... | ... | public: | |
84 | 88 | breakupKernel, | breakupKernel, |
85 | 89 | dictionary, | dictionary, |
86 | 90 | ( | ( |
87 | const dictionary& dict | ||
91 | const dictionary& dict, | ||
92 | const fvMesh& mesh | ||
88 | 93 | ), | ), |
89 | (dict) | ||
94 | (dict, mesh) | ||
90 | 95 | ); | ); |
91 | 96 | ||
92 | 97 | ||
93 | 98 | // Constructors | // Constructors |
94 | 99 | ||
95 | 100 | //- Construct from components | //- Construct from components |
96 | breakupKernel(const dictionary& dict); | ||
101 | breakupKernel | ||
102 | ( | ||
103 | const dictionary& dict, | ||
104 | const fvMesh& mesh | ||
105 | ); | ||
97 | 106 | ||
98 | 107 | ||
99 | 108 | // Selectors | // Selectors |
100 | 109 | ||
101 | 110 | static autoPtr<breakupKernel> New | static autoPtr<breakupKernel> New |
102 | 111 | ( | ( |
103 | const dictionary& dict | ||
112 | const dictionary& dict, | ||
113 | const fvMesh& mesh | ||
104 | 114 | ); | ); |
105 | 115 | ||
106 | 116 | ||
... | ... | public: | |
111 | 121 | // Member Functions | // Member Functions |
112 | 122 | ||
113 | 123 | //- Breakup kernel | //- Breakup kernel |
114 | virtual tmp<volScalarField> Kb | ||
124 | virtual scalar Kb | ||
115 | 125 | ( | ( |
116 | const volScalarField& abscissa | ||
126 | const scalar& abscissa, | ||
127 | const label celli | ||
117 | 128 | ) const = 0; | ) const = 0; |
118 | 129 | }; | }; |
119 | 130 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/breakupKernel/newBreakupKernel.C changed (mode: 100644) (index 714a1c2..42abec9) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | License | |
30 | 30 | Foam::autoPtr<Foam::populationBalanceSubModels::breakupKernel> | Foam::autoPtr<Foam::populationBalanceSubModels::breakupKernel> |
31 | 31 | Foam::populationBalanceSubModels::breakupKernel::New | Foam::populationBalanceSubModels::breakupKernel::New |
32 | 32 | ( | ( |
33 | const dictionary& dict | ||
33 | const dictionary& dict, | ||
34 | const fvMesh& mesh | ||
34 | 35 | ) | ) |
35 | 36 | { | { |
36 | 37 | word breakupKernelType(dict.lookup("breakupKernel")); | word breakupKernelType(dict.lookup("breakupKernel")); |
... | ... | Foam::populationBalanceSubModels::breakupKernel::New | |
51 | 52 | << abort(FatalError); | << abort(FatalError); |
52 | 53 | } | } |
53 | 54 | ||
54 | return autoPtr<breakupKernel>(cstrIter()(dict)); | ||
55 | return autoPtr<breakupKernel>(cstrIter()(dict, mesh)); | ||
55 | 56 | } | } |
56 | 57 | ||
57 | 58 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.C changed (mode: 100644) (index c48e964..5ab0420) | |||
... | ... | namespace breakupKernels | |
52 | 52 | Foam::populationBalanceSubModels::breakupKernels::constantBreakup | Foam::populationBalanceSubModels::breakupKernels::constantBreakup |
53 | 53 | ::constantBreakup | ::constantBreakup |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | breakupKernel(dict), | ||
59 | breakupKernel(dict, mesh), | ||
59 | 60 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)) | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)) |
60 | 61 | {} | {} |
61 | 62 | ||
... | ... | Foam::populationBalanceSubModels::breakupKernels::constantBreakup | |
69 | 70 | ||
70 | 71 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
71 | 72 | ||
72 | Foam::tmp<Foam::volScalarField> | ||
73 | Foam::scalar | ||
73 | 74 | Foam::populationBalanceSubModels::breakupKernels::constantBreakup::Kb | Foam::populationBalanceSubModels::breakupKernels::constantBreakup::Kb |
74 | 75 | ( | ( |
75 | const volScalarField& abscissa | ||
76 | const scalar& abscissa, | ||
77 | const label celli | ||
76 | 78 | ) const | ) const |
77 | { | ||
78 | dimensionedScalar minAbs | ||
79 | ( | ||
80 | "minAbs", | ||
81 | abscissa.dimensions(), | ||
82 | minAbscissa_.value() | ||
83 | ); | ||
84 | |||
85 | return Cb_*pos(abscissa - minAbs); | ||
79 | { | ||
80 | return Cb_.value()*pos0(abscissa - minAbscissa_.value()); | ||
86 | 81 | } | } |
87 | 82 | ||
88 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/constantBreakup/constantBreakup.H changed (mode: 100644) (index e392ae3..2cad01b) | |||
... | ... | class constantBreakup | |
57 | 57 | public breakupKernel | public breakupKernel |
58 | 58 | { | { |
59 | 59 | private: | private: |
60 | |||
60 | |||
61 | 61 | // Private data | // Private data |
62 | 62 | ||
63 | 63 | //- Minimum value of the abscissa to apply the model | //- Minimum value of the abscissa to apply the model |
64 | 64 | dimensionedScalar minAbscissa_; | dimensionedScalar minAbscissa_; |
65 | |||
65 | |||
66 | 66 | public: | public: |
67 | 67 | ||
68 | 68 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
72 | 72 | // Constructors | // Constructors |
73 | 73 | ||
74 | 74 | //- Construct from components | //- Construct from components |
75 | constantBreakup(const dictionary& dict); | ||
75 | constantBreakup | ||
76 | ( | ||
77 | const dictionary& dict, | ||
78 | const fvMesh& mesh | ||
79 | ); | ||
76 | 80 | ||
77 | 81 | ||
78 | 82 | //- Destructor | //- Destructor |
... | ... | public: | |
82 | 86 | // Member Functions | // Member Functions |
83 | 87 | ||
84 | 88 | //- Breakup kernel | //- Breakup kernel |
85 | virtual tmp<volScalarField> Kb | ||
89 | virtual scalar Kb | ||
86 | 90 | ( | ( |
87 | const volScalarField& abscissa | ||
91 | const scalar& abscissa, | ||
92 | const label celli | ||
88 | 93 | ) const; | ) const; |
89 | 94 | ||
90 | 95 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.C changed (mode: 100644) (index 31c467d..ebb1973) | |||
... | ... | namespace breakupKernels | |
52 | 52 | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup |
53 | 53 | ::exponentialBreakup | ::exponentialBreakup |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | breakupKernel(dict), | ||
59 | breakupKernel(dict, mesh), | ||
59 | 60 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)), | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)), |
60 | 61 | expCoeff_ | expCoeff_ |
61 | 62 | ( | ( |
... | ... | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup | |
77 | 78 | ||
78 | 79 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
79 | 80 | ||
80 | Foam::tmp<Foam::volScalarField> | ||
81 | Foam::scalar | ||
81 | 82 | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup::Kb | Foam::populationBalanceSubModels::breakupKernels::exponentialBreakup::Kb |
82 | 83 | ( | ( |
83 | const volScalarField& abscissa | ||
84 | const scalar& abscissa, | ||
85 | const label celli | ||
84 | 86 | ) const | ) const |
85 | 87 | { | { |
86 | dimensionedScalar minAbs | ||
87 | ( | ||
88 | "minAbs", | ||
89 | abscissa.dimensions(), | ||
90 | minAbscissa_.value() | ||
91 | ); | ||
92 | |||
93 | return Cb_*pos(abscissa - minAbs)*exp(expCoeff_*pow3(abscissa)); | ||
88 | return Cb_.value()*pos0(abscissa - minAbscissa_.value()) | ||
89 | *exp(expCoeff_.value()*pow3(abscissa)); | ||
94 | 90 | } | } |
95 | 91 | ||
96 | 92 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/exponentialBreakup/exponentialBreakup.H changed (mode: 100644) (index 0d36ebd..e70a7e3) | |||
... | ... | class exponentialBreakup | |
57 | 57 | public breakupKernel | public breakupKernel |
58 | 58 | { | { |
59 | 59 | private: | private: |
60 | |||
60 | |||
61 | 61 | // Private data | // Private data |
62 | 62 | ||
63 | 63 | //- Minimum value of the abscissa to apply the model | //- Minimum value of the abscissa to apply the model |
64 | 64 | dimensionedScalar minAbscissa_; | dimensionedScalar minAbscissa_; |
65 | |||
65 | |||
66 | 66 | //- Exponent of the kernel | //- Exponent of the kernel |
67 | 67 | dimensionedScalar expCoeff_; | dimensionedScalar expCoeff_; |
68 | |||
68 | |||
69 | 69 | public: | public: |
70 | 70 | ||
71 | 71 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
75 | 75 | // Constructors | // Constructors |
76 | 76 | ||
77 | 77 | //- Construct from components | //- Construct from components |
78 | exponentialBreakup(const dictionary& dict); | ||
78 | exponentialBreakup | ||
79 | ( | ||
80 | const dictionary& dict, | ||
81 | const fvMesh& mesh | ||
82 | ); | ||
79 | 83 | ||
80 | 84 | ||
81 | 85 | //- Destructor | //- Destructor |
... | ... | public: | |
85 | 89 | // Member Functions | // Member Functions |
86 | 90 | ||
87 | 91 | //- Breakup kernel | //- Breakup kernel |
88 | virtual tmp<volScalarField> Kb | ||
92 | virtual scalar Kb | ||
89 | 93 | ( | ( |
90 | const volScalarField& abscissa | ||
94 | const scalar& abscissa, | ||
95 | const label celli | ||
91 | 96 | ) const; | ) const; |
92 | 97 | ||
93 | 98 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.C changed (mode: 100644) (index 4f8980f..2a96365) | |||
... | ... | namespace breakupKernels | |
52 | 52 | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup |
53 | 53 | ::powerLawBreakup | ::powerLawBreakup |
54 | 54 | ( | ( |
55 | const dictionary& dict | ||
55 | const dictionary& dict, | ||
56 | const fvMesh& mesh | ||
56 | 57 | ) | ) |
57 | 58 | : | : |
58 | breakupKernel(dict), | ||
59 | breakupKernel(dict, mesh), | ||
59 | 60 | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)), | minAbscissa_(dict.lookupOrDefault("minAbscissa", 1.0)), |
60 | 61 | abscissaExponent_(dict.lookupOrDefault("abscissaExponent", 3)) | abscissaExponent_(dict.lookupOrDefault("abscissaExponent", 3)) |
61 | 62 | {} | {} |
... | ... | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup | |
70 | 71 | ||
71 | 72 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 73 | ||
73 | Foam::tmp<Foam::volScalarField> | ||
74 | Foam::scalar | ||
74 | 75 | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup::Kb | Foam::populationBalanceSubModels::breakupKernels::powerLawBreakup::Kb |
75 | 76 | ( | ( |
76 | const volScalarField& abscissa | ||
77 | const scalar& abscissa, | ||
78 | const label celli | ||
77 | 79 | ) const | ) const |
78 | 80 | { | { |
79 | dimensionedScalar minAbs | ||
80 | ( | ||
81 | "minAbs", | ||
82 | abscissa.dimensions(), | ||
83 | minAbscissa_.value() | ||
84 | ); | ||
85 | |||
86 | tmp<volScalarField> brK = | ||
87 | Cb_*pos(abscissa - minAbs)*Foam::pow(abscissa, abscissaExponent_); | ||
88 | |||
89 | brK.ref().dimensions().reset(Foam::pow(dimTime, -1)); | ||
90 | |||
91 | return brK; | ||
81 | return Cb_.value()*pos0(abscissa - minAbscissa_.value()) | ||
82 | *pow(abscissa, abscissaExponent_); | ||
92 | 83 | } | } |
93 | 84 | ||
94 | 85 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/breakupKernels/powerLawBreakup/powerLawBreakup.H changed (mode: 100644) (index faee468..3ef2299) | |||
... | ... | class powerLawBreakup | |
57 | 57 | public breakupKernel | public breakupKernel |
58 | 58 | { | { |
59 | 59 | private: | private: |
60 | |||
60 | |||
61 | 61 | // Private data | // Private data |
62 | 62 | ||
63 | 63 | //- Minimum value of the abscissa to apply the model | //- Minimum value of the abscissa to apply the model |
64 | 64 | dimensionedScalar minAbscissa_; | dimensionedScalar minAbscissa_; |
65 | |||
65 | |||
66 | 66 | //- Exponent of the kernel | //- Exponent of the kernel |
67 | 67 | scalar abscissaExponent_; | scalar abscissaExponent_; |
68 | |||
68 | |||
69 | 69 | public: | public: |
70 | 70 | ||
71 | 71 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
75 | 75 | // Constructors | // Constructors |
76 | 76 | ||
77 | 77 | //- Construct from components | //- Construct from components |
78 | powerLawBreakup(const dictionary& dict); | ||
78 | powerLawBreakup | ||
79 | ( | ||
80 | const dictionary& dict, | ||
81 | const fvMesh& mesh | ||
82 | ); | ||
79 | 83 | ||
80 | 84 | ||
81 | 85 | //- Destructor | //- Destructor |
... | ... | public: | |
85 | 89 | // Member Functions | // Member Functions |
86 | 90 | ||
87 | 91 | //- Breakup kernel | //- Breakup kernel |
88 | virtual tmp<volScalarField> Kb | ||
92 | virtual scalar Kb | ||
89 | 93 | ( | ( |
90 | const volScalarField& abscissa | ||
94 | const scalar& abscissa, | ||
95 | const label celli | ||
91 | 96 | ) const; | ) const; |
92 | 97 | ||
93 | 98 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/buoyancyInduced/buoyancyInduced.C deleted (index ef4f028..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 "buoyancyInduced.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
29 | |||
30 | namespace Foam | ||
31 | { | ||
32 | namespace populationBalanceSubModels | ||
33 | { | ||
34 | namespace coalescenceKernels | ||
35 | { | ||
36 | defineTypeNameAndDebug(buoyancyInduced, 0); | ||
37 | |||
38 | addToRunTimeSelectionTable | ||
39 | ( | ||
40 | coalescenceKernel, | ||
41 | buoyancyInduced, | ||
42 | dictionary | ||
43 | ); | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | |||
49 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
50 | |||
51 | Foam::populationBalanceSubModels::coalescenceKernels::buoyancyInduced | ||
52 | ::buoyancyInduced | ||
53 | ( | ||
54 | const dictionary& dict, | ||
55 | const fvMesh& mesh, | ||
56 | const volVectorField& U | ||
57 | ) | ||
58 | : | ||
59 | coalescenceKernel(dict, mesh, U), | ||
60 | Ucrit_(dict.lookup("Ucrit")), | ||
61 | thisPhaseName_(dict.lookup("thisPhaseName")), | ||
62 | contPhaseName_(dict.lookup("contPhaseName")) | ||
63 | {} | ||
64 | |||
65 | |||
66 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
67 | |||
68 | Foam::populationBalanceSubModels::coalescenceKernels::buoyancyInduced | ||
69 | ::~buoyancyInduced() | ||
70 | {} | ||
71 | |||
72 | |||
73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
74 | |||
75 | Foam::tmp<Foam::volScalarField> | ||
76 | Foam::populationBalanceSubModels::coalescenceKernels::buoyancyInduced::Ka | ||
77 | ( | ||
78 | const volScalarField& abscissa1, | ||
79 | const volScalarField& abscissa2 | ||
80 | ) const | ||
81 | { | ||
82 | |||
83 | //Info << "Printing objectRegistry Names abscissa1.mesh(): " << abscissa1.mesh().objectRegistry::names() << endl; | ||
84 | |||
85 | //Info << "Printing objectRegistry Names mesh(): " << mesh_.objectRegistry::names() << endl; | ||
86 | //Info << "Printing dictionary transportProperties: " << mesh_.lookupObject<IOdictionary>("transportProperties") << endl; | ||
87 | |||
88 | //Info << "Printing volVectorField U: " << mesh_.lookupObject<volVectorField>("U") << endl; | ||
89 | //Info << "Printing volVectorField U_: " << U_ << endl; | ||
90 | |||
91 | dimensionedScalar smallAbs("smallAbs", pow3(abscissa1.dimensions())/dimTime, SMALL); | ||
92 | |||
93 | //- Read velocity of the associated phase (NOT NECESSARY : velocity of the associated phase is now U_ | ||
94 | //volVectorField Udisp_ | ||
95 | //( | ||
96 | // mesh_.lookupObject<volVectorField>("U") | ||
97 | //); | ||
98 | |||
99 | //- Read velocity of the continuous phase | ||
100 | //word Ucontinuous_ = "U.organic"; | ||
101 | word Ucontinuous_ = IOobject::groupName("U", contPhaseName_); | ||
102 | volVectorField Ucont_ | ||
103 | ( | ||
104 | mesh_.lookupObject<volVectorField>(Ucontinuous_) | ||
105 | ); | ||
106 | |||
107 | //- Evaluate relative velocity | ||
108 | volScalarField Uslip_(mag(U_-Ucont_)); | ||
109 | |||
110 | // Moved Ucrit to populationBalancedictionary | ||
111 | //dimensionedScalar Ucrit_("Ucrit_", dimensionSet(0,1,-1,0,0,0,0), 0.001); | ||
112 | |||
113 | // Read sauter diameter | ||
114 | dimensionedScalar diaMin_("diaMin_", dimensionSet(0,1,0,0,0,0,0), 1.0e-06); | ||
115 | dimensionedScalar diaMax_("diaMax_", dimensionSet(0,1,0,0,0,0,0), 1.0e-01); | ||
116 | dimensionedScalar smallMoment2("smallMoment2", dimensionSet(0,-1,0,0,0,0,0), 1.0e-06); | ||
117 | volScalarField dSauter_ | ||
118 | ( | ||
119 | min | ||
120 | ( | ||
121 | max | ||
122 | ( | ||
123 | mesh_.lookupObject<volScalarField> | ||
124 | ( | ||
125 | IOobject::groupName("moment.3.populationBalance", thisPhaseName_) | ||
126 | ) | ||
127 | / | ||
128 | max | ||
129 | ( | ||
130 | mesh_.lookupObject<volScalarField> | ||
131 | ( | ||
132 | IOobject::groupName("moment.2.populationBalance", thisPhaseName_) | ||
133 | ), | ||
134 | smallMoment2 | ||
135 | ), | ||
136 | diaMin_ | ||
137 | ), | ||
138 | diaMax_ | ||
139 | ) | ||
140 | ); | ||
141 | |||
142 | //- Evaluate relative velocity of different drops | ||
143 | volScalarField Urelative_ | ||
144 | ( | ||
145 | mag(Uslip_*(abscissa2-abscissa1)/dSauter_) | ||
146 | ); | ||
147 | |||
148 | //- Evaluate efficiency term | ||
149 | volScalarField lambda_(Foam::exp(-(Urelative_/Ucrit_))); | ||
150 | /* | ||
151 | if (min(lambda_) < smallAbs) | ||
152 | { | ||
153 | Info << "Found negative values: " << min(lambda_) << endl; | ||
154 | } | ||
155 | */ | ||
156 | |||
157 | tmp<volScalarField> coalescenceK | ||
158 | = Ck_ | ||
159 | *(0.25*Foam::constant::mathematical::pi) | ||
160 | *sqr(abscissa1 + abscissa2)*Urelative_ | ||
161 | *lambda_; | ||
162 | |||
163 | coalescenceK.ref().dimensions().reset(pow3(abscissa1.dimensions())/dimTime); | ||
164 | |||
165 | /* forAll(coalescenceK(), I) | ||
166 | { | ||
167 | if (coalescenceK[I] < smallAbs) | ||
168 | { | ||
169 | scalarField& cScalarField = coalescenceK()[I]; | ||
170 | cScalarField = 0.0; | ||
171 | Info << "Employed coalescence kernel has negative values..." << endl; | ||
172 | } | ||
173 | } | ||
174 | */ | ||
175 | return coalescenceK; | ||
176 | } | ||
177 | |||
178 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/buoyancyInduced/buoyancyInduced.H deleted (index 558a646..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::buoyancyInduced | ||
26 | |||
27 | Description | ||
28 | buoyancyInduced coalescence kernel. | ||
29 | |||
30 | References | ||
31 | \verbatim | ||
32 | "Simulating separation of a multiphase liquid-liquid system in a | ||
33 | horizontal settler by CFD" | ||
34 | A Misra, L Medeiros de Souza, M Illner, L Hohl, M Kraume, J-U Repke, | ||
35 | D Thévenin | ||
36 | Chemical Engineering Science | ||
37 | Volume 167, Pages 242-250, 2017 | ||
38 | \endverbatim | ||
39 | |||
40 | SourceFiles | ||
41 | buoyancyInduced.C | ||
42 | |||
43 | \*---------------------------------------------------------------------------*/ | ||
44 | |||
45 | #ifndef buoyancyInduced_H | ||
46 | #define buoyancyInduced_H | ||
47 | |||
48 | #include "coalescenceKernel.H" | ||
49 | #include "mathematicalConstants.H" | ||
50 | #include "fundamentalConstants.H" | ||
51 | #include "addToRunTimeSelectionTable.H" | ||
52 | |||
53 | |||
54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
55 | |||
56 | namespace Foam | ||
57 | { | ||
58 | namespace populationBalanceSubModels | ||
59 | { | ||
60 | namespace coalescenceKernels | ||
61 | { | ||
62 | |||
63 | /*---------------------------------------------------------------------------*\ | ||
64 | Class buoyancyInduced Declaration | ||
65 | \*---------------------------------------------------------------------------*/ | ||
66 | |||
67 | class buoyancyInduced | ||
68 | : | ||
69 | public coalescenceKernel | ||
70 | { | ||
71 | private: | ||
72 | |||
73 | // Private data | ||
74 | |||
75 | //- Critical velocity | ||
76 | dimensionedScalar Ucrit_; | ||
77 | |||
78 | //- This phase name | ||
79 | word thisPhaseName_; | ||
80 | |||
81 | //- continuous phase name | ||
82 | word contPhaseName_; | ||
83 | |||
84 | |||
85 | public: | ||
86 | |||
87 | //- Runtime type information | ||
88 | TypeName("buoyancyInduced"); | ||
89 | |||
90 | |||
91 | // Constructors | ||
92 | |||
93 | //- Construct from components | ||
94 | buoyancyInduced | ||
95 | ( | ||
96 | const dictionary& dict, | ||
97 | const fvMesh& mesh, | ||
98 | const volVectorField& U | ||
99 | ); | ||
100 | |||
101 | |||
102 | //- Destructor | ||
103 | virtual ~buoyancyInduced(); | ||
104 | |||
105 | |||
106 | // Member Functions | ||
107 | |||
108 | //- Coalescence kernel | ||
109 | virtual tmp<volScalarField> Ka | ||
110 | ( | ||
111 | const volScalarField& abscissa1, | ||
112 | const volScalarField& abscissa2 | ||
113 | ) const; | ||
114 | |||
115 | }; | ||
116 | |||
117 | |||
118 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
119 | |||
120 | } // End namespace coalescenceKernels | ||
121 | } // End namespace populationBalanceSubModels | ||
122 | } // End namespace Foam | ||
123 | |||
124 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
125 | |||
126 | #endif | ||
127 | |||
128 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coalescenceKernel/coalescenceKernel.C deleted (index aca7577..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 | const fvMesh& mesh, | ||
47 | const volVectorField& U | ||
48 | ) | ||
49 | : | ||
50 | dict_(dict), | ||
51 | mesh_(mesh), | ||
52 | U_(U), | ||
53 | Ck_ | ||
54 | ( | ||
55 | dict.lookupOrDefault | ||
56 | ( | ||
57 | "Ck", | ||
58 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
59 | ) | ||
60 | ) | ||
61 | {} | ||
62 | |||
63 | |||
64 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
65 | |||
66 | Foam::populationBalanceSubModels::coalescenceKernel::~coalescenceKernel() | ||
67 | {} | ||
68 | |||
69 | |||
70 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/coalescenceKernels/coalescenceKernel/coalescenceKernel.H deleted (index edd0bc5..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 | #include "phaseModel.H" | ||
43 | |||
44 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
45 | |||
46 | namespace Foam | ||
47 | { | ||
48 | namespace populationBalanceSubModels | ||
49 | { | ||
50 | |||
51 | /*---------------------------------------------------------------------------*\ | ||
52 | Class coalescenceKernel Declaration | ||
53 | \*---------------------------------------------------------------------------*/ | ||
54 | |||
55 | class coalescenceKernel | ||
56 | { | ||
57 | // Private member functions | ||
58 | |||
59 | //- Disallow default bitwise copy construct | ||
60 | coalescenceKernel(const coalescenceKernel&); | ||
61 | |||
62 | //- Disallow default bitwise assignment | ||
63 | void operator=(const coalescenceKernel&); | ||
64 | |||
65 | |||
66 | protected: | ||
67 | |||
68 | // Protected data | ||
69 | |||
70 | const dictionary& dict_; | ||
71 | |||
72 | //- Reference to mesh | ||
73 | const fvMesh& mesh_; | ||
74 | |||
75 | const volVectorField& U_; | ||
76 | |||
77 | //- Coefficient of coalescence kernel | ||
78 | const dimensionedScalar Ck_; | ||
79 | |||
80 | |||
81 | public: | ||
82 | |||
83 | //- Runtime type information | ||
84 | TypeName("coalescenceKernel"); | ||
85 | |||
86 | // Declare runtime constructor selection table | ||
87 | declareRunTimeSelectionTable | ||
88 | ( | ||
89 | autoPtr, | ||
90 | coalescenceKernel, | ||
91 | dictionary, | ||
92 | ( | ||
93 | const dictionary& dict, | ||
94 | const fvMesh& mesh, | ||
95 | const volVectorField& U | ||
96 | ), | ||
97 | (dict, mesh, U) | ||
98 | ); | ||
99 | |||
100 | |||
101 | // Constructors | ||
102 | |||
103 | //- Construct from components | ||
104 | coalescenceKernel | ||
105 | ( | ||
106 | const dictionary& dict, | ||
107 | const fvMesh& mesh, | ||
108 | const volVectorField& U | ||
109 | ); | ||
110 | |||
111 | |||
112 | // Selectors | ||
113 | |||
114 | static autoPtr<coalescenceKernel> New | ||
115 | ( | ||
116 | const dictionary& dict, | ||
117 | const fvMesh& mesh, | ||
118 | const volVectorField& U | ||
119 | ); | ||
120 | |||
121 | |||
122 | //- Destructor | ||
123 | virtual ~coalescenceKernel(); | ||
124 | |||
125 | |||
126 | // Member Functions | ||
127 | |||
128 | //- Coalescence kernel | ||
129 | virtual tmp<volScalarField> Ka | ||
130 | ( | ||
131 | const volScalarField& abscissa1, | ||
132 | const volScalarField& abscissa2 | ||
133 | ) const = 0; | ||
134 | }; | ||
135 | |||
136 | |||
137 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
138 | |||
139 | } // End namespace populationBalanceSubModels | ||
140 | } // End namespace Foam | ||
141 | |||
142 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
143 | |||
144 | #endif | ||
145 | |||
146 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/daughterDistribution.C changed (mode: 100644) (index d420f36..cc7d8a1) | |||
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-2017 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 e0118db..7a8592a) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Abstract class for the daughter distribution of fragments in breakup | Abstract class for the daughter distribution of fragments in breakup |
29 | 29 | processes. | processes. |
30 | |||
30 | |||
31 | 31 | SourceFiles | SourceFiles |
32 | 32 | daughterDistribution.C | daughterDistribution.C |
33 | 33 | ||
... | ... | public: | |
109 | 109 | // Member Functions | // Member Functions |
110 | 110 | ||
111 | 111 | //- Moment of the daughter distribution function | //- Moment of the daughter distribution function |
112 | virtual tmp<volScalarField> mD | ||
112 | virtual scalar mD | ||
113 | 113 | ( | ( |
114 | const label order, | ||
115 | const volScalarField& abscissa | ||
114 | const label& order, | ||
115 | const scalar& abscissa | ||
116 | 116 | ) const = 0; | ) const = 0; |
117 | 117 | }; | }; |
118 | 118 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/daughterDistribution/newDaughterDistribution.C changed (mode: 100644) (index 6164d29..47a327f) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/erosion/erosion.C changed (mode: 100644) (index 1441ebf..b5c2575) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::daughterDistributions::erosion | |
69 | 69 | ||
70 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
71 | 71 | ||
72 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::scalar | ||
73 | 73 | Foam::populationBalanceSubModels::daughterDistributions::erosion::mD | Foam::populationBalanceSubModels::daughterDistributions::erosion::mD |
74 | 74 | ( | ( |
75 | const label order, | ||
76 | const volScalarField& abscissa | ||
75 | const label& order, | ||
76 | const scalar& abscissa | ||
77 | 77 | ) const | ) const |
78 | { | ||
79 | return Foam::pow(primarySize_, order) | ||
80 | + Foam::pow(pow3(abscissa) - pow3(primarySize_) , order/3.0); | ||
78 | { | ||
79 | return pow(primarySize_.value(), order) | ||
80 | + pow(pow3(abscissa) - pow3(primarySize_.value()), order/3.0); | ||
81 | 81 | } | } |
82 | 82 | ||
83 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/erosion/erosion.H changed (mode: 100644) (index 18932f2..be1ff1b) | |||
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-2017 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::daughterDistribution::erosion | ||
25 | Foam::populationBalanceSubModels::daughterDistributions::erosion | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Daughter distribution of fragments for erosion. | Daughter distribution of fragments for erosion. |
29 | 29 | ||
30 | The moment source term corresponding to the distribution is: | ||
31 | |||
32 | \f[ | ||
33 | \overline{b}_k = \xi_0^k + (\xi^3 - \xi_0^3)^{1/3} | ||
34 | \f] | ||
35 | |||
36 | where | ||
37 | |||
38 | \vartable | ||
39 | k | Order of the moment [-] | ||
40 | \xi | Particle size [m] | ||
41 | \xi_0 | Primary particle size [m] | ||
42 | \endvartable | ||
43 | |||
30 | 44 | SourceFiles | SourceFiles |
31 | 45 | erosion.C | erosion.C |
32 | 46 | ||
... | ... | class erosion | |
55 | 69 | public daughterDistribution | public daughterDistribution |
56 | 70 | { | { |
57 | 71 | private: | private: |
58 | |||
72 | |||
59 | 73 | // Private data | // Private data |
60 | 74 | ||
61 | 75 | //- Primary particle size | //- Primary particle size |
... | ... | public: | |
81 | 95 | // Member Functions | // Member Functions |
82 | 96 | ||
83 | 97 | //- Moment of the daughter distribution function | //- Moment of the daughter distribution function |
84 | virtual tmp<volScalarField> mD | ||
98 | virtual scalar mD | ||
85 | 99 | ( | ( |
86 | const label order, | ||
87 | const volScalarField& abscissa | ||
100 | const label& order, | ||
101 | const scalar& abscissa | ||
88 | 102 | ) const; | ) const; |
89 | 103 | ||
90 | 104 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.C changed (mode: 100644) (index 66e6ad5..d483b94) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation | |
68 | 68 | ||
69 | 69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 70 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
71 | Foam::scalar | ||
72 | 72 | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation |
73 | 73 | ::mD | ::mD |
74 | 74 | ( | ( |
75 | const label order, | ||
76 | const volScalarField& abscissa | ||
75 | const label& order, | ||
76 | const scalar& abscissa | ||
77 | 77 | ) const | ) const |
78 | 78 | { | { |
79 | 79 | ||
80 | return (pow3(abscissa)/pow3(primarySize_))*Foam::pow(primarySize_, order); | ||
80 | return (pow3(abscissa/primarySize_.value())) | ||
81 | *pow(primarySize_.value(), order); | ||
81 | 82 | } | } |
82 | 83 | ||
83 | 84 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/fullFragmentation/fullFragmentation.H changed (mode: 100644) (index 9b027f7..876a3e6) | |||
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-2017 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::daughterDistribution::fullFragmentation | ||
25 | Foam::populationBalanceSubModels::daughterDistributions::fullFragmentation | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Daughter distribution of fragments with full fragmentation. | Daughter distribution of fragments with full fragmentation. |
29 | 29 | ||
30 | The moment source term corresponding to the distribution is: | ||
31 | |||
32 | \f[ | ||
33 | \overline{b}_k = \left( \frac{\xi}{\xi_0} \right)^3 \xi_0^k | ||
34 | \f] | ||
35 | |||
36 | where | ||
37 | |||
38 | \vartable | ||
39 | k | Order of the moment [-] | ||
40 | \xi | Particle size [m] | ||
41 | \xi_0 | Primary particle size [m] | ||
42 | \endvartable | ||
43 | |||
30 | 44 | SourceFiles | SourceFiles |
31 | 45 | fullFragmentation.C | fullFragmentation.C |
32 | 46 | ||
... | ... | public: | |
81 | 95 | // Member Functions | // Member Functions |
82 | 96 | ||
83 | 97 | //- Moment of the daughter distribution function | //- Moment of the daughter distribution function |
84 | virtual tmp<volScalarField> mD | ||
98 | virtual scalar mD | ||
85 | 99 | ( | ( |
86 | const label order, | ||
87 | const volScalarField& abscissa | ||
100 | const label& order, | ||
101 | const scalar& abscissa | ||
88 | 102 | ) const; | ) const; |
89 | 103 | ||
90 | 104 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.C changed (mode: 100644) (index 270370f..b354747) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio | |
68 | 68 | ||
69 | 69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 70 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
71 | Foam::scalar | ||
72 | 72 | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio::mD | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio::mD |
73 | 73 | ( | ( |
74 | const label order, | ||
75 | const volScalarField& abscissa | ||
74 | const label& order, | ||
75 | const scalar& abscissa | ||
76 | 76 | ) const | ) const |
77 | { | ||
77 | { | ||
78 | 78 | scalar exponent = order/3.0; | scalar exponent = order/3.0; |
79 | |||
80 | return (Foam::pow(4.0, exponent) + 1.0)*Foam::pow(abscissa, order)/Foam::pow(5, exponent); | ||
79 | |||
80 | return (pow(4.0, exponent) + 1.0)*pow(abscissa, order)/pow(5, exponent); | ||
81 | 81 | } | } |
82 | 82 | ||
83 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/oneQuarterMassRatio/oneQuarterMassRatio.H changed (mode: 100644) (index cd5fb39..073f24a) | |||
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-2017 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::daughterDistribution::oneQuarterMassRatio | ||
25 | Foam::populationBalanceSubModels::daughterDistributions::oneQuarterMassRatio | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | Daughter distribution of fragments with one quarter mass ratio | ||
28 | Daughter distribution of fragments with one quarter mass ratio | ||
29 | 29 | fragmentation. | fragmentation. |
30 | 30 | ||
31 | The moment source term corresponding to the distribution is: | ||
32 | |||
33 | \f[ | ||
34 | \overline{b}_k = \frac{4^{k/3} + 1}{5^{k/3}} \xi^k | ||
35 | \f] | ||
36 | |||
37 | where | ||
38 | |||
39 | \vartable | ||
40 | k | Order of the moment [-] | ||
41 | \xi | Particle size [m] | ||
42 | \endvartable | ||
43 | |||
31 | 44 | SourceFiles | SourceFiles |
32 | 45 | oneQuarterMassRatio.C | oneQuarterMassRatio.C |
33 | 46 | ||
... | ... | public: | |
74 | 87 | // Member Functions | // Member Functions |
75 | 88 | ||
76 | 89 | //- Moment of the daughter distribution function | //- Moment of the daughter distribution function |
77 | virtual tmp<volScalarField> mD | ||
90 | virtual scalar mD | ||
78 | 91 | ( | ( |
79 | const label order, | ||
80 | const volScalarField& abscissa | ||
92 | const label& order, | ||
93 | const scalar& abscissa | ||
81 | 94 | ) const; | ) const; |
82 | 95 | ||
83 | 96 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.C changed (mode: 100644) (index 0e4e15b..d677ffc) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation | |
68 | 68 | ||
69 | 69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 70 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
71 | Foam::scalar | ||
72 | 72 | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation |
73 | 73 | ::mD | ::mD |
74 | 74 | ( | ( |
75 | const label order, | ||
76 | const volScalarField& abscissa | ||
75 | const label& order, | ||
76 | const scalar& abscissa | ||
77 | 77 | ) const | ) const |
78 | { | ||
79 | return Foam::pow(2.0, (3.0 - order)/3.0)*Foam::pow(abscissa, order); | ||
78 | { | ||
79 | return pow(2.0, (3.0 - order)/3.0)*pow(abscissa, order); | ||
80 | 80 | } | } |
81 | 81 | ||
82 | 82 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/symmetricFragmentation/symmetricFragmentation.H changed (mode: 100644) (index e6ca9d4..bccd075) | |||
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-2017 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::daughterDistribution::symmetricFragmentation | ||
25 | Foam::populationBalanceSubModels::daughterDistributions::symmetricFragmentation | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Daughter distribution of fragments with symmetric fragmentation. | Daughter distribution of fragments with symmetric fragmentation. |
29 | 29 | ||
30 | The moment source term corresponding to the distribution is: | ||
31 | |||
32 | \f[ | ||
33 | \overline{b}_k = 2^{(3-k)/3} \xi^k | ||
34 | \f] | ||
35 | |||
36 | \vartable | ||
37 | k | Order of the moment [-] | ||
38 | \xi | Particle size [m] | ||
39 | \endvartable | ||
40 | |||
30 | 41 | SourceFiles | SourceFiles |
31 | 42 | symmetricFragmentation.C | symmetricFragmentation.C |
32 | 43 | ||
... | ... | public: | |
73 | 84 | // Member Functions | // Member Functions |
74 | 85 | ||
75 | 86 | //- Moment of the daughter distribution function | //- Moment of the daughter distribution function |
76 | virtual tmp<volScalarField> mD | ||
87 | virtual scalar mD | ||
77 | 88 | ( | ( |
78 | const label order, | ||
79 | const volScalarField& abscissa | ||
89 | const label& order, | ||
90 | const scalar& abscissa | ||
80 | 91 | ) const; | ) const; |
81 | 92 | ||
82 | 93 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/uniform/uniform.C changed (mode: 100644) (index d898dfc..283083a) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::populationBalanceSubModels::daughterDistributions::uniform | |
68 | 68 | ||
69 | 69 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 70 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
71 | Foam::scalar | ||
72 | 72 | Foam::populationBalanceSubModels::daughterDistributions::uniform::mD | Foam::populationBalanceSubModels::daughterDistributions::uniform::mD |
73 | 73 | ( | ( |
74 | const label order, | ||
75 | const volScalarField& abscissa | ||
74 | const label& order, | ||
75 | const scalar& abscissa | ||
76 | 76 | ) const | ) const |
77 | { | ||
78 | return 6.0*Foam::pow(abscissa, order)/(order + 3.0); | ||
77 | { | ||
78 | return 6.0*pow(abscissa, order)/(order + 3.0); | ||
79 | 79 | } | } |
80 | 80 | ||
81 | 81 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/daugtherDistributions/uniform/uniform.H changed (mode: 100644) (index 680cf82..3c0f5c0) | |||
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-2017 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::daughterDistribution::uniform | ||
25 | Foam::populationBalanceSubModels::daughterDistributions::uniform | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Daughter distribution of fragments with uniform fragmentation. | Daughter distribution of fragments with uniform fragmentation. |
29 | 29 | ||
30 | The moment source term corresponding to the distribution is: | ||
31 | |||
32 | \f[ | ||
33 | \overline{b}_k = \frac{6}{k + 3} \xi^k | ||
34 | \f] | ||
35 | |||
36 | \vartable | ||
37 | k | Order of the moment [-] | ||
38 | \xi | Particle size [m] | ||
39 | \endvartable | ||
40 | |||
30 | 41 | SourceFiles | SourceFiles |
31 | 42 | uniform.C | uniform.C |
32 | 43 | ||
... | ... | public: | |
73 | 84 | // Member Functions | // Member Functions |
74 | 85 | ||
75 | 86 | //- Moment of the daughter distribution function | //- Moment of the daughter distribution function |
76 | virtual tmp<volScalarField> mD | ||
87 | virtual scalar mD | ||
77 | 88 | ( | ( |
78 | const label order, | ||
79 | const volScalarField& abscissa | ||
89 | const label& order, | ||
90 | const scalar& abscissa | ||
80 | 91 | ) const; | ) const; |
81 | 92 | ||
82 | 93 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/diffusionModel/diffusionModel.H changed (mode: 100644) (index 7b59158..d55cd78) | |||
... | ... | Class | |
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Abstract class for turbulent diffusion models. | Abstract class for turbulent diffusion models. |
29 | |||
29 | |||
30 | 30 | SourceFiles | SourceFiles |
31 | 31 | diffusionModel.C | diffusionModel.C |
32 | 32 | ||
... | ... | namespace populationBalanceSubModels | |
53 | 53 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
54 | 54 | ||
55 | 55 | class diffusionModel | class diffusionModel |
56 | { | ||
56 | { | ||
57 | 57 | // Private member functions | // Private member functions |
58 | 58 | ||
59 | 59 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
... | ... | public: | |
108 | 108 | ||
109 | 109 | // Member Functions | // Member Functions |
110 | 110 | ||
111 | //- Return the source term for diffusion term in the moment equation | ||
111 | //- Return the source term for diffusion term in the moment equation | ||
112 | 112 | virtual tmp<fvScalarMatrix> momentDiff | virtual tmp<fvScalarMatrix> momentDiff |
113 | 113 | ( | ( |
114 | 114 | const volScalarField& moment | const volScalarField& moment |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/molecularDiffusion/molecularDiffusion.H changed (mode: 100644) (index 8fbdd6e..a769f9f) | |||
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Molecular diffusion model. | Molecular diffusion model. |
29 | 29 | ||
30 | The moment diffusion is modeled with a constant diffusion coefficient | ||
31 | specified by the user. | ||
32 | |||
33 | \f[ | ||
34 | \mathcal{D}_k = \nabla \cdot \left( \Gamma_l | ||
35 | \nabla m_k \right) | ||
36 | \f] | ||
37 | |||
38 | where | ||
39 | |||
40 | \vartable | ||
41 | \mathcal{D}_k | Diffusion term in the moment transport equation | ||
42 | m_k | Moment of order k [-] | ||
43 | \Gamma_l | Molecular diffusivity [m2/s] | ||
44 | \endvartable | ||
45 | |||
30 | 46 | SourceFiles | SourceFiles |
31 | 47 | molecularDiffusion.C | molecularDiffusion.C |
32 | 48 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/diffusionModels/turbulentDiffusion/turbulentDiffusion.H changed (mode: 100644) (index 456356b..53ce8d5) | |||
... | ... | Class | |
27 | 27 | Description | Description |
28 | 28 | Turbulent diffusion model. | Turbulent diffusion model. |
29 | 29 | ||
30 | The moment diffusion is modeled as | ||
31 | |||
32 | \f[ | ||
33 | \mathcal{D}_k = \nabla \cdot \left[ \left( \Gamma_l | ||
34 | + \frac{\mu_t}{Sc_t} \right) \nabla m_k \right] | ||
35 | \f] | ||
36 | |||
37 | where | ||
38 | |||
39 | \vartable | ||
40 | \mathcal{D}_k | Diffusion term in the moment transport equation | ||
41 | m_k | Moment of order k [-] | ||
42 | Sc_t | Turbulent Schmidt number [-] | ||
43 | \Gamma_l | Molecular diffusivity [m2/s] | ||
44 | \mu_t | Turbulent dynamic viscosity [m2/s] | ||
45 | \endvartable | ||
46 | |||
30 | 47 | SourceFiles | SourceFiles |
31 | 48 | turbulentDiffusion.C | turbulentDiffusion.C |
32 | 49 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.C changed (mode: 100644) (index 251af0f..7e3e0aa) | |||
5 | 5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | \\ / A nd | Copyright (C) 2015 Matteo Icardi |
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 2017-03-28 Alberto Passalacqua: Adapted to single scalar calculation. | ||
9 | ------------------------------------------------------------------------------- | ||
8 | 10 | License | License |
9 | 11 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
10 | 12 | ||
... | ... | Foam::populationBalanceSubModels::growthModels::constantGrowth | |
70 | 72 | ||
71 | 73 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
72 | 74 | ||
73 | Foam::tmp<Foam::volScalarField> | ||
75 | Foam::scalar | ||
74 | 76 | Foam::populationBalanceSubModels::growthModels::constantGrowth::Kg | Foam::populationBalanceSubModels::growthModels::constantGrowth::Kg |
75 | 77 | ( | ( |
76 | const volScalarField& abscissa | ||
78 | const scalar& abscissa | ||
77 | 79 | ) const | ) const |
78 | 80 | { | { |
79 | dimensionedScalar oneAbs | ||
80 | ( | ||
81 | "oneAbs", | ||
82 | dimVolume/sqr(abscissa.dimensions()), | ||
83 | 1.0 | ||
84 | ); | ||
85 | |||
86 | return Cg_*pos(-abscissa + maxAbscissa_) | ||
87 | *pos(abscissa - minAbscissa_)*oneAbs; | ||
81 | return Cg_.value()*pos0(-abscissa + maxAbscissa_.value()) | ||
82 | *pos0(abscissa - minAbscissa_.value()); | ||
88 | 83 | } | } |
89 | 84 | ||
90 | 85 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/constantGrowth/constantGrowth.H changed (mode: 100644) (index 5cebb84..ba3b3ee) | |||
5 | 5 | \\ / A nd | Copyright (C) 2015 Matteo Icardi | \\ / A nd | Copyright (C) 2015 Matteo Icardi |
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 2017-03-28 Alberto Passalacqua: Adapted to single scalar calculation. | ||
9 | ------------------------------------------------------------------------------- | ||
8 | 10 | License | License |
9 | 11 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
10 | 12 | ||
... | ... | Class | |
26 | 28 | ||
27 | 29 | Description | Description |
28 | 30 | Constant growth model. The value of the constant is read from dictionary | Constant growth model. The value of the constant is read from dictionary |
29 | or assumed equal to 1. The minimum and maximum value of the abscissa to which the | ||
30 | model is applied can be defined by the user or it is assumed to be 1e-10 and 1e10. | ||
31 | or assumed equal to 1. The minimum and maximum value of the abscissa to | ||
32 | which the model is applied can be defined by the user or it is assumed to | ||
33 | be 1.0e-10 and 1.0e10. | ||
31 | 34 | ||
32 | 35 | SourceFiles | SourceFiles |
33 | 36 | constantGrowth.C | constantGrowth.C |
... | ... | class constantGrowth | |
57 | 60 | public growthModel | public growthModel |
58 | 61 | { | { |
59 | 62 | private: | private: |
60 | |||
63 | |||
61 | 64 | // Private data | // Private data |
62 | 65 | ||
63 | 66 | //- Minimum value of the abscissa to apply the model | //- Minimum value of the abscissa to apply the model |
... | ... | private: | |
65 | 68 | ||
66 | 69 | //- Maximum value of the abscissa to apply the model | //- Maximum value of the abscissa to apply the model |
67 | 70 | dimensionedScalar maxAbscissa_; | dimensionedScalar maxAbscissa_; |
68 | |||
71 | |||
69 | 72 | public: | public: |
70 | 73 | ||
71 | 74 | //- Runtime type information | //- Runtime type information |
... | ... | public: | |
85 | 88 | // Member Functions | // Member Functions |
86 | 89 | ||
87 | 90 | //- Growth model | //- Growth model |
88 | virtual tmp<volScalarField> Kg | ||
91 | virtual scalar Kg | ||
89 | 92 | ( | ( |
90 | const volScalarField& abscissa | ||
93 | const scalar& abscissa | ||
91 | 94 | ) const; | ) const; |
92 | 95 | ||
93 | 96 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/growthModel.C changed (mode: 100644) (index 3cf48db..6a1bb1e) | |||
... | ... | Foam::populationBalanceSubModels::growthModel::growthModel | |
50 | 50 | ( | ( |
51 | 51 | dict.lookupOrDefault | dict.lookupOrDefault |
52 | 52 | ( | ( |
53 | "Cg", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
53 | "Cg", | ||
54 | dimensionedScalar("one", inv(dimTime), 1.0) | ||
55 | 55 | ) | ) |
56 | 56 | ) | ) |
57 | 57 | {} | {} |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/growthModels/growthModel/growthModel.H changed (mode: 100644) (index e4f4e1b..0df84c1) | |||
... | ... | Class | |
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Abstract class for growth model. | Abstract class for growth model. |
29 | |||
29 | |||
30 | 30 | SourceFiles | SourceFiles |
31 | 31 | growthModel.C | growthModel.C |
32 | 32 | ||
... | ... | namespace populationBalanceSubModels | |
52 | 52 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
53 | 53 | ||
54 | 54 | class growthModel | class growthModel |
55 | { | ||
55 | { | ||
56 | 56 | // Private member functions | // Private member functions |
57 | 57 | ||
58 | 58 | //- Disallow default bitwise copy construct | //- Disallow default bitwise copy construct |
... | ... | public: | |
111 | 111 | // Member Functions | // Member Functions |
112 | 112 | ||
113 | 113 | //- Growth model | //- Growth model |
114 | virtual tmp<volScalarField> Kg | ||
114 | virtual scalar Kg | ||
115 | 115 | ( | ( |
116 | const volScalarField& abscissa | ||
116 | const scalar& abscissa | ||
117 | 117 | ) const = 0; | ) const = 0; |
118 | 118 | }; | }; |
119 | 119 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/Miller/Miller.C changed (mode: 100644) (index adbb5f0..d7913f1) | |||
... | ... | License | |
25 | 25 | ||
26 | 26 | #include "Miller.H" | #include "Miller.H" |
27 | 27 | #include "addToRunTimeSelectionTable.H" | #include "addToRunTimeSelectionTable.H" |
28 | #include "turbulentFluidThermoModel.H" | ||
29 | 28 | #include "fundamentalConstants.H" | #include "fundamentalConstants.H" |
30 | 29 | ||
31 | 30 | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // |
... | ... | Foam::populationBalanceSubModels::nucleationModels::Miller::Miller | |
73 | 72 | IOobject::AUTO_WRITE | IOobject::AUTO_WRITE |
74 | 73 | ), | ), |
75 | 74 | mesh | mesh |
76 | ) | ||
75 | ), | ||
76 | flThermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)), | ||
77 | T_(flThermo_.T()) | ||
77 | 78 | {} | {} |
78 | 79 | ||
79 | 80 | ||
... | ... | Foam::populationBalanceSubModels::nucleationModels::Miller::~Miller() | |
85 | 86 | ||
86 | 87 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
87 | 88 | ||
88 | Foam::tmp<Foam::volScalarField> | ||
89 | Foam::populationBalanceSubModels::nucleationModels::Miller | ||
90 | ::nucleationSource(const volUnivariateMoment& moment) const | ||
89 | Foam::scalar | ||
90 | Foam::populationBalanceSubModels::nucleationModels::Miller::nucleationSource | ||
91 | ( | ||
92 | const label& momentOrder, | ||
93 | const label celli | ||
94 | ) const | ||
91 | 95 | { | { |
92 | const fluidThermo& flThermo = | ||
93 | mesh_.lookupObject<fluidThermo>(basicThermo::dictName); | ||
96 | scalar NA = Foam::constant::physicoChemical::NA.value(); | ||
97 | scalar MCarbon = MCarbon_.value(); | ||
94 | 98 | ||
95 | dimensionedScalar abscissaNucleation = | ||
96 | 2.0*MCarbon_*nCarbonDimer_ | ||
97 | /(rhoSoot_*Foam::constant::physicoChemical::NA); | ||
99 | scalar abscissaNucleation = | ||
100 | 2.0*MCarbon*nCarbonDimer_.value()/(rhoSoot_.value()*NA); | ||
98 | 101 | ||
99 | 102 | return 4.4*sqrt(Foam::constant::mathematical::pi | return 4.4*sqrt(Foam::constant::mathematical::pi |
100 | *Foam::constant::physicoChemical::k*flThermo.T() | ||
101 | *Foam::constant::physicoChemical::NA | ||
102 | /nCarbonPAM_*MCarbon_)*Foam::pow(6.0*nCarbonPAM_*MCarbon_ | ||
103 | /(Foam::constant::mathematical::pi*rhoSoot_ | ||
104 | *Foam::constant::physicoChemical::NA), 2.0/3.0) | ||
105 | *Foam::constant::physicoChemical::NA*sqr(pamConcentration_) | ||
106 | *Foam::pow(abscissaNucleation, moment.order()); | ||
103 | *Foam::constant::physicoChemical::k.value()*T_[celli]*NA | ||
104 | /nCarbonPAM_.value()*MCarbon)*pow(6.0*nCarbonPAM_.value()*MCarbon | ||
105 | /(Foam::constant::mathematical::pi*rhoSoot_.value() | ||
106 | *NA), 2.0/3.0)*NA*sqr(pamConcentration_[celli]) | ||
107 | *pow(abscissaNucleation, momentOrder); | ||
107 | 108 | } | } |
108 | 109 | ||
109 | 110 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/Miller/Miller.H changed (mode: 100644) (index a6afb35..59e4897) | |||
... | ... | SourceFiles | |
36 | 36 | #define Miller_H | #define Miller_H |
37 | 37 | ||
38 | 38 | #include "nucleationModel.H" | #include "nucleationModel.H" |
39 | #include "turbulentFluidThermoModel.H" | ||
39 | 40 | ||
40 | 41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 42 | ||
... | ... | private: | |
73 | 74 | //- PAM concentration field | //- PAM concentration field |
74 | 75 | volScalarField pamConcentration_; | volScalarField pamConcentration_; |
75 | 76 | ||
77 | //- Thermodynamic model | ||
78 | const fluidThermo& flThermo_; | ||
79 | |||
80 | //- Temperature field | ||
81 | const volScalarField& T_; | ||
82 | |||
76 | 83 | ||
77 | 84 | public: | public: |
78 | 85 | ||
... | ... | public: | |
97 | 104 | // Member Functions | // Member Functions |
98 | 105 | ||
99 | 106 | //- Growth model | //- Growth model |
100 | virtual tmp<volScalarField> nucleationSource | ||
107 | virtual scalar nucleationSource | ||
101 | 108 | ( | ( |
102 | const volUnivariateMoment& moment | ||
109 | const label& momentOrder, | ||
110 | const label celli | ||
103 | 111 | ) const; | ) const; |
104 | 112 | }; | }; |
105 | 113 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.C changed (mode: 100644) (index 33dfaf4..007c96e) | |||
... | ... | Foam::populationBalanceSubModels::nucleationModels::noNucleation::noNucleation | |
62 | 62 | ||
63 | 63 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
64 | 64 | ||
65 | Foam::populationBalanceSubModels::nucleationModels::noNucleation::~noNucleation() | ||
65 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | ||
66 | ::~noNucleation() | ||
66 | 67 | {} | {} |
67 | 68 | ||
68 | 69 | ||
69 | 70 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
70 | 71 | ||
71 | Foam::tmp<Foam::volScalarField> | ||
72 | Foam::scalar | ||
72 | 73 | Foam::populationBalanceSubModels::nucleationModels::noNucleation | Foam::populationBalanceSubModels::nucleationModels::noNucleation |
73 | ::nucleationSource(const volUnivariateMoment& moment) const | ||
74 | ::nucleationSource | ||
75 | ( | ||
76 | const label& momentOrder, | ||
77 | const label celli | ||
78 | ) const | ||
74 | 79 | { | { |
75 | tmp<volScalarField> noNucl | ||
76 | ( | ||
77 | new volScalarField | ||
78 | ( | ||
79 | IOobject | ||
80 | ( | ||
81 | "noNucl", | ||
82 | moment.mesh().time().timeName(), | ||
83 | moment.mesh(), | ||
84 | IOobject::NO_READ, | ||
85 | IOobject::NO_WRITE, | ||
86 | false | ||
87 | ), | ||
88 | moment.mesh(), | ||
89 | dimensionedScalar("zero", moment.dimensions()/dimTime, 0.0) | ||
90 | ) | ||
91 | ); | ||
92 | |||
93 | return noNucl; | ||
80 | return 0.0; | ||
94 | 81 | } | } |
95 | 82 | ||
96 | 83 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/noNucleation/noNucleation.H changed (mode: 100644) (index 9bb0132..8a1996c) | |||
... | ... | public: | |
77 | 77 | // Member Functions | // Member Functions |
78 | 78 | ||
79 | 79 | //- Growth model | //- Growth model |
80 | virtual tmp<volScalarField> nucleationSource | ||
80 | virtual scalar nucleationSource | ||
81 | 81 | ( | ( |
82 | const volUnivariateMoment& moment | ||
82 | const label& momentOrder, | ||
83 | const label celli | ||
83 | 84 | ) const; | ) const; |
84 | 85 | }; | }; |
85 | 86 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/populationBalanceSubModels/nucleationModels/nucleationModel/nucleationModel.H changed (mode: 100644) (index e6a90d3..ed05c40) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | public: | |
118 | 118 | // Member Functions | // Member Functions |
119 | 119 | ||
120 | 120 | //- Nucleation rate | //- Nucleation rate |
121 | virtual tmp<volScalarField> nucleationSource | ||
121 | virtual scalar nucleationSource | ||
122 | 122 | ( | ( |
123 | const volUnivariateMoment& moment | ||
123 | const label& momentOrder, | ||
124 | const label celli | ||
124 | 125 | ) const = 0; | ) const = 0; |
125 | 126 | }; | }; |
126 | 127 |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.C changed (mode: 100644) (index 4fc3768..6315679) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
52 | 52 | ( | ( |
53 | 53 | const word& name, | const word& name, |
54 | 54 | const dictionary& dict, | const dictionary& dict, |
55 | const volVectorField& U, | ||
56 | 55 | const surfaceScalarField& phi | const surfaceScalarField& phi |
57 | 56 | ) | ) |
58 | 57 | : | : |
59 | univariatePDFTransportModel(name, dict, U.mesh(), U, phi, "RPlus"), | ||
60 | populationBalanceModel(name, dict, U, phi), | ||
58 | univariatePDFTransportModel(name, dict, phi.mesh(), phi, "RPlus"), | ||
59 | populationBalanceModel(name, dict, phi), | ||
61 | 60 | name_(name), | name_(name), |
62 | 61 | aggregation_(dict.lookup("aggregation")), | aggregation_(dict.lookup("aggregation")), |
63 | coalescence_(dict.lookup("coalescence")), | ||
64 | 62 | breakup_(dict.lookup("breakup")), | breakup_(dict.lookup("breakup")), |
65 | 63 | growth_(dict.lookup("growth")), | growth_(dict.lookup("growth")), |
66 | 64 | aggregationKernel_ | aggregationKernel_ |
67 | 65 | ( | ( |
68 | 66 | Foam::populationBalanceSubModels::aggregationKernel::New | Foam::populationBalanceSubModels::aggregationKernel::New |
69 | 67 | ( | ( |
70 | dict.subDict("aggregationKernel") | ||
71 | ) | ||
72 | ), | ||
73 | coalescenceKernel_ | ||
74 | ( | ||
75 | Foam::populationBalanceSubModels::coalescenceKernel::New | ||
76 | ( | ||
77 | dict.subDict("coalescenceKernel"), | ||
78 | U.mesh(), | ||
79 | U | ||
68 | dict.subDict("aggregationKernel"), | ||
69 | phi_.mesh() | ||
80 | 70 | ) | ) |
81 | 71 | ), | ), |
82 | 72 | breakupKernel_ | breakupKernel_ |
83 | 73 | ( | ( |
84 | 74 | Foam::populationBalanceSubModels::breakupKernel::New | Foam::populationBalanceSubModels::breakupKernel::New |
85 | 75 | ( | ( |
86 | dict.subDict("breakupKernel") | ||
76 | dict.subDict("breakupKernel"), | ||
77 | phi_.mesh() | ||
87 | 78 | ) | ) |
88 | 79 | ), | ), |
89 | 80 | daughterDistribution_ | daughterDistribution_ |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
112 | 103 | Foam::populationBalanceSubModels::nucleationModel::New | Foam::populationBalanceSubModels::nucleationModel::New |
113 | 104 | ( | ( |
114 | 105 | dict.subDict("nucleationModel"), | dict.subDict("nucleationModel"), |
115 | U.mesh() | ||
106 | phi_.mesh() | ||
116 | 107 | ) | ) |
117 | 108 | ) | ) |
118 | 109 | {} | {} |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
127 | 118 | ||
128 | 119 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // |
129 | 120 | ||
130 | Foam::tmp<Foam::volScalarField> | ||
121 | Foam::scalar | ||
131 | 122 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
132 | 123 | ::aggregationSource | ::aggregationSource |
133 | 124 | ( | ( |
134 | const volUnivariateMoment& moment | ||
125 | const label& momentOrder, | ||
126 | const label& celli | ||
135 | 127 | ) | ) |
136 | 128 | { | { |
137 | tmp<volScalarField> aSource | ||
138 | ( | ||
139 | new volScalarField | ||
140 | ( | ||
141 | IOobject | ||
142 | ( | ||
143 | "aSource", | ||
144 | U_.mesh().time().timeName(), | ||
145 | U_.mesh(), | ||
146 | IOobject::NO_READ, | ||
147 | IOobject::NO_WRITE, | ||
148 | false | ||
149 | ), | ||
150 | U_.mesh(), | ||
151 | dimensionedScalar("zero", dimless, 0.0) | ||
152 | ) | ||
153 | ); | ||
129 | scalar aSource = 0.0; | ||
154 | 130 | ||
155 | 131 | if (!aggregation_) | if (!aggregation_) |
156 | 132 | { | { |
157 | aSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
158 | |||
159 | 133 | return aSource; | return aSource; |
160 | 134 | } | } |
161 | 135 | ||
162 | label order = moment.order(); | ||
163 | |||
164 | volScalarField& aggregationSource = aSource.ref(); | ||
136 | const PtrList<volScalarNode>& nodes = quadrature_.nodes(); | ||
165 | 137 | ||
166 | forAll(quadrature_.nodes(), pNode1i) | ||
138 | if (!nodes[0].extended()) // Non-extended quadrature case | ||
167 | 139 | { | { |
168 | const extendedVolScalarNode& node1 = quadrature_.nodes()[pNode1i]; | ||
169 | |||
170 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
171 | |||
172 | forAll(node1.secondaryWeights(), sNode1i) | ||
140 | forAll(nodes, pNode1i) | ||
173 | 141 | { | { |
174 | const volScalarField& sWeight1 = node1.secondaryWeights()[sNode1i]; | ||
142 | const volScalarNode& node1 = nodes[pNode1i]; | ||
143 | const volScalarField& pWeight1 = node1.primaryWeight(); | ||
144 | const volScalarField& pAbscissa1 = node1.primaryAbscissa(); | ||
175 | 145 | ||
176 | const volScalarField& sAbscissa1 | ||
177 | = node1.secondaryAbscissae()[sNode1i]; | ||
178 | |||
179 | forAll(quadrature_.nodes(), pNode2i) | ||
146 | forAll(nodes, pNode2i) | ||
180 | 147 | { | { |
181 | const extendedVolScalarNode& node2 = quadrature_.nodes()[pNode2i]; | ||
182 | |||
148 | const volScalarNode& node2 = nodes[pNode2i]; | ||
183 | 149 | const volScalarField& pWeight2 = node2.primaryWeight(); | const volScalarField& pWeight2 = node2.primaryWeight(); |
150 | const volScalarField& pAbscissa2 = node2.primaryAbscissa(); | ||
184 | 151 | ||
185 | forAll(node2.secondaryWeights(), sNode2i) | ||
186 | { | ||
187 | const volScalarField& sWeight2 | ||
188 | = node2.secondaryWeights()[sNode2i]; | ||
189 | |||
190 | const volScalarField& sAbscissa2 | ||
191 | = node2.secondaryAbscissae()[sNode2i]; | ||
192 | |||
193 | tmp<volScalarField> aggInnerSum = | ||
194 | pWeight1*sWeight1* | ||
152 | aSource += | ||
153 | pWeight1[celli]* | ||
154 | ( | ||
155 | pWeight2[celli]* | ||
195 | 156 | ( | ( |
196 | pWeight2*sWeight2* | ||
157 | 0.5*pow // Birth | ||
197 | 158 | ( | ( |
198 | 0.5*pow // Birth | ||
199 | ( | ||
200 | pow3(sAbscissa1) + pow3(sAbscissa2), | ||
201 | order/3.0 | ||
202 | ) | ||
203 | - Foam::pow(sAbscissa1, order) | ||
204 | )*aggregationKernel_->Ka(sAbscissa1, sAbscissa2) | ||
205 | ); | ||
206 | |||
207 | aggregationSource.dimensions().reset | ||
208 | ( | ||
209 | aggInnerSum().dimensions() | ||
159 | pow3(pAbscissa1[celli]) | ||
160 | + pow3(pAbscissa2[celli]), | ||
161 | momentOrder/3.0 | ||
162 | ) | ||
163 | - pow(pAbscissa1[celli], momentOrder) | ||
164 | )*aggregationKernel_->Ka | ||
165 | ( | ||
166 | pAbscissa1[celli], pAbscissa2[celli], celli | ||
167 | ) | ||
210 | 168 | ); | ); |
211 | |||
212 | aggregationSource == aggregationSource + aggInnerSum(); | ||
213 | } | ||
214 | 169 | } | } |
215 | 170 | } | } |
216 | } | ||
217 | |||
218 | return aSource; | ||
219 | } | ||
220 | 171 | ||
221 | Foam::tmp<Foam::volScalarField> | ||
222 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | ||
223 | ::coalescenceSource | ||
224 | ( | ||
225 | const volUnivariateMoment& moment | ||
226 | ) | ||
227 | { | ||
228 | tmp<volScalarField> cSource | ||
229 | ( | ||
230 | new volScalarField | ||
231 | ( | ||
232 | IOobject | ||
233 | ( | ||
234 | "cSource", | ||
235 | U_.mesh().time().timeName(), | ||
236 | U_.mesh(), | ||
237 | IOobject::NO_READ, | ||
238 | IOobject::NO_WRITE, | ||
239 | false | ||
240 | ), | ||
241 | U_.mesh(), | ||
242 | dimensionedScalar("zero", dimless, 0.0) | ||
243 | ) | ||
244 | ); | ||
245 | |||
246 | if (!coalescence_) | ||
247 | { | ||
248 | cSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
249 | |||
250 | return cSource; | ||
172 | return aSource; | ||
251 | 173 | } | } |
252 | 174 | ||
253 | label order = moment.order(); | ||
254 | |||
255 | volScalarField& coalescenceSource = cSource.ref(); | ||
256 | |||
257 | forAll(quadrature_.nodes(), pNode1i) | ||
175 | forAll(nodes, pNode1i) // Extended quadrature case | ||
258 | 176 | { | { |
259 | const extendedVolScalarNode& node1 = quadrature_.nodes()[pNode1i]; | ||
260 | |||
177 | const volScalarNode& node1 = nodes[pNode1i]; | ||
261 | 178 | const volScalarField& pWeight1 = node1.primaryWeight(); | const volScalarField& pWeight1 = node1.primaryWeight(); |
262 | 179 | ||
263 | 180 | forAll(node1.secondaryWeights(), sNode1i) | forAll(node1.secondaryWeights(), sNode1i) |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
267 | 184 | const volScalarField& sAbscissa1 | const volScalarField& sAbscissa1 |
268 | 185 | = node1.secondaryAbscissae()[sNode1i]; | = node1.secondaryAbscissae()[sNode1i]; |
269 | 186 | ||
270 | forAll(quadrature_.nodes(), pNode2i) | ||
187 | forAll(nodes, pNode2i) | ||
271 | 188 | { | { |
272 | const extendedVolScalarNode& node2 = quadrature_.nodes()[pNode2i]; | ||
273 | |||
189 | const volScalarNode& node2 = nodes[pNode2i]; | ||
274 | 190 | const volScalarField& pWeight2 = node2.primaryWeight(); | const volScalarField& pWeight2 = node2.primaryWeight(); |
275 | 191 | ||
276 | 192 | forAll(node2.secondaryWeights(), sNode2i) | forAll(node2.secondaryWeights(), sNode2i) |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
281 | 197 | const volScalarField& sAbscissa2 | const volScalarField& sAbscissa2 |
282 | 198 | = node2.secondaryAbscissae()[sNode2i]; | = node2.secondaryAbscissae()[sNode2i]; |
283 | 199 | ||
284 | tmp<volScalarField> coalescenceInnerSum = | ||
285 | pWeight1*sWeight1* | ||
200 | aSource += | ||
201 | pWeight1[celli]*sWeight1[celli]* | ||
286 | 202 | ( | ( |
287 | pWeight2*sWeight2* | ||
203 | pWeight2[celli]*sWeight2[celli]* | ||
288 | 204 | ( | ( |
289 | 205 | 0.5*pow // Birth | 0.5*pow // Birth |
290 | 206 | ( | ( |
291 | pow3(sAbscissa1) + pow3(sAbscissa2), | ||
292 | order/3.0 | ||
207 | pow3(sAbscissa1[celli]) | ||
208 | + pow3(sAbscissa2[celli]), | ||
209 | momentOrder/3.0 | ||
210 | ) | ||
211 | - pow(sAbscissa1[celli], momentOrder) | ||
212 | )*aggregationKernel_->Ka | ||
213 | ( | ||
214 | sAbscissa1[celli], sAbscissa2[celli], celli | ||
293 | 215 | ) | ) |
294 | - Foam::pow(sAbscissa1, order) | ||
295 | )*coalescenceKernel_->Ka(sAbscissa1, sAbscissa2) | ||
296 | 216 | ); | ); |
297 | |||
298 | coalescenceSource.dimensions().reset | ||
299 | ( | ||
300 | coalescenceInnerSum().dimensions() | ||
301 | ); | ||
302 | |||
303 | coalescenceSource == coalescenceSource + coalescenceInnerSum(); | ||
304 | 217 | } | } |
305 | 218 | } | } |
306 | 219 | } | } |
307 | 220 | } | } |
308 | 221 | ||
309 | return cSource; | ||
222 | return aSource; | ||
310 | 223 | } | } |
311 | 224 | ||
312 | Foam::tmp<Foam::volScalarField> | ||
225 | Foam::scalar | ||
313 | 226 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
314 | 227 | ::breakupSource | ::breakupSource |
315 | 228 | ( | ( |
316 | const volUnivariateMoment& moment | ||
229 | const label& momentOrder, | ||
230 | const label& celli | ||
317 | 231 | ) | ) |
318 | 232 | { | { |
319 | tmp<volScalarField> bSource | ||
320 | ( | ||
321 | new volScalarField | ||
322 | ( | ||
323 | IOobject | ||
324 | ( | ||
325 | "bSource", | ||
326 | U_.mesh().time().timeName(), | ||
327 | U_.mesh(), | ||
328 | IOobject::NO_READ, | ||
329 | IOobject::NO_WRITE, | ||
330 | false | ||
331 | ), | ||
332 | U_.mesh(), | ||
333 | dimensionedScalar("zero", dimless, 0.0) | ||
334 | ) | ||
335 | ); | ||
233 | scalar bSource = 0.0; | ||
336 | 234 | ||
337 | 235 | if (!breakup_) | if (!breakup_) |
338 | 236 | { | { |
339 | bSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
340 | |||
341 | 237 | return bSource; | return bSource; |
342 | 238 | } | } |
343 | 239 | ||
344 | label order = moment.order(); | ||
240 | const PtrList<volScalarNode>& nodes = quadrature_.nodes(); | ||
345 | 241 | ||
346 | volScalarField& breakupSource = bSource.ref(); | ||
242 | if (!nodes[0].extended()) | ||
243 | { | ||
244 | forAll(nodes, pNodeI) | ||
245 | { | ||
246 | const volScalarNode& node = nodes[pNodeI]; | ||
347 | 247 | ||
348 | forAll(quadrature_.nodes(), pNodeI) | ||
248 | bSource += node.primaryWeight()[celli] | ||
249 | *breakupKernel_->Kb(node.primaryAbscissa()[celli], celli) | ||
250 | *( | ||
251 | daughterDistribution_->mD //Birth | ||
252 | ( | ||
253 | momentOrder, | ||
254 | node.primaryAbscissa()[celli] | ||
255 | ) | ||
256 | - pow(node.primaryAbscissa()[celli], momentOrder) //Death | ||
257 | ); | ||
258 | } | ||
259 | |||
260 | return bSource; | ||
261 | } | ||
262 | |||
263 | forAll(nodes, pNodeI) | ||
349 | 264 | { | { |
350 | const extendedVolScalarNode& node = quadrature_.nodes()[pNodeI]; | ||
265 | const volScalarNode& node = nodes[pNodeI]; | ||
351 | 266 | ||
352 | 267 | forAll(node.secondaryWeights(), sNodei) | forAll(node.secondaryWeights(), sNodei) |
353 | 268 | { | { |
354 | tmp<volScalarField> bSrc = node.primaryWeight() | ||
355 | *node.secondaryWeights()[sNodei] | ||
356 | *breakupKernel_->Kb(node.secondaryAbscissae()[sNodei]) | ||
269 | bSource += node.primaryWeight()[celli] | ||
270 | *node.secondaryWeights()[sNodei][celli] | ||
271 | *breakupKernel_->Kb | ||
272 | ( | ||
273 | node.secondaryAbscissae()[sNodei][celli], celli | ||
274 | ) | ||
357 | 275 | *( | *( |
358 | 276 | daughterDistribution_->mD //Birth | daughterDistribution_->mD //Birth |
359 | 277 | ( | ( |
360 | order, | ||
361 | node.secondaryAbscissae()[sNodei] | ||
362 | ) | ||
363 | - Foam::pow(node.secondaryAbscissae()[sNodei], order) //Death | ||
278 | momentOrder, | ||
279 | node.secondaryAbscissae()[sNodei][celli] | ||
280 | ) //Death | ||
281 | - pow(node.secondaryAbscissae()[sNodei][celli], momentOrder) | ||
364 | 282 | ); | ); |
365 | |||
366 | breakupSource.dimensions().reset(bSrc().dimensions()); | ||
367 | breakupSource == breakupSource + bSrc; | ||
368 | 283 | } | } |
369 | 284 | } | } |
370 | 285 | ||
... | ... | Foam::tmp<fvScalarMatrix> Foam::PDFTransportModels::populationBalanceModels | |
380 | 295 | return diffusionModel_->momentDiff(moment); | return diffusionModel_->momentDiff(moment); |
381 | 296 | } | } |
382 | 297 | ||
383 | Foam::tmp<Foam::volScalarField> | ||
298 | Foam::scalar | ||
384 | 299 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
385 | 300 | ::phaseSpaceConvection | ::phaseSpaceConvection |
386 | 301 | ( | ( |
387 | const volUnivariateMoment& moment | ||
302 | const label& momentOrder, | ||
303 | const label& celli | ||
388 | 304 | ) | ) |
389 | 305 | { | { |
390 | tmp<volScalarField> gSource | ||
391 | ( | ||
392 | new volScalarField | ||
393 | ( | ||
394 | IOobject | ||
395 | ( | ||
396 | "gSource", | ||
397 | U_.mesh().time().timeName(), | ||
398 | U_.mesh(), | ||
399 | IOobject::NO_READ, | ||
400 | IOobject::NO_WRITE, | ||
401 | false | ||
402 | ), | ||
403 | U_.mesh(), | ||
404 | dimensionedScalar("zero", dimless, 0.0) | ||
405 | ) | ||
406 | ); | ||
306 | scalar gSource = 0.0; | ||
407 | 307 | ||
408 | if (!growth_) | ||
308 | if (!growth_ || momentOrder < 1) | ||
409 | 309 | { | { |
410 | gSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
411 | |||
412 | 310 | return gSource; | return gSource; |
413 | 311 | } | } |
414 | 312 | ||
415 | label order = moment.order(); | ||
313 | const PtrList<volScalarNode>& nodes = quadrature_.nodes(); | ||
416 | 314 | ||
417 | if (order < 1) | ||
315 | if (!nodes[0].extended()) | ||
418 | 316 | { | { |
419 | gSource.ref().dimensions().reset(moment.dimensions()/dimTime); | ||
317 | forAll(nodes, pNodeI) | ||
318 | { | ||
319 | const volScalarNode& node = nodes[pNodeI]; | ||
320 | |||
321 | gSource += node.primaryWeight()[celli] | ||
322 | *growthModel_->Kg(node.primaryAbscissa()[celli]) | ||
323 | *momentOrder*pow | ||
324 | ( | ||
325 | node.primaryAbscissa()[celli], momentOrder - 1 | ||
326 | ); | ||
327 | } | ||
420 | 328 | ||
421 | 329 | return gSource; | return gSource; |
422 | 330 | } | } |
423 | 331 | ||
424 | volScalarField& growthSource = gSource.ref(); | ||
425 | |||
426 | forAll(quadrature_.nodes(), pNodeI) | ||
332 | forAll(nodes, pNodeI) | ||
427 | 333 | { | { |
428 | const extendedVolScalarNode& node = quadrature_.nodes()[pNodeI]; | ||
334 | const volScalarNode& node = nodes[pNodeI]; | ||
429 | 335 | ||
430 | 336 | forAll(node.secondaryWeights(), sNodei) | forAll(node.secondaryWeights(), sNodei) |
431 | 337 | { | { |
432 | tmp<volScalarField> gSrc = node.primaryWeight() | ||
433 | *node.secondaryWeights()[sNodei] | ||
434 | *growthModel_->Kg(node.secondaryAbscissae()[sNodei]) | ||
435 | *order*Foam::pow(node.secondaryAbscissae()[sNodei],order-1); | ||
436 | |||
437 | growthSource.dimensions().reset(gSrc().dimensions()); | ||
438 | growthSource == growthSource + gSrc; | ||
338 | gSource += node.primaryWeight()[celli] | ||
339 | *node.secondaryWeights()[sNodei][celli] | ||
340 | *growthModel_->Kg(node.secondaryAbscissae()[sNodei][celli]) | ||
341 | *momentOrder*pow | ||
342 | ( | ||
343 | node.secondaryAbscissae()[sNodei][celli], | ||
344 | momentOrder - 1 | ||
345 | ); | ||
439 | 346 | } | } |
440 | 347 | } | } |
441 | 348 | ||
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
444 | 351 | ||
445 | 352 | Foam::tmp<Foam::fvScalarMatrix> | Foam::tmp<Foam::fvScalarMatrix> |
446 | 353 | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance |
447 | ::momentSource | ||
354 | ::implicitMomentSource | ||
448 | 355 | ( | ( |
449 | 356 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
450 | 357 | ) | ) |
451 | 358 | { | { |
452 | tmp<fvScalarMatrix> mSource | ||
359 | tmp<fvScalarMatrix> impSource | ||
453 | 360 | ( | ( |
454 | 361 | new fvScalarMatrix | new fvScalarMatrix |
455 | 362 | ( | ( |
... | ... | Foam::PDFTransportModels::populationBalanceModels::univariatePopulationBalance | |
458 | 365 | ) | ) |
459 | 366 | ); | ); |
460 | 367 | ||
461 | mSource.ref() += | ||
462 | aggregationSource(moment) | ||
463 | + coalescenceSource(moment) | ||
464 | + breakupSource(moment) | ||
465 | + nucleationModel_->nucleationSource(moment); | ||
368 | // impSource.ref() += | ||
369 | // aggregationSource(moment) + breakupSource(moment) | ||
370 | // + nucleationModel_->nucleationSource(moment); | ||
466 | 371 | ||
467 | return mSource; | ||
372 | return impSource; | ||
373 | } | ||
374 | |||
375 | Foam::scalar Foam::PDFTransportModels::populationBalanceModels | ||
376 | ::univariatePopulationBalance::cellMomentSource | ||
377 | ( | ||
378 | label& momentOrder, | ||
379 | label& celli | ||
380 | ) | ||
381 | { | ||
382 | return aggregationSource(momentOrder, celli) | ||
383 | + breakupSource(momentOrder, celli) | ||
384 | + nucleationModel_->nucleationSource(momentOrder, celli) | ||
385 | + phaseSpaceConvection(momentOrder, celli); | ||
386 | } | ||
387 | |||
388 | Foam::scalar Foam::PDFTransportModels::populationBalanceModels | ||
389 | ::univariatePopulationBalance::realizableCo | ||
390 | () | ||
391 | { | ||
392 | return univariatePDFTransportModel::realizableCo(); | ||
468 | 393 | } | } |
469 | 394 | ||
470 | 395 | void Foam::PDFTransportModels::populationBalanceModels | void Foam::PDFTransportModels::populationBalanceModels |
File multiphaseEulerPbeFoam/quadratureMethods/populationBalanceModels/univariatePopulationBalance/univariatePopulationBalance.H changed (mode: 100644) (index e81b032..b2597b6) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
39 | 39 | #include "univariatePDFTransportModel.H" | #include "univariatePDFTransportModel.H" |
40 | 40 | #include "populationBalanceModel.H" | #include "populationBalanceModel.H" |
41 | 41 | #include "aggregationKernel.H" | #include "aggregationKernel.H" |
42 | #include "coalescenceKernel.H" | ||
43 | 42 | #include "breakupKernel.H" | #include "breakupKernel.H" |
44 | 43 | #include "daughterDistribution.H" | #include "daughterDistribution.H" |
45 | 44 | #include "growthModel.H" | #include "growthModel.H" |
... | ... | class univariatePopulationBalance | |
71 | 70 | //- Switch indicating the status of the aggregation model | //- Switch indicating the status of the aggregation model |
72 | 71 | Switch aggregation_; | Switch aggregation_; |
73 | 72 | ||
74 | //- Switch indicating the status of the coalescence model | ||
75 | Switch coalescence_; | ||
76 | |||
77 | 73 | //- Switch indicating the status of the breakup model | //- Switch indicating the status of the breakup model |
78 | 74 | Switch breakup_; | Switch breakup_; |
79 | 75 | ||
... | ... | class univariatePopulationBalance | |
86 | 82 | Foam::populationBalanceSubModels::aggregationKernel | Foam::populationBalanceSubModels::aggregationKernel |
87 | 83 | > aggregationKernel_; | > aggregationKernel_; |
88 | 84 | ||
89 | //- Coalescence kernel model | ||
90 | autoPtr | ||
91 | < | ||
92 | Foam::populationBalanceSubModels::coalescenceKernel | ||
93 | > coalescenceKernel_; | ||
94 | |||
95 | 85 | //- Breakup kernel model | //- Breakup kernel model |
96 | 86 | autoPtr | autoPtr |
97 | 87 | < | < |
... | ... | class univariatePopulationBalance | |
116 | 106 | Foam::populationBalanceSubModels::diffusionModel | Foam::populationBalanceSubModels::diffusionModel |
117 | 107 | > diffusionModel_; | > diffusionModel_; |
118 | 108 | ||
109 | //- Nucleation model | ||
119 | 110 | autoPtr | autoPtr |
120 | 111 | < | < |
121 | 112 | Foam::populationBalanceSubModels::nucleationModel | Foam::populationBalanceSubModels::nucleationModel |
... | ... | class univariatePopulationBalance | |
124 | 115 | // Private member functions | // Private member functions |
125 | 116 | ||
126 | 117 | //- Calculate aggregation source terms | //- Calculate aggregation source terms |
127 | tmp<volScalarField> aggregationSource | ||
118 | scalar aggregationSource | ||
128 | 119 | ( | ( |
129 | const volUnivariateMoment& moment | ||
120 | const label& momentOrder, | ||
121 | const label& celli | ||
130 | 122 | ); | ); |
131 | 123 | ||
132 | //- Calculate coalescence source terms | ||
133 | tmp<volScalarField> coalescenceSource | ||
124 | //- Calculate Breakup source term | ||
125 | scalar breakupSource | ||
134 | 126 | ( | ( |
135 | const volUnivariateMoment& moment | ||
127 | const label& momentOrder, | ||
128 | const label& celli | ||
136 | 129 | ); | ); |
137 | 130 | ||
138 | //- Calculate Breakup source term | ||
139 | tmp<volScalarField> breakupSource(const volUnivariateMoment& moment); | ||
140 | |||
141 | 131 | //- Diffusion term | //- Diffusion term |
142 | 132 | virtual tmp<fvScalarMatrix> momentDiffusion | virtual tmp<fvScalarMatrix> momentDiffusion |
143 | 133 | ( | ( |
... | ... | class univariatePopulationBalance | |
145 | 135 | ); | ); |
146 | 136 | ||
147 | 137 | //- Convect moments in phase space | //- Convect moments in phase space |
148 | virtual tmp<volScalarField> phaseSpaceConvection | ||
138 | virtual scalar phaseSpaceConvection | ||
149 | 139 | ( | ( |
150 | const volUnivariateMoment& moment | ||
140 | const label& momentOrder, | ||
141 | const label& celli | ||
151 | 142 | ); | ); |
152 | 143 | ||
153 | //- Calculate source terms | ||
154 | virtual tmp<fvScalarMatrix> momentSource | ||
144 | //- Calculate implicit source terms | ||
145 | virtual tmp<fvScalarMatrix> implicitMomentSource | ||
155 | 146 | ( | ( |
156 | 147 | const volUnivariateMoment& moment | const volUnivariateMoment& moment |
157 | 148 | ); | ); |
158 | 149 | ||
150 | //- Calculate source term for moment equation in the specified cell | ||
151 | virtual scalar cellMomentSource | ||
152 | ( | ||
153 | label& momentOrder, | ||
154 | label& celli | ||
155 | ); | ||
159 | 156 | ||
160 | 157 | public: | public: |
161 | 158 | ||
... | ... | public: | |
170 | 167 | ( | ( |
171 | 168 | const word& name, | const word& name, |
172 | 169 | const dictionary& dict, | const dictionary& dict, |
173 | const volVectorField& U, | ||
174 | 170 | const surfaceScalarField& phi | const surfaceScalarField& phi |
175 | 171 | ); | ); |
176 | 172 | ||
... | ... | public: | |
180 | 176 | ||
181 | 177 | // Member Functions | // Member Functions |
182 | 178 | ||
179 | //- Return the maximum Courant number ensuring moment realizability | ||
180 | scalar realizableCo(); | ||
181 | |||
183 | 182 | //- Solve population balance equation | //- Solve population balance equation |
184 | 183 | void solve(); | void solve(); |
185 | 184 | }; | }; |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/Make/files deleted (index 655c0ad..0000000) | |||
1 | univariateQuadratureApproximation/univariateQuadratureApproximation.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libquadratureApproximation |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximation.C deleted (index 4ca7cbf..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work of OpenFOAM. | ||
10 | |||
11 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
12 | under the terms of the GNU General Public License as published by | ||
13 | the Free Software Foundation, either version 3 of the License, or | ||
14 | (at your option) any later version. | ||
15 | |||
16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
19 | for more details. | ||
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | \*---------------------------------------------------------------------------*/ | ||
25 | |||
26 | #include "univariateQuadratureApproximation.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // | ||
29 | |||
30 | |||
31 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
32 | |||
33 | Foam::univariateQuadratureApproximation::univariateQuadratureApproximation | ||
34 | ( | ||
35 | const word& name, | ||
36 | const fvMesh& mesh, | ||
37 | const word& support | ||
38 | ) | ||
39 | : | ||
40 | IOdictionary | ||
41 | ( | ||
42 | IOobject | ||
43 | ( | ||
44 | IOobject::groupName("quadratureProperties", name), | ||
45 | mesh.time().constant(), | ||
46 | mesh, | ||
47 | IOobject::MUST_READ, | ||
48 | IOobject::NO_WRITE | ||
49 | ) | ||
50 | ), | ||
51 | name_(name), | ||
52 | mesh_(mesh), | ||
53 | nodes_(), | ||
54 | nodesRadau_(), | ||
55 | moments_(name_, *this, mesh_, nodes_), | ||
56 | nPrimaryNodes_(0), | ||
57 | nSecondaryNodes_(0), | ||
58 | nNodesRadau_(0), | ||
59 | nodesNei_(), | ||
60 | nodesOwn_(), | ||
61 | nDimensions_(1), | ||
62 | nMoments_(moments_.size()), | ||
63 | momentsNei_ | ||
64 | ( | ||
65 | name_, nMoments_, nodesNei_, nDimensions_, moments_.momentMap() | ||
66 | ), | ||
67 | momentsOwn_ | ||
68 | ( | ||
69 | name_, nMoments_, nodesOwn_, nDimensions_, moments_.momentMap() | ||
70 | ), | ||
71 | momentInverter_(), | ||
72 | support_(support) | ||
73 | { | ||
74 | // Allocating nodes | ||
75 | nodes_ = autoPtr<PtrList<extendedVolScalarNode>> | ||
76 | ( | ||
77 | new PtrList<extendedVolScalarNode> | ||
78 | ( | ||
79 | lookup("nodes"), | ||
80 | Foam::extendedVolScalarNode::iNew | ||
81 | ( | ||
82 | name_, | ||
83 | mesh_, | ||
84 | moments_[0].dimensions(), | ||
85 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
86 | moments_[0].boundaryField().types() | ||
87 | ) | ||
88 | ) | ||
89 | ); | ||
90 | |||
91 | nPrimaryNodes_ = nodes_().size(); | ||
92 | nSecondaryNodes_ = nodes_()[0].nSecondaryNodes(); | ||
93 | |||
94 | if (nMoments_ != 2*nPrimaryNodes_ + 1) | ||
95 | { | ||
96 | FatalErrorInFunction | ||
97 | << "Number of moments from dictionary different from number" << nl | ||
98 | << " of moments calculated from primary quadrature nodes." | ||
99 | << abort(FatalError); | ||
100 | } | ||
101 | |||
102 | nNodesRadau_ = nPrimaryNodes_ + 1; | ||
103 | |||
104 | nodesRadau_ = autoPtr<PtrList<basicVolScalarNode>> | ||
105 | ( | ||
106 | new PtrList<basicVolScalarNode>(nNodesRadau_) | ||
107 | ); | ||
108 | |||
109 | nodesNei_ = autoPtr<PtrList<basicSurfaceScalarNode>> | ||
110 | ( | ||
111 | new PtrList<basicSurfaceScalarNode>(nNodesRadau_) | ||
112 | ); | ||
113 | |||
114 | nodesOwn_ = autoPtr<PtrList<basicSurfaceScalarNode>> | ||
115 | ( | ||
116 | new PtrList<basicSurfaceScalarNode>(nNodesRadau_) | ||
117 | ); | ||
118 | |||
119 | PtrList<basicVolScalarNode>& nodesRadau = nodesRadau_(); | ||
120 | PtrList<basicSurfaceScalarNode>& nodesNei = nodesNei_(); | ||
121 | PtrList<basicSurfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
122 | |||
123 | // Populating Radau and interpolated nodes | ||
124 | forAll(nodesRadau, rNodei) | ||
125 | { | ||
126 | nodesRadau.set | ||
127 | ( | ||
128 | rNodei, | ||
129 | new basicVolScalarNode | ||
130 | ( | ||
131 | "nodeRadau" + Foam::name(rNodei), | ||
132 | name_, | ||
133 | mesh_, | ||
134 | moments_[0].dimensions(), | ||
135 | moments_[1].dimensions()/moments_[0].dimensions() | ||
136 | ) | ||
137 | ); | ||
138 | |||
139 | nodesNei.set | ||
140 | ( | ||
141 | rNodei, | ||
142 | new basicSurfaceScalarNode | ||
143 | ( | ||
144 | "nodeRadau" + Foam::name(rNodei) + "Nei", | ||
145 | name_, | ||
146 | mesh_, | ||
147 | moments_[0].dimensions(), | ||
148 | moments_[1].dimensions()/moments_[0].dimensions() | ||
149 | ) | ||
150 | ); | ||
151 | |||
152 | nodesOwn.set | ||
153 | ( | ||
154 | rNodei, | ||
155 | new basicSurfaceScalarNode | ||
156 | ( | ||
157 | "nodeRadau" + Foam::name(rNodei) + "Own", | ||
158 | name_, | ||
159 | mesh_, | ||
160 | moments_[0].dimensions(), | ||
161 | moments_[1].dimensions()/moments_[0].dimensions() | ||
162 | ) | ||
163 | ); | ||
164 | } | ||
165 | |||
166 | // Setting face values of moments | ||
167 | forAll(momentsNei_, momenti) | ||
168 | { | ||
169 | momentsNei_.set | ||
170 | ( | ||
171 | momenti, | ||
172 | new Foam::basicSurfaceUnivariateMoment | ||
173 | ( | ||
174 | name_, | ||
175 | moments_[momenti].cmptOrders(), | ||
176 | nodesNei_, | ||
177 | fvc::interpolate(moments_[momenti]) | ||
178 | ) | ||
179 | ); | ||
180 | |||
181 | momentsOwn_.set | ||
182 | ( | ||
183 | momenti, | ||
184 | new Foam::basicSurfaceUnivariateMoment | ||
185 | ( | ||
186 | name_, | ||
187 | moments_[momenti].cmptOrders(), | ||
188 | nodesOwn_, | ||
189 | fvc::interpolate(moments_[momenti]) | ||
190 | ) | ||
191 | ); | ||
192 | } | ||
193 | |||
194 | momentInverter_ = autoPtr<Foam::extendedMomentInversion> | ||
195 | ( | ||
196 | Foam::extendedMomentInversion::New | ||
197 | ( | ||
198 | subDict("extendedMomentInversionCoeff"), | ||
199 | nMoments_, | ||
200 | nSecondaryNodes_ | ||
201 | ) | ||
202 | ); | ||
203 | |||
204 | updateQuadrature(); | ||
205 | interpolateNodes(); | ||
206 | updateBoundaryQuadrature(); | ||
207 | momentsNei_.update(); | ||
208 | momentsOwn_.update(); | ||
209 | } | ||
210 | |||
211 | |||
212 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
213 | |||
214 | Foam::univariateQuadratureApproximation::~univariateQuadratureApproximation() | ||
215 | {} | ||
216 | |||
217 | |||
218 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
219 | |||
220 | void Foam::univariateQuadratureApproximation::interpolateNodes() | ||
221 | { | ||
222 | surfaceScalarField nei | ||
223 | ( | ||
224 | IOobject | ||
225 | ( | ||
226 | "nei", | ||
227 | mesh_.time().timeName(), | ||
228 | mesh_ | ||
229 | ), | ||
230 | mesh_, | ||
231 | dimensionedScalar("nei", dimless, -1.0) | ||
232 | ); | ||
233 | |||
234 | surfaceScalarField own | ||
235 | ( | ||
236 | IOobject | ||
237 | ( | ||
238 | "own", | ||
239 | mesh_.time().timeName(), | ||
240 | mesh_ | ||
241 | ), | ||
242 | mesh_, | ||
243 | dimensionedScalar("own", dimless, 1.0) | ||
244 | ); | ||
245 | |||
246 | const PtrList<basicVolScalarNode>& nodesRadau = nodesRadau_(); | ||
247 | PtrList<basicSurfaceScalarNode>& nodesNei = nodesNei_(); | ||
248 | PtrList<basicSurfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
249 | |||
250 | forAll(nodesRadau, rNodei) | ||
251 | { | ||
252 | const basicVolScalarNode& node(nodesRadau[rNodei]); | ||
253 | basicSurfaceScalarNode& nodeNei(nodesNei[rNodei]); | ||
254 | basicSurfaceScalarNode& nodeOwn(nodesOwn[rNodei]); | ||
255 | |||
256 | nodeOwn.primaryWeight() = | ||
257 | fvc::interpolate(node.primaryWeight(), own, "reconstruct(weight)"); | ||
258 | |||
259 | nodeOwn.primaryAbscissa() = | ||
260 | fvc::interpolate | ||
261 | ( | ||
262 | node.primaryAbscissa(), | ||
263 | own, | ||
264 | "reconstruct(abscissa)" | ||
265 | ); | ||
266 | |||
267 | nodeNei.primaryWeight() = | ||
268 | fvc::interpolate(node.primaryWeight(), nei, "reconstruct(weight)"); | ||
269 | |||
270 | nodeNei.primaryAbscissa() = | ||
271 | fvc::interpolate | ||
272 | ( | ||
273 | node.primaryAbscissa(), | ||
274 | nei, | ||
275 | "reconstruct(abscissa)" | ||
276 | ); | ||
277 | } | ||
278 | } | ||
279 | |||
280 | void Foam::univariateQuadratureApproximation::updateBoundaryQuadrature() | ||
281 | { | ||
282 | // Recover reference to boundaryField of zero-order moment. | ||
283 | // All moments will share the same BC types at a given boundary. | ||
284 | const volScalarField::Boundary& bf = moments_().boundaryFieldRef(); | ||
285 | |||
286 | forAll(bf, patchi) | ||
287 | { | ||
288 | const fvPatchScalarField& m0Patch = bf[patchi]; | ||
289 | |||
290 | //if (m0Patch.fixesValue()) | ||
291 | { | ||
292 | forAll(m0Patch, facei) | ||
293 | { | ||
294 | univariateMomentSet momentsToInvert | ||
295 | ( | ||
296 | nMoments_, | ||
297 | 0.0, | ||
298 | "Gauss", | ||
299 | support_ | ||
300 | ); | ||
301 | |||
302 | univariateMomentSet momentsToInvertRadau | ||
303 | ( | ||
304 | nMoments_, | ||
305 | 0.0, | ||
306 | "GaussRadau", | ||
307 | support_ | ||
308 | ); | ||
309 | |||
310 | // Copying moments from a face | ||
311 | forAll(momentsToInvert, momenti) | ||
312 | { | ||
313 | momentsToInvert[momenti] | ||
314 | = moments_[momenti].boundaryField()[patchi][facei]; | ||
315 | |||
316 | momentsToInvertRadau[momenti] = momentsToInvert[momenti]; | ||
317 | } | ||
318 | |||
319 | // Inverting moments for EQMOM | ||
320 | momentInverter_->invert(momentsToInvert); | ||
321 | |||
322 | // Finding Gauss-Radau quadrature | ||
323 | momentsToInvertRadau.invert(); | ||
324 | |||
325 | // Copying quadrature data to boundary face | ||
326 | for (label pNodei = 0; pNodei < nPrimaryNodes_; pNodei++) | ||
327 | { | ||
328 | extendedVolScalarNode& node = nodes_()[pNodei]; | ||
329 | |||
330 | node.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
331 | = momentInverter_->primaryWeights()[pNodei]; | ||
332 | |||
333 | node.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
334 | = momentInverter_->primaryAbscissae()[pNodei]; | ||
335 | |||
336 | node.sigma().boundaryFieldRef()[patchi][facei] | ||
337 | = momentInverter_->sigma(); | ||
338 | |||
339 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
340 | { | ||
341 | node.secondaryWeights()[sNodei].boundaryFieldRef()[patchi][facei] | ||
342 | = momentInverter_->secondaryWeights()[pNodei][sNodei]; | ||
343 | |||
344 | node.secondaryAbscissae()[sNodei].boundaryFieldRef()[patchi][facei] | ||
345 | = momentInverter_->secondaryAbscissae()[pNodei][sNodei]; | ||
346 | } | ||
347 | } | ||
348 | |||
349 | // Copying Radau quadrature data to boundary face | ||
350 | for (label rNodei = 0; rNodei < nNodesRadau_; rNodei++) | ||
351 | { | ||
352 | basicVolScalarNode& nodeRadau = nodesRadau_()[rNodei]; | ||
353 | |||
354 | if (rNodei < momentsToInvertRadau.nNodes()) | ||
355 | { | ||
356 | nodeRadau.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
357 | = momentsToInvertRadau.weights()[rNodei]; | ||
358 | |||
359 | nodeRadau.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
360 | = momentsToInvertRadau.abscissae()[rNodei]; | ||
361 | } | ||
362 | else | ||
363 | { | ||
364 | nodeRadau.primaryWeight().boundaryFieldRef()[patchi][facei] | ||
365 | = 0.0; | ||
366 | |||
367 | nodeRadau.primaryAbscissa().boundaryFieldRef()[patchi][facei] | ||
368 | = 0.0; | ||
369 | } | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | } | ||
374 | } | ||
375 | |||
376 | void Foam::univariateQuadratureApproximation::updateQuadrature() | ||
377 | { | ||
378 | const volScalarField& m0(moments_[0]); | ||
379 | |||
380 | PtrList<extendedVolScalarNode>& nodes(nodes_()); | ||
381 | PtrList<basicVolScalarNode>& nodesRadau(nodesRadau_()); | ||
382 | |||
383 | forAll(m0, celli) | ||
384 | { | ||
385 | univariateMomentSet momentsToInvert | ||
386 | ( | ||
387 | nMoments_, | ||
388 | 0.0, | ||
389 | "Gauss", | ||
390 | support_ | ||
391 | ); | ||
392 | |||
393 | univariateMomentSet momentsToInvertRadau | ||
394 | ( | ||
395 | nMoments_, | ||
396 | 0.0, | ||
397 | "GaussRadau", | ||
398 | support_ | ||
399 | ); | ||
400 | |||
401 | // Copying moment set from a cell to univariateMomentSet | ||
402 | forAll(momentsToInvert, momenti) | ||
403 | { | ||
404 | momentsToInvert[momenti] = moments_[momenti][celli]; | ||
405 | momentsToInvertRadau[momenti] = momentsToInvert[momenti]; | ||
406 | } | ||
407 | |||
408 | // Inverting moments and updating EQMOM | ||
409 | momentInverter_->invert(momentsToInvert); | ||
410 | |||
411 | // Finding Gauss-Radau quadrature | ||
412 | momentsToInvertRadau.invert(); | ||
413 | |||
414 | // Recovering primary weights and abscissae from moment inverter | ||
415 | const scalarDiagonalMatrix& pWeights(momentInverter_->primaryWeights()); | ||
416 | |||
417 | const scalarDiagonalMatrix& pAbscissae | ||
418 | ( | ||
419 | momentInverter_->primaryAbscissae() | ||
420 | ); | ||
421 | |||
422 | // Recovering Gauss-Radau quadrature | ||
423 | const scalarDiagonalMatrix& rWeights(momentsToInvertRadau.weights()); | ||
424 | |||
425 | const scalarDiagonalMatrix& rAbscissae | ||
426 | ( | ||
427 | momentsToInvertRadau.abscissae() | ||
428 | ); | ||
429 | |||
430 | // Copying EQMOM quadrature to fields | ||
431 | for (label pNodei = 0; pNodei < nPrimaryNodes_; pNodei++) | ||
432 | { | ||
433 | extendedVolScalarNode& node(nodes[pNodei]); | ||
434 | |||
435 | // Copy primary node | ||
436 | node.primaryWeight()[celli] = pWeights[pNodei]; | ||
437 | node.primaryAbscissa()[celli] = pAbscissae[pNodei]; | ||
438 | |||
439 | // Copy secondary nodes | ||
440 | PtrList<volScalarField>& sWeightFields(node.secondaryWeights()); | ||
441 | PtrList<volScalarField>& sAbscissaFields(node.secondaryAbscissae()); | ||
442 | |||
443 | const scalarRectangularMatrix& sWeights | ||
444 | ( | ||
445 | momentInverter_->secondaryWeights() | ||
446 | ); | ||
447 | |||
448 | const scalarRectangularMatrix& sAbscissae | ||
449 | ( | ||
450 | momentInverter_->secondaryAbscissae() | ||
451 | ); | ||
452 | |||
453 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
454 | { | ||
455 | sWeightFields[sNodei][celli] = sWeights[pNodei][sNodei]; | ||
456 | sAbscissaFields[sNodei][celli] = sAbscissae[pNodei][sNodei]; | ||
457 | } | ||
458 | |||
459 | // Copy sigma | ||
460 | node.sigma()[celli] = momentInverter_->sigma(); | ||
461 | } | ||
462 | |||
463 | for (label rNodei = 0; rNodei < nNodesRadau_; rNodei++) | ||
464 | { | ||
465 | basicVolScalarNode& node(nodesRadau[rNodei]); | ||
466 | |||
467 | if (rNodei < momentsToInvertRadau.nNodes()) | ||
468 | { | ||
469 | node.primaryWeight()[celli] = rWeights[rNodei]; | ||
470 | node.primaryAbscissa()[celli] = rAbscissae[rNodei]; | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | node.primaryWeight()[celli] = 0.0; | ||
475 | node.primaryAbscissa()[celli] = 0.0; | ||
476 | } | ||
477 | } | ||
478 | } | ||
479 | |||
480 | // Updating boundary conditions | ||
481 | forAll(nodes, pNodei) | ||
482 | { | ||
483 | extendedVolScalarNode& pNode(nodes[pNodei]); | ||
484 | |||
485 | pNode.primaryWeight().correctBoundaryConditions(); | ||
486 | pNode.primaryAbscissa().correctBoundaryConditions(); | ||
487 | pNode.sigma().correctBoundaryConditions(); | ||
488 | |||
489 | |||
490 | for (label sNodei = 0; sNodei < nSecondaryNodes_; sNodei++) | ||
491 | { | ||
492 | pNode.secondaryWeights()[sNodei].correctBoundaryConditions(); | ||
493 | pNode.secondaryAbscissae()[sNodei].correctBoundaryConditions(); | ||
494 | } | ||
495 | } | ||
496 | |||
497 | forAll(nodesRadau, rNodei) | ||
498 | { | ||
499 | basicVolScalarNode& rNode(nodesRadau[rNodei]); | ||
500 | |||
501 | rNode.primaryWeight().correctBoundaryConditions(); | ||
502 | rNode.primaryAbscissa().correctBoundaryConditions(); | ||
503 | } | ||
504 | |||
505 | updateBoundaryQuadrature(); | ||
506 | updateMoments(); | ||
507 | } | ||
508 | |||
509 | |||
510 | void Foam::univariateQuadratureApproximation::updateMoments() | ||
511 | { | ||
512 | moments_.update(); | ||
513 | } | ||
514 | |||
515 | |||
516 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/Make/files added (mode: 100644) (index 0000000..15c331a) | |||
1 | monoKineticQuadratureApproximation/monoKineticQuadratureApproximation.C | ||
2 | |||
3 | |||
4 | LIB = $(FOAM_USER_LIBBIN)/libquadratureApproximation |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/Make/options copied from file multiphaseEulerPbeFoam/quadratureMethods/PDFTransportModels/Make/options (similarity 76%) (mode: 100644) (index 8256cab..8a51422) | |||
... | ... | EXE_INC = \ | |
9 | 9 | -I$(LIB_SRC)/finiteVolume/lnInclude \ | -I$(LIB_SRC)/finiteVolume/lnInclude \ |
10 | 10 | -I$(LIB_SRC)/meshTools/lnInclude \ | -I$(LIB_SRC)/meshTools/lnInclude \ |
11 | 11 | -I../../eigenSolver/lnInclude \ | -I../../eigenSolver/lnInclude \ |
12 | -I../univariateMomentSet/lnInclude \ | ||
13 | -I../extentedMomentInversion/lnInclude \ | ||
12 | -I../../Vandermonde/lnInclude \ | ||
13 | -I../../mappedList \ | ||
14 | -I../momentSets/lnInclude \ | ||
14 | 15 | -I../quadratureNode \ | -I../quadratureNode \ |
15 | 16 | -I../moments \ | -I../moments \ |
16 | -I../quadratureApproximation/lnInclude | ||
17 | -I../momentInversion/univariate/basic/lnInclude \ | ||
18 | -I../fieldMomentInversion/lnInclude | ||
17 | 19 | ||
18 | 20 | LIB_LIBS = \ | LIB_LIBS = \ |
19 | 21 | -lincompressibleTransportModels \ | -lincompressibleTransportModels \ |
... | ... | LIB_LIBS = \ | |
27 | 29 | -lmeshTools \ | -lmeshTools \ |
28 | 30 | -L$(FOAM_USER_LIBBIN) \ | -L$(FOAM_USER_LIBBIN) \ |
29 | 31 | -leigenSolver \ | -leigenSolver \ |
30 | -lmomentSet \ | ||
31 | -lextendedMomentInversion \ | ||
32 | -lquadratureApproximation | ||
32 | -lvandermonde \ | ||
33 | -lmomentSets \ | ||
34 | -lmomentInversion \ | ||
35 | -lfieldMomentInversion |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/monoKineticQuadratureApproximation/monoKineticQuadratureApproximation.C added (mode: 100755) (index 0000000..61e6bd0) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2015-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work of OpenFOAM. | ||
10 | |||
11 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
12 | under the terms of the GNU General Public License as published by | ||
13 | the Free Software Foundation, either version 3 of the License, or | ||
14 | (at your option) any later version. | ||
15 | |||
16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
19 | for more details. | ||
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | \*---------------------------------------------------------------------------*/ | ||
25 | |||
26 | #include "monoKineticQuadratureApproximation.H" | ||
27 | #include "fixedValueFvPatchFields.H" | ||
28 | #include "cyclicFvPatchFields.H" | ||
29 | #include "zeroGradientFvPatchFields.H" | ||
30 | #include "emptyFvPatchFields.H" | ||
31 | #include "directionMixedFvPatchFields.H" | ||
32 | #include "fixedValueFvsPatchFields.H" | ||
33 | #include "slipFvPatchFields.H" | ||
34 | #include "partialSlipFvPatchFields.H" | ||
35 | #include "Vandermonde.H" | ||
36 | |||
37 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
38 | |||
39 | Foam::monoKineticQuadratureApproximation::monoKineticQuadratureApproximation | ||
40 | ( | ||
41 | const word& name, | ||
42 | const fvMesh& mesh, | ||
43 | const word& support | ||
44 | ) | ||
45 | : | ||
46 | quadratureApproximation(name, mesh, support, 1), | ||
47 | U_ | ||
48 | ( | ||
49 | mesh_.lookupObject<volVectorField> | ||
50 | ( | ||
51 | IOobject::groupName("U", name_) | ||
52 | ) | ||
53 | ), | ||
54 | nNodes_(nodes_().size()), | ||
55 | velocityMoments_(max(nNodes_, 2)), | ||
56 | velocityAbscissae_(nNodes_), | ||
57 | nodesNei_(), | ||
58 | velocitiesNei_(nNodes_), | ||
59 | nodesOwn_(), | ||
60 | velocitiesOwn_(nNodes_), | ||
61 | minM0_(readScalar((*this).subDict("residuals").lookup("minM0"))), | ||
62 | minM1_(readScalar((*this).subDict("residuals").lookup("minM1"))) | ||
63 | { | ||
64 | // Set boundary cconditions for velocity abscissae based on | ||
65 | // mean velocity | ||
66 | wordList UTypes(U_.boundaryField().types()); | ||
67 | |||
68 | forAll(U_.boundaryField(), i) | ||
69 | { | ||
70 | if | ||
71 | ( | ||
72 | isA<fixedValueFvPatchVectorField>(U_.boundaryField()[i]) | ||
73 | || isA<slipFvPatchVectorField>(U_.boundaryField()[i]) | ||
74 | || isA<partialSlipFvPatchVectorField>(U_.boundaryField()[i]) | ||
75 | ) | ||
76 | { | ||
77 | UTypes[i] = fixedValueFvPatchVectorField::typeName; | ||
78 | } | ||
79 | else if | ||
80 | ( | ||
81 | isA<directionMixedFvPatchVectorField>(U_.boundaryField()[i]) | ||
82 | ) | ||
83 | { | ||
84 | UTypes[i] = zeroGradientFvPatchVectorField::typeName; | ||
85 | } | ||
86 | } | ||
87 | |||
88 | forAll(velocityMoments_, mi) | ||
89 | { | ||
90 | velocityMoments_.set | ||
91 | ( | ||
92 | mi, | ||
93 | new volVectorField | ||
94 | ( | ||
95 | IOobject | ||
96 | ( | ||
97 | IOobject::groupName | ||
98 | ( | ||
99 | "Up", | ||
100 | IOobject::groupName | ||
101 | ( | ||
102 | Foam::name(mi), | ||
103 | "air" | ||
104 | ) | ||
105 | ), | ||
106 | mesh_.time().timeName(), | ||
107 | mesh_, | ||
108 | IOobject::NO_READ, | ||
109 | IOobject::AUTO_WRITE | ||
110 | ), | ||
111 | moments_[mi]*U_, | ||
112 | UTypes | ||
113 | ) | ||
114 | ); | ||
115 | } | ||
116 | nodesNei_ = autoPtr<PtrList<surfaceScalarNode>> | ||
117 | ( | ||
118 | new PtrList<surfaceScalarNode>(nNodes_) | ||
119 | ); | ||
120 | nodesOwn_ = autoPtr<PtrList<surfaceScalarNode>> | ||
121 | ( | ||
122 | new PtrList<surfaceScalarNode>(nNodes_) | ||
123 | ); | ||
124 | |||
125 | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | ||
126 | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
127 | |||
128 | |||
129 | // Populating interpolated nodes | ||
130 | forAll(nodes_(), nodei) | ||
131 | { | ||
132 | velocityAbscissae_.set | ||
133 | ( | ||
134 | nodei, | ||
135 | new volVectorField | ||
136 | ( | ||
137 | IOobject | ||
138 | ( | ||
139 | IOobject::groupName | ||
140 | ( | ||
141 | "U", | ||
142 | IOobject::groupName | ||
143 | ( | ||
144 | name_, | ||
145 | Foam::name(nodei) | ||
146 | ) | ||
147 | ), | ||
148 | mesh_.time().timeName(), | ||
149 | mesh_, | ||
150 | IOobject::NO_READ, | ||
151 | IOobject::AUTO_WRITE | ||
152 | ), | ||
153 | U_, | ||
154 | U_.boundaryField().types() | ||
155 | ) | ||
156 | ); | ||
157 | nodesNei.set | ||
158 | ( | ||
159 | nodei, | ||
160 | new surfaceScalarNode | ||
161 | ( | ||
162 | "node" + Foam::name(nodei) + "Nei", | ||
163 | name_, | ||
164 | mesh_, | ||
165 | moments_[0].dimensions(), | ||
166 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
167 | false, | ||
168 | 0 | ||
169 | ) | ||
170 | ); | ||
171 | velocitiesNei_.set | ||
172 | ( | ||
173 | nodei, | ||
174 | new surfaceVectorField | ||
175 | ( | ||
176 | IOobject | ||
177 | ( | ||
178 | IOobject::groupName | ||
179 | ( | ||
180 | "UNei", | ||
181 | IOobject::groupName | ||
182 | ( | ||
183 | name_, | ||
184 | Foam::name(nodei) | ||
185 | ) | ||
186 | ), | ||
187 | mesh_.time().timeName(), | ||
188 | mesh_, | ||
189 | IOobject::NO_READ, | ||
190 | IOobject::NO_WRITE | ||
191 | ), | ||
192 | fvc::interpolate(U_) | ||
193 | ) | ||
194 | ); | ||
195 | |||
196 | nodesOwn.set | ||
197 | ( | ||
198 | nodei, | ||
199 | new surfaceScalarNode | ||
200 | ( | ||
201 | "node" + Foam::name(nodei) + "Own", | ||
202 | name_, | ||
203 | mesh_, | ||
204 | moments_[0].dimensions(), | ||
205 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
206 | false, | ||
207 | 0 | ||
208 | ) | ||
209 | ); | ||
210 | velocitiesOwn_.set | ||
211 | ( | ||
212 | nodei, | ||
213 | new surfaceVectorField | ||
214 | ( | ||
215 | IOobject | ||
216 | ( | ||
217 | IOobject::groupName | ||
218 | ( | ||
219 | "UOwn", | ||
220 | IOobject::groupName | ||
221 | ( | ||
222 | name_, | ||
223 | Foam::name(nodei) | ||
224 | ) | ||
225 | ), | ||
226 | mesh_.time().timeName(), | ||
227 | mesh_, | ||
228 | IOobject::NO_READ, | ||
229 | IOobject::NO_WRITE | ||
230 | ), | ||
231 | fvc::interpolate(U_) | ||
232 | ) | ||
233 | ); | ||
234 | } | ||
235 | |||
236 | updateAllQuadrature(); | ||
237 | interpolateNodes(); | ||
238 | } | ||
239 | |||
240 | |||
241 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
242 | |||
243 | Foam::monoKineticQuadratureApproximation::~monoKineticQuadratureApproximation() | ||
244 | {} | ||
245 | |||
246 | |||
247 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
248 | |||
249 | void Foam::monoKineticQuadratureApproximation::interpolateNodes() | ||
250 | { | ||
251 | surfaceScalarField nei | ||
252 | ( | ||
253 | IOobject | ||
254 | ( | ||
255 | "nei", | ||
256 | mesh_.time().timeName(), | ||
257 | mesh_ | ||
258 | ), | ||
259 | mesh_, | ||
260 | dimensionedScalar("nei", dimless, -1.0) | ||
261 | ); | ||
262 | |||
263 | surfaceScalarField own | ||
264 | ( | ||
265 | IOobject | ||
266 | ( | ||
267 | "own", | ||
268 | mesh_.time().timeName(), | ||
269 | mesh_ | ||
270 | ), | ||
271 | mesh_, | ||
272 | dimensionedScalar("own", dimless, 1.0) | ||
273 | ); | ||
274 | |||
275 | const PtrList<volScalarNode>& nodes = nodes_(); | ||
276 | PtrList<surfaceScalarNode>& nodesNei = nodesNei_(); | ||
277 | PtrList<surfaceScalarNode>& nodesOwn = nodesOwn_(); | ||
278 | |||
279 | forAll(nodes, nodei) | ||
280 | { | ||
281 | const volScalarNode& node(nodes[nodei]); | ||
282 | surfaceScalarNode& nodeNei(nodesNei[nodei]); | ||
283 | surfaceScalarNode& nodeOwn(nodesOwn[nodei]); | ||
284 | |||
285 | nodeOwn.primaryWeight() = | ||
286 | fvc::interpolate(node.primaryWeight(), own, "reconstruct(weight)"); | ||
287 | |||
288 | nodeOwn.primaryAbscissa() = | ||
289 | fvc::interpolate | ||
290 | ( | ||
291 | node.primaryAbscissa(), | ||
292 | own, | ||
293 | "reconstruct(abscissa)" | ||
294 | ); | ||
295 | |||
296 | velocitiesOwn_[nodei] = | ||
297 | fvc::interpolate(velocityAbscissae_[nodei], own, "reconstruct(U)"); | ||
298 | |||
299 | |||
300 | nodeNei.primaryWeight() = | ||
301 | fvc::interpolate(node.primaryWeight(), nei, "reconstruct(weight)"); | ||
302 | |||
303 | nodeNei.primaryAbscissa() = | ||
304 | fvc::interpolate | ||
305 | ( | ||
306 | node.primaryAbscissa(), | ||
307 | nei, | ||
308 | "reconstruct(abscissa)" | ||
309 | ); | ||
310 | |||
311 | velocitiesNei_[nodei] = | ||
312 | fvc::interpolate(velocityAbscissae_[nodei], nei, "reconstruct(U)"); | ||
313 | } | ||
314 | } | ||
315 | |||
316 | void Foam::monoKineticQuadratureApproximation::updateBoundaryVelocities() | ||
317 | { | ||
318 | const volScalarField& m0 = moments_[0]; | ||
319 | |||
320 | // Update boundary node velocities | ||
321 | const volScalarField::Boundary& m0Bf = m0.boundaryField(); | ||
322 | forAll(m0Bf, patchi) | ||
323 | { | ||
324 | const fvPatchScalarField& m0Patch = m0Bf[patchi]; | ||
325 | |||
326 | forAll(m0Patch, facei) | ||
327 | { | ||
328 | //- number of nodes with a non-negligable number of bubble or mass | ||
329 | label nNonZeroNodes = 0; | ||
330 | boolList nonZeroNodes(nNodes_, false); | ||
331 | |||
332 | // Check if moment.0 is large enough to be meaningfull | ||
333 | if (m0Bf[patchi][facei] > minM0_) | ||
334 | { | ||
335 | forAll(nodes_(), nodei) | ||
336 | { | ||
337 | // Check if bubble moments are large enough. | ||
338 | // If yes make matricies 1 component larger, | ||
339 | // if no the rest of the nodes are assumed to | ||
340 | // be too small as well. | ||
341 | // This is done to avoid a divide by 0 error, | ||
342 | // and to reduce unneeded computation time | ||
343 | if | ||
344 | ( | ||
345 | nodes_()[nodei].primaryWeight().boundaryField()[patchi][facei] | ||
346 | > minM0_ | ||
347 | && | ||
348 | nodes_()[nodei].primaryAbscissa().boundaryField()[patchi][facei] | ||
349 | > SMALL | ||
350 | ) | ||
351 | { | ||
352 | nonZeroNodes[nodei] = true; | ||
353 | nNonZeroNodes++; | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | |||
358 | if (nNonZeroNodes == 1) | ||
359 | { | ||
360 | label index = -1; | ||
361 | forAll(nonZeroNodes, nodei) | ||
362 | { | ||
363 | if (nonZeroNodes[nodei]) | ||
364 | { | ||
365 | index = nodei; | ||
366 | break; | ||
367 | } | ||
368 | } | ||
369 | velocityAbscissae_[index].boundaryFieldRef()[patchi][facei] = | ||
370 | velocityMoments_[1].boundaryField()[patchi][facei] | ||
371 | /( | ||
372 | nodes_()[index].primaryWeight().boundaryField()[patchi][facei] | ||
373 | *nodes_()[index].primaryAbscissa().boundaryField()[patchi][facei] | ||
374 | ); | ||
375 | } | ||
376 | else if (nNonZeroNodes > 1) | ||
377 | { | ||
378 | // Create invV and invR matrices outside of cmptI loop to save time | ||
379 | scalarSquareMatrix invR(nNonZeroNodes, 0.0); | ||
380 | scalarDiagonalMatrix x(nNonZeroNodes, 0.0); | ||
381 | label nodej = 0; | ||
382 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
383 | { | ||
384 | if (nonZeroNodes[nodei]) | ||
385 | { | ||
386 | x[nodej] = | ||
387 | nodes_()[nodei].primaryAbscissa().boundaryField()[patchi][facei]; | ||
388 | |||
389 | invR[nodej][nodej] = | ||
390 | 1.0 | ||
391 | /nodes_()[nodei].primaryWeight().boundaryField()[patchi][facei]; | ||
392 | |||
393 | nodej++; | ||
394 | } | ||
395 | } | ||
396 | |||
397 | // Invert V martix and create invVR matrix | ||
398 | Vandermonde V(x); | ||
399 | scalarRectangularMatrix invVR = invR*V.inv(); | ||
400 | |||
401 | // Loop over all components of U_{\alpha} | ||
402 | for (label cmpti = 0; cmpti < vector::nComponents; cmpti++) | ||
403 | { | ||
404 | scalarRectangularMatrix Upcmpt(nNonZeroNodes, 1, 0.0); | ||
405 | label nodej = 0; | ||
406 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
407 | { | ||
408 | if (nonZeroNodes[nodei]) | ||
409 | { | ||
410 | Upcmpt[nodej][0] = | ||
411 | velocityMoments_[nodei].boundaryField()[patchi][facei].component(cmpti); | ||
412 | |||
413 | nodej++; | ||
414 | } | ||
415 | } | ||
416 | |||
417 | // Compute U_{\alpha} cmptI component using invVR matrix | ||
418 | scalarRectangularMatrix Ucmpt = invVR*Upcmpt; | ||
419 | nodej = 0; | ||
420 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
421 | { | ||
422 | if (nonZeroNodes[nodei]) | ||
423 | { | ||
424 | velocityAbscissae_[nodei].boundaryFieldRef()[patchi][facei].component(cmpti) = Ucmpt[nodej][0]; | ||
425 | nodej++; | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
431 | // Set nodes with very small bubble mass or number to zero velocity | ||
432 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
433 | { | ||
434 | if (!nonZeroNodes[nodei]) | ||
435 | { | ||
436 | velocityAbscissae_[nodei].boundaryFieldRef()[patchi][facei] | ||
437 | = U_.boundaryField()[patchi][facei]; | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | } | ||
442 | } | ||
443 | |||
444 | void Foam::monoKineticQuadratureApproximation::updateAllQuadrature() | ||
445 | { | ||
446 | const volScalarField& m0 = moments_[0]; | ||
447 | const volScalarField::Boundary m0Bf = m0.boundaryField(); | ||
448 | |||
449 | // Check for small moments at cell centers | ||
450 | forAll(m0, celli) | ||
451 | { | ||
452 | //- Make sure moments are below 0 before checking if they | ||
453 | // are small enough to be neglected | ||
454 | if | ||
455 | ( | ||
456 | m0[celli] < 0 | ||
457 | && mag(m0[celli]) < minM0_ | ||
458 | ) | ||
459 | { | ||
460 | forAll(moments_, mi) | ||
461 | { | ||
462 | moments_[mi][celli] = 0.0; | ||
463 | } | ||
464 | } | ||
465 | else if | ||
466 | ( | ||
467 | moments_[1][celli] < 0 | ||
468 | && mag(moments_[1][celli]) < minM1_ | ||
469 | ) | ||
470 | { | ||
471 | for (label mi = 1; mi < nMoments_; mi++) | ||
472 | { | ||
473 | moments_[mi][celli] = 0.0; | ||
474 | } | ||
475 | } | ||
476 | } | ||
477 | |||
478 | // Check for small moments on boundaries | ||
479 | forAll(m0Bf, patchi) | ||
480 | { | ||
481 | forAll(m0Bf[patchi], facei) | ||
482 | { | ||
483 | if | ||
484 | ( | ||
485 | m0Bf[patchi][facei] < 0 | ||
486 | && mag(m0Bf[patchi][facei]) < minM0_ | ||
487 | ) | ||
488 | { | ||
489 | forAll(moments_, mi) | ||
490 | { | ||
491 | moments_[mi].boundaryFieldRef()[patchi][facei] = 0.0; | ||
492 | } | ||
493 | } | ||
494 | else if | ||
495 | ( | ||
496 | moments_[1].boundaryField()[patchi][facei] < 0 | ||
497 | && mag(moments_[1].boundaryField()[patchi][facei]) < minM1_ | ||
498 | ) | ||
499 | { | ||
500 | for (label mi = 1; mi < nMoments_; mi++) | ||
501 | { | ||
502 | moments_[mi].boundaryFieldRef()[patchi][facei] = 0.0; | ||
503 | } | ||
504 | } | ||
505 | } | ||
506 | } | ||
507 | |||
508 | updateQuadrature(); | ||
509 | |||
510 | updateVelocities(); | ||
511 | updateBoundaryVelocities(); | ||
512 | |||
513 | forAll(nodes_(), nodei) | ||
514 | { | ||
515 | velocityAbscissae_[nodei].correctBoundaryConditions(); | ||
516 | } | ||
517 | |||
518 | updateAllMoments(); | ||
519 | } | ||
520 | |||
521 | void Foam::monoKineticQuadratureApproximation::updateVelocities() | ||
522 | { | ||
523 | const volScalarField& m0 = moments_[0]; | ||
524 | |||
525 | forAll(m0, celli) | ||
526 | { | ||
527 | //- number of nodes with a non-negligable number of bubble or mass | ||
528 | label nNonZeroNodes = 0; | ||
529 | boolList nonZeroNodes(nNodes_, false); | ||
530 | |||
531 | // Check if moment.0 is large enough to be meaningful | ||
532 | if (m0[celli] > minM0_) | ||
533 | { | ||
534 | forAll(nodes_(), nodei) | ||
535 | { | ||
536 | // Check if size moments are large enough. | ||
537 | // If yes make matricies 1 component larger. | ||
538 | // This is done to avoid a divide by 0 error, | ||
539 | // and to reduce unneeded computation time | ||
540 | if | ||
541 | ( | ||
542 | nodes_()[nodei].primaryWeight()[celli] > minM0_ | ||
543 | && nodes_()[nodei].primaryAbscissa()[celli] > SMALL | ||
544 | ) | ||
545 | { | ||
546 | nonZeroNodes[nodei] = true; | ||
547 | nNonZeroNodes++; | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | if (nNonZeroNodes == 1) | ||
553 | { | ||
554 | label index = -1; | ||
555 | forAll(nonZeroNodes, nodei) | ||
556 | { | ||
557 | if (nonZeroNodes[nodei]) | ||
558 | { | ||
559 | index = nodei; | ||
560 | break; | ||
561 | } | ||
562 | } | ||
563 | velocityAbscissae_[index][celli] = | ||
564 | velocityMoments_[1][celli] | ||
565 | /( | ||
566 | nodes_()[index].primaryWeight()[celli] | ||
567 | *nodes_()[index].primaryAbscissa()[celli] | ||
568 | ); | ||
569 | } | ||
570 | else if (nNonZeroNodes > 1) | ||
571 | { | ||
572 | // Create invV and invR matrices outside of cmptI loop to save time | ||
573 | scalarSquareMatrix invR(nNonZeroNodes, 0.0); | ||
574 | scalarDiagonalMatrix x(nNonZeroNodes, 0.0); | ||
575 | label nodej = 0; | ||
576 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
577 | { | ||
578 | if (nonZeroNodes[nodei]) | ||
579 | { | ||
580 | x[nodej] = | ||
581 | nodes_()[nodei].primaryAbscissa()[celli]; | ||
582 | |||
583 | invR[nodej][nodej] = | ||
584 | 1.0/nodes_()[nodei].primaryWeight()[celli]; | ||
585 | |||
586 | nodej++; | ||
587 | } | ||
588 | } | ||
589 | |||
590 | // Invert V martix and create invVR matrix | ||
591 | Vandermonde V(x); | ||
592 | scalarRectangularMatrix invVR = invR*V.inv(); | ||
593 | |||
594 | // Loop over all components of U_{\alpha} | ||
595 | for (label cmpti = 0; cmpti < vector::nComponents; cmpti++) | ||
596 | { | ||
597 | scalarRectangularMatrix Upcmpt(nNonZeroNodes, 1, 0.0); | ||
598 | label nodej = 0; | ||
599 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
600 | { | ||
601 | if (nonZeroNodes[nodei]) | ||
602 | { | ||
603 | Upcmpt[nodej][0] = | ||
604 | velocityMoments_[nodei][celli].component(cmpti); | ||
605 | nodej++; | ||
606 | } | ||
607 | } | ||
608 | |||
609 | // Compute U_{\alpha} cmptI component using invVR matrix | ||
610 | scalarRectangularMatrix Ucmpt = invVR*Upcmpt; | ||
611 | nodej = 0; | ||
612 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
613 | { | ||
614 | if (nonZeroNodes[nodei]) | ||
615 | { | ||
616 | velocityAbscissae_[nodei][celli].component(cmpti) = | ||
617 | Ucmpt[nodej][0]; | ||
618 | nodej++; | ||
619 | } | ||
620 | } | ||
621 | } | ||
622 | } | ||
623 | |||
624 | // Set nodes with very small bubble mass or number to mean bubble | ||
625 | // velocity | ||
626 | for (label nodei = 0; nodei < nNodes_; nodei++) | ||
627 | { | ||
628 | if (!nonZeroNodes[nodei]) | ||
629 | { | ||
630 | velocityAbscissae_[nodei][celli] = U_[celli]; | ||
631 | } | ||
632 | } | ||
633 | } | ||
634 | } | ||
635 | |||
636 | void Foam::monoKineticQuadratureApproximation::updateVelocityMoments() | ||
637 | { | ||
638 | // Update velocity moments | ||
639 | forAll(velocityMoments_, mi) | ||
640 | { | ||
641 | velocityMoments_[mi] = | ||
642 | dimensionedVector | ||
643 | ( | ||
644 | "zero", | ||
645 | velocityMoments_[mi].dimensions(), | ||
646 | Zero | ||
647 | ); | ||
648 | |||
649 | if (mi == 0) | ||
650 | { | ||
651 | forAll(nodes_(), nodei) | ||
652 | { | ||
653 | velocityMoments_[mi] += | ||
654 | nodes_()[nodei].primaryWeight()*velocityAbscissae_[nodei]; | ||
655 | } | ||
656 | |||
657 | velocityMoments_[mi].correctBoundaryConditions(); | ||
658 | } | ||
659 | else | ||
660 | { | ||
661 | forAll(nodes_(), nodei) | ||
662 | { | ||
663 | velocityMoments_[mi] += | ||
664 | nodes_()[nodei].primaryWeight() | ||
665 | *pow(nodes_()[nodei].primaryAbscissa(), mi) | ||
666 | *velocityAbscissae_[nodei]; | ||
667 | } | ||
668 | |||
669 | velocityMoments_[mi].correctBoundaryConditions(); | ||
670 | } | ||
671 | } | ||
672 | } | ||
673 | |||
674 | |||
675 | |||
676 | void Foam::monoKineticQuadratureApproximation::updateAllMoments() | ||
677 | { | ||
678 | // Update size moments | ||
679 | updateMoments(); | ||
680 | |||
681 | // Update velocity moments | ||
682 | updateVelocityMoments(); | ||
683 | } | ||
684 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/monoKineticQuadratureApproximation/monoKineticQuadratureApproximation.H added (mode: 100755) (index 0000000..2024ee3) | |||
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 | Class | ||
25 | Foam::monoKineticQuadratureApproximation | ||
26 | |||
27 | Description | ||
28 | Uses quadrature approximation as a base to handle size moments, while the | ||
29 | velocity moments and abscissae are stored in this class. The one | ||
30 | dimensional CQMOM inversion is also done. | ||
31 | |||
32 | SourceFiles | ||
33 | monoKineticQuadratureApproximation.C | ||
34 | monoKineticQuadratureApproximationI.H | ||
35 | |||
36 | \*---------------------------------------------------------------------------*/ | ||
37 | |||
38 | #ifndef monoKineticQuadratureApproximation_H | ||
39 | #define monoKineticQuadratureApproximation_H | ||
40 | |||
41 | #include "fvCFD.H" | ||
42 | #include "quadratureApproximation.H" | ||
43 | #include "PtrList.H" | ||
44 | #include "fvMesh.H" | ||
45 | #include "volFields.H" | ||
46 | #include "surfaceFields.H" | ||
47 | #include "univariateMomentSet.H" | ||
48 | #include "quadratureNodes.H" | ||
49 | #include "momentFieldSets.H" | ||
50 | #include "fieldMomentInversion.H" | ||
51 | |||
52 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
53 | |||
54 | namespace Foam | ||
55 | { | ||
56 | |||
57 | /*---------------------------------------------------------------------------*\ | ||
58 | Class monoKineticQuadratureApproximation Declaration | ||
59 | \*---------------------------------------------------------------------------*/ | ||
60 | |||
61 | class monoKineticQuadratureApproximation | ||
62 | : | ||
63 | public quadratureApproximation<volUnivariateMomentFieldSet, volScalarNode> | ||
64 | { | ||
65 | // Private data | ||
66 | |||
67 | //- Refrence to mean velocity | ||
68 | const volVectorField& U_; | ||
69 | |||
70 | //- Number of primary quadrature nodes | ||
71 | label nNodes_; | ||
72 | |||
73 | //- List of velocity moments | ||
74 | PtrList<volVectorField> velocityMoments_; | ||
75 | |||
76 | //- List of velocity abscissae | ||
77 | PtrList<volVectorField> velocityAbscissae_; | ||
78 | |||
79 | //- List of interpolated nodes (neighbour) | ||
80 | autoPtr<PtrList<surfaceScalarNode>> nodesNei_; | ||
81 | |||
82 | //- List of interpolate velocities (neighbour) | ||
83 | PtrList<surfaceVectorField> velocitiesNei_; | ||
84 | |||
85 | //- List of interpolated nodes (owner) | ||
86 | autoPtr<PtrList<surfaceScalarNode>> nodesOwn_; | ||
87 | |||
88 | //- List of interpolate velocities (owner) | ||
89 | PtrList<surfaceVectorField> velocitiesOwn_; | ||
90 | |||
91 | //- Minimum values for m1 and m0 | ||
92 | // minM1 should be the same order as residual alpha | ||
93 | scalar minM0_; | ||
94 | scalar minM1_; | ||
95 | |||
96 | |||
97 | public: | ||
98 | |||
99 | // Constructors | ||
100 | |||
101 | //- Construct from mesh | ||
102 | explicit monoKineticQuadratureApproximation | ||
103 | ( | ||
104 | const word& name, | ||
105 | const fvMesh& mesh, | ||
106 | const word& support | ||
107 | ); | ||
108 | |||
109 | |||
110 | //- Destructor | ||
111 | virtual ~monoKineticQuadratureApproximation(); | ||
112 | |||
113 | |||
114 | // Member Functions | ||
115 | |||
116 | // Access | ||
117 | |||
118 | //- Const access to the velocity abscissae | ||
119 | inline const PtrList<volVectorField>& velocities() const; | ||
120 | |||
121 | //- Const access to the velocity abscissae | ||
122 | inline PtrList<volVectorField>& velocities(); | ||
123 | |||
124 | //- Const access to the velocity moments | ||
125 | inline const PtrList<volVectorField>& velocityMoments() const; | ||
126 | |||
127 | //- Non-const access to the velocity moments | ||
128 | inline PtrList<volVectorField>& velocityMoments(); | ||
129 | |||
130 | //- Const access to the interpolated moments (owner) | ||
131 | inline const PtrList<surfaceScalarNode>& nodesOwn() const; | ||
132 | |||
133 | //- Const access to the interpolated velocities (owner) | ||
134 | inline const PtrList<surfaceVectorField>& velocitiesOwn() const; | ||
135 | |||
136 | //- Const access to the interpolated moments (neighbour) | ||
137 | inline const PtrList<surfaceScalarNode>& nodesNei() const; | ||
138 | |||
139 | //- Const access to the interpolated velocities (neighbour) | ||
140 | inline const PtrList<surfaceVectorField>& velocitiesNei() const; | ||
141 | |||
142 | |||
143 | // Edit | ||
144 | |||
145 | //- Interpolate nodes | ||
146 | void interpolateNodes(); | ||
147 | |||
148 | //- Update node velocities on fixed-value boundaries | ||
149 | void updateBoundaryVelocities(); | ||
150 | |||
151 | //- Recalculate the velocity abscissae from the velocity moments | ||
152 | void updateVelocities(); | ||
153 | |||
154 | //- Recalculate the quadrature nodes from the moments | ||
155 | void updateAllQuadrature(); | ||
156 | |||
157 | //- Recalculate the moments from the quadrature nodes | ||
158 | void updateVelocityMoments(); | ||
159 | |||
160 | //- Recalculate all moments from the quadrature nodes | ||
161 | void updateAllMoments(); | ||
162 | }; | ||
163 | |||
164 | |||
165 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
166 | |||
167 | } // End namespace Foam | ||
168 | |||
169 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
170 | |||
171 | #include "monoKineticQuadratureApproximationI.H" | ||
172 | |||
173 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
174 | |||
175 | #endif | ||
176 | |||
177 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/monoKineticQuadratureApproximation/monoKineticQuadratureApproximationI.H copied from file multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximationI.H (similarity 53%) (mode: 100755) (index d757dae..c43724e) | |||
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-2017 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::PtrList<Foam::extendedVolScalarNode>& | ||
29 | Foam::univariateQuadratureApproximation::nodes() const | ||
28 | const Foam::PtrList<Foam::volVectorField>& | ||
29 | Foam::monoKineticQuadratureApproximation::velocities() const | ||
30 | 30 | { | { |
31 | return nodes_(); | ||
31 | return velocityAbscissae_; | ||
32 | 32 | } | } |
33 | 33 | ||
34 | const Foam::volUnivariateMomentFieldSet& | ||
35 | Foam::univariateQuadratureApproximation::moments() const | ||
34 | Foam::PtrList<Foam::volVectorField>& | ||
35 | Foam::monoKineticQuadratureApproximation::velocities() | ||
36 | 36 | { | { |
37 | return moments_; | ||
37 | return velocityAbscissae_; | ||
38 | 38 | } | } |
39 | 39 | ||
40 | Foam::volUnivariateMomentFieldSet& | ||
41 | Foam::univariateQuadratureApproximation::moments() | ||
40 | const Foam::PtrList<Foam::volVectorField>& | ||
41 | Foam::monoKineticQuadratureApproximation::velocityMoments() const | ||
42 | 42 | { | { |
43 | return moments_; | ||
43 | return velocityMoments_; | ||
44 | 44 | } | } |
45 | 45 | ||
46 | const Foam::basicSurfaceUnivariateMomentFieldSet& | ||
47 | Foam::univariateQuadratureApproximation::momentsNei() const | ||
46 | Foam::PtrList<Foam::volVectorField>& | ||
47 | Foam::monoKineticQuadratureApproximation::velocityMoments() | ||
48 | 48 | { | { |
49 | return momentsNei_; | ||
49 | return velocityMoments_; | ||
50 | 50 | } | } |
51 | 51 | ||
52 | Foam::basicSurfaceUnivariateMomentFieldSet& | ||
53 | Foam::univariateQuadratureApproximation::momentsNei() | ||
52 | const Foam::PtrList<Foam::surfaceScalarNode>& | ||
53 | Foam::monoKineticQuadratureApproximation::nodesOwn() const | ||
54 | 54 | { | { |
55 | return momentsNei_; | ||
55 | return nodesOwn_(); | ||
56 | 56 | } | } |
57 | 57 | ||
58 | const Foam::basicSurfaceUnivariateMomentFieldSet& | ||
59 | Foam::univariateQuadratureApproximation::momentsOwn() const | ||
58 | const Foam::PtrList<Foam::surfaceVectorField>& | ||
59 | Foam::monoKineticQuadratureApproximation::velocitiesOwn() const | ||
60 | 60 | { | { |
61 | return momentsOwn_; | ||
61 | return velocitiesOwn_; | ||
62 | 62 | } | } |
63 | 63 | ||
64 | Foam::basicSurfaceUnivariateMomentFieldSet& | ||
65 | Foam::univariateQuadratureApproximation::momentsOwn() | ||
64 | const Foam::PtrList<Foam::surfaceScalarNode>& | ||
65 | Foam::monoKineticQuadratureApproximation::nodesNei() const | ||
66 | 66 | { | { |
67 | return momentsOwn_; | ||
67 | return nodesNei_; | ||
68 | 68 | } | } |
69 | 69 | ||
70 | Foam::label Foam::univariateQuadratureApproximation::nDimensions() const | ||
70 | const Foam::PtrList<Foam::surfaceVectorField>& | ||
71 | Foam::monoKineticQuadratureApproximation::velocitiesNei() const | ||
71 | 72 | { | { |
72 | return nDimensions_; | ||
73 | } | ||
74 | |||
75 | Foam::label Foam::univariateQuadratureApproximation::nMoments() const | ||
76 | { | ||
77 | return nMoments_; | ||
73 | return velocitiesNei_; | ||
78 | 74 | } | } |
79 | 75 | ||
80 | 76 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximation.C added (mode: 100755) (index 0000000..dd4e14b) | |||
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 | #include "quadratureApproximation.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // | ||
29 | |||
30 | template<class momentFieldSetType, class nodeType> | ||
31 | const Foam::word Foam::quadratureApproximation<momentFieldSetType, nodeType>:: | ||
32 | propertiesName("quadratureProperties"); | ||
33 | |||
34 | |||
35 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
36 | |||
37 | template<class momentFieldSetType, class nodeType> | ||
38 | Foam::quadratureApproximation<momentFieldSetType, nodeType>:: | ||
39 | quadratureApproximation | ||
40 | ( | ||
41 | const word& name, | ||
42 | const fvMesh& mesh, | ||
43 | const word& support, | ||
44 | const label nDimensions | ||
45 | ) | ||
46 | : | ||
47 | IOdictionary | ||
48 | ( | ||
49 | IOobject | ||
50 | ( | ||
51 | IOobject::groupName("quadratureProperties", name), | ||
52 | mesh.time().constant(), | ||
53 | mesh, | ||
54 | IOobject::MUST_READ, | ||
55 | IOobject::NO_WRITE | ||
56 | ) | ||
57 | ), | ||
58 | name_(name), | ||
59 | mesh_(mesh), | ||
60 | nodes_(), | ||
61 | moments_(name_, *this, mesh_, nodes_, support), | ||
62 | nDimensions_(nDimensions), | ||
63 | nMoments_(moments_.size()), | ||
64 | nSecondaryNodes_ | ||
65 | ( | ||
66 | lookupOrDefault<label>("nSecondaryNodes", nMoments_ + 1) | ||
67 | ), | ||
68 | support_(support), | ||
69 | momentFieldInverter_ | ||
70 | ( | ||
71 | fieldMomentInversion::New((*this), nMoments_, nSecondaryNodes_) | ||
72 | ) | ||
73 | { | ||
74 | if (nSecondaryNodes_ != 0 && !momentFieldInverter_().extended()) | ||
75 | { | ||
76 | WarningInFunction | ||
77 | << "The number of secondary nodes in the quadrature" << nl | ||
78 | << " approximation is not zero, but the selected" << nl | ||
79 | << " inversion algorithm is not of extended type." << nl | ||
80 | << " Proceeding with nSecondaryNodes = 0." << nl | ||
81 | << " No extended quadrature will be computed." << nl; | ||
82 | } | ||
83 | |||
84 | // Allocating nodes | ||
85 | nodes_ = autoPtr<PtrList<nodeType>> | ||
86 | ( | ||
87 | new PtrList<nodeType> | ||
88 | ( | ||
89 | lookup("nodes"), | ||
90 | typename nodeType::iNew | ||
91 | ( | ||
92 | name_, | ||
93 | mesh_, | ||
94 | moments_[0].dimensions(), | ||
95 | moments_[1].dimensions()/moments_[0].dimensions(), | ||
96 | moments_[0].boundaryField().types(), | ||
97 | momentFieldInverter_().extended(), | ||
98 | nSecondaryNodes_ | ||
99 | ) | ||
100 | ) | ||
101 | ); | ||
102 | |||
103 | updateQuadrature(); | ||
104 | } | ||
105 | |||
106 | |||
107 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
108 | |||
109 | template<class momentFieldSetType, class nodeType> | ||
110 | Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
111 | ::~quadratureApproximation() | ||
112 | {} | ||
113 | |||
114 | |||
115 | // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // | ||
116 | |||
117 | template<class momentFieldSetType, class nodeType> | ||
118 | void Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
119 | ::updateQuadrature() | ||
120 | { | ||
121 | momentFieldInverter_().invert(moments_, nodes_()); | ||
122 | updateMoments(); | ||
123 | } | ||
124 | |||
125 | template<class momentFieldSetType, class nodeType> | ||
126 | void Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
127 | ::updateMoments() | ||
128 | { | ||
129 | moments_.update(); | ||
130 | } | ||
131 | |||
132 | template<class momentFieldSetType, class nodeType> | ||
133 | void Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
134 | ::updateLocalMoments(label celli) | ||
135 | { | ||
136 | moments_.updateLocalMoments(celli); | ||
137 | } | ||
138 | |||
139 | template<class momentFieldSetType, class nodeType> | ||
140 | bool Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
141 | ::updateLocalQuadrature(label celli, bool fatalErrorOnFailedRealizabilityTest) | ||
142 | { | ||
143 | bool realizable = momentFieldInverter_().invertLocalMoments | ||
144 | ( | ||
145 | moments_, nodes_(), celli, false | ||
146 | ); | ||
147 | |||
148 | if (!realizable && fatalErrorOnFailedRealizabilityTest) | ||
149 | { | ||
150 | return realizable; | ||
151 | } | ||
152 | |||
153 | moments_.updateLocalMoments(celli); | ||
154 | |||
155 | return realizable; | ||
156 | } | ||
157 | |||
158 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximation.H renamed from multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximation.H (similarity 55%) (mode: 100755) (index ee0b300..e4357ce) | |||
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-2017 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::univariateQuadratureApproximation | ||
25 | Foam::quadratureApproximation | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | Provides storage for the moments and the corresponding quadrature | Provides storage for the moments and the corresponding quadrature |
... | ... | Description | |
31 | 31 | provided. | provided. |
32 | 32 | ||
33 | 33 | SourceFiles | SourceFiles |
34 | univariateQuadratureApproximation.C | ||
35 | univariateQuadratureApproximationI.H | ||
34 | quadratureApproximation.C | ||
35 | quadratureApproximationI.H | ||
36 | 36 | ||
37 | 37 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
38 | 38 | ||
39 | #ifndef univariateQuadratureApproximation_H | ||
40 | #define univariateQuadratureApproximation_H | ||
39 | #ifndef quadratureApproximation_H | ||
40 | #define quadratureApproximation_H | ||
41 | 41 | ||
42 | 42 | #include "fvCFD.H" | #include "fvCFD.H" |
43 | 43 | #include "IOdictionary.H" | #include "IOdictionary.H" |
... | ... | SourceFiles | |
45 | 45 | #include "fvMesh.H" | #include "fvMesh.H" |
46 | 46 | #include "volFields.H" | #include "volFields.H" |
47 | 47 | #include "surfaceFields.H" | #include "surfaceFields.H" |
48 | #include "univariateMomentSet.H" | ||
49 | #include "extendedMomentInversion.H" | ||
50 | #include "quadratureNodes.H" | ||
51 | #include "momentFieldSets.H" | ||
48 | #include "fieldMomentInversion.H" | ||
52 | 49 | ||
53 | 50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
54 | 51 | ||
... | ... | namespace Foam | |
56 | 53 | { | { |
57 | 54 | ||
58 | 55 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
59 | Class univariateQuadratureApproximation Declaration | ||
56 | Class quadratureApproximation Declaration | ||
60 | 57 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
61 | 58 | ||
62 | class univariateQuadratureApproximation | ||
59 | template <class momentFieldSetType, class nodeType> | ||
60 | class quadratureApproximation | ||
63 | 61 | : | : |
64 | 62 | public IOdictionary | public IOdictionary |
65 | 63 | { | { |
66 | // Private data | ||
64 | protected: | ||
65 | // Protected data | ||
67 | 66 | ||
68 | 67 | //- Name of the quadrature approximation | //- Name of the quadrature approximation |
69 | 68 | const word name_; | const word name_; |
... | ... | class univariateQuadratureApproximation | |
72 | 71 | const fvMesh& mesh_; | const fvMesh& mesh_; |
73 | 72 | ||
74 | 73 | //- AutoPtr to the PtrList of quadrature nodes | //- AutoPtr to the PtrList of quadrature nodes |
75 | autoPtr<PtrList<extendedVolScalarNode>> nodes_; | ||
76 | |||
77 | //- AutoPtr to the PtrList of Radau quadrature nodes | ||
78 | autoPtr<PtrList<basicVolScalarNode>> nodesRadau_; | ||
74 | autoPtr<PtrList<nodeType>> nodes_; | ||
79 | 75 | ||
80 | 76 | //- List of moments | //- List of moments |
81 | volUnivariateMomentFieldSet moments_; | ||
82 | |||
83 | //- Number of primary quadrature nodes | ||
84 | label nPrimaryNodes_; | ||
85 | |||
86 | //- Number of secondary quadrature nodes | ||
87 | label nSecondaryNodes_; | ||
88 | |||
89 | //- Number of Radau quadrature nodes | ||
90 | label nNodesRadau_; | ||
91 | |||
92 | //- List of interpolated nodes (neighbour) | ||
93 | autoPtr<PtrList<basicSurfaceScalarNode>> nodesNei_; | ||
94 | |||
95 | //- List of interpolated nodes (owner) | ||
96 | autoPtr<PtrList<basicSurfaceScalarNode>> nodesOwn_; | ||
77 | momentFieldSetType moments_; | ||
97 | 78 | ||
98 | 79 | //- Dimensionality of the distribution function | //- Dimensionality of the distribution function |
99 | 80 | const label nDimensions_; | const label nDimensions_; |
... | ... | class univariateQuadratureApproximation | |
101 | 82 | //- Number of moments | //- Number of moments |
102 | 83 | const label nMoments_; | const label nMoments_; |
103 | 84 | ||
104 | //- List of interpolated moments (neighbour) | ||
105 | basicSurfaceUnivariateMomentFieldSet momentsNei_; | ||
106 | |||
107 | //- List of interpolated moments (owner) | ||
108 | basicSurfaceUnivariateMomentFieldSet momentsOwn_; | ||
109 | |||
110 | //- Moment inversion method | ||
111 | autoPtr<extendedMomentInversion> momentInverter_; | ||
85 | //- Number of secondary nodes | ||
86 | const label nSecondaryNodes_; | ||
112 | 87 | ||
113 | 88 | //- Support of the distribution function | //- Support of the distribution function |
114 | 89 | word support_; | word support_; |
115 | 90 | ||
91 | //- Extended moment inversion method | ||
92 | autoPtr<fieldMomentInversion> momentFieldInverter_; | ||
93 | |||
116 | 94 | ||
117 | 95 | public: | public: |
118 | 96 | ||
97 | //- Default name of the phase properties dictionary | ||
98 | static const word propertiesName; | ||
99 | |||
119 | 100 | // Constructors | // Constructors |
120 | 101 | ||
121 | 102 | //- Construct from mesh | //- Construct from mesh |
122 | explicit univariateQuadratureApproximation | ||
103 | quadratureApproximation | ||
123 | 104 | ( | ( |
124 | 105 | const word& name, | const word& name, |
125 | 106 | const fvMesh& mesh, | const fvMesh& mesh, |
126 | const word& support | ||
107 | const word& support, | ||
108 | const label nDimensions | ||
127 | 109 | ); | ); |
128 | 110 | ||
129 | 111 | ||
130 | 112 | //- Destructor | //- Destructor |
131 | virtual ~univariateQuadratureApproximation(); | ||
113 | virtual ~quadratureApproximation(); | ||
132 | 114 | ||
133 | 115 | ||
134 | 116 | // Member Functions | // Member Functions |
135 | 117 | ||
136 | 118 | // Access | // Access |
137 | 119 | ||
120 | //- Return name | ||
121 | inline const word name() const; | ||
122 | |||
123 | //- Extended moment inversion method | ||
124 | inline fieldMomentInversion& momentFieldInverter(); | ||
125 | |||
138 | 126 | //- Return the nodes | //- Return the nodes |
139 | inline const PtrList<extendedVolScalarNode>& nodes() const; | ||
127 | inline const PtrList<nodeType>& nodes() const; | ||
140 | 128 | ||
141 | 129 | //- Const access to the moments | //- Const access to the moments |
142 | inline const volUnivariateMomentFieldSet& moments() const; | ||
130 | inline const momentFieldSetType& moments() const; | ||
143 | 131 | ||
144 | 132 | //- Non-const access to the moments | //- Non-const access to the moments |
145 | inline volUnivariateMomentFieldSet& moments(); | ||
146 | |||
147 | //- Const access to the interpolated moments (neighbour) | ||
148 | inline const basicSurfaceUnivariateMomentFieldSet& | ||
149 | momentsNei() const; | ||
150 | |||
151 | //- Non-const access to the interpolated moments (neighbour) | ||
152 | inline basicSurfaceUnivariateMomentFieldSet& momentsNei(); | ||
153 | |||
154 | //- Const access to the interpolated moments (owner) | ||
155 | inline const basicSurfaceUnivariateMomentFieldSet& | ||
156 | momentsOwn() const; | ||
157 | |||
158 | //- Non-const access to the interpolated moments (owner) | ||
159 | inline basicSurfaceUnivariateMomentFieldSet& momentsOwn(); | ||
133 | inline momentFieldSetType& moments(); | ||
160 | 134 | ||
161 | 135 | //- Return the number of dimensions in the distribution | //- Return the number of dimensions in the distribution |
162 | 136 | inline label nDimensions() const; | inline label nDimensions() const; |
... | ... | public: | |
167 | 141 | ||
168 | 142 | // Edit | // Edit |
169 | 143 | ||
170 | //- Interpolate nodes | ||
171 | void interpolateNodes(); | ||
172 | |||
173 | //- Update quadrature nodes on fixed-value boundaries | ||
174 | void updateBoundaryQuadrature(); | ||
175 | |||
176 | 144 | //- Recalculate the quadrature nodes from the moments | //- Recalculate the quadrature nodes from the moments |
177 | 145 | void updateQuadrature(); | void updateQuadrature(); |
178 | 146 | ||
179 | 147 | //- Recalculate the moments from the quadrature nodes | //- Recalculate the moments from the quadrature nodes |
180 | 148 | void updateMoments(); | void updateMoments(); |
149 | |||
150 | //- Recalculate moments in the specified cell | ||
151 | void updateLocalMoments(label celli); | ||
152 | |||
153 | //- Recalculate the quadrature nodes from the moments in the | ||
154 | // specified cell | ||
155 | bool updateLocalQuadrature | ||
156 | ( | ||
157 | label celli, | ||
158 | bool fatalErrorOnFailedRealizabilityTest = true | ||
159 | ); | ||
181 | 160 | }; | }; |
182 | 161 | ||
183 | 162 | ||
... | ... | public: | |
186 | 165 | } // End namespace Foam | } // End namespace Foam |
187 | 166 | ||
188 | 167 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
189 | |||
190 | #include "univariateQuadratureApproximationI.H" | ||
191 | |||
168 | #ifdef NoRepository | ||
169 | # include "quadratureApproximationI.H" | ||
170 | # include "quadratureApproximation.C" | ||
171 | #endif | ||
192 | 172 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
193 | 173 | ||
194 | 174 | #endif | #endif |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximationI.H renamed from multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximation/univariateQuadratureApproximation/univariateQuadratureApproximationI.H (similarity 54%) (mode: 100755) (index d757dae..00ad59d) | |||
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-2017 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::PtrList<Foam::extendedVolScalarNode>& | ||
29 | Foam::univariateQuadratureApproximation::nodes() const | ||
28 | template <class momentFieldSetType, class nodeType> | ||
29 | const word | ||
30 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::name() const | ||
30 | 31 | { | { |
31 | return nodes_(); | ||
32 | } | ||
33 | |||
34 | const Foam::volUnivariateMomentFieldSet& | ||
35 | Foam::univariateQuadratureApproximation::moments() const | ||
36 | { | ||
37 | return moments_; | ||
38 | } | ||
39 | |||
40 | Foam::volUnivariateMomentFieldSet& | ||
41 | Foam::univariateQuadratureApproximation::moments() | ||
42 | { | ||
43 | return moments_; | ||
32 | return name_; | ||
44 | 33 | } | } |
45 | 34 | ||
46 | const Foam::basicSurfaceUnivariateMomentFieldSet& | ||
47 | Foam::univariateQuadratureApproximation::momentsNei() const | ||
35 | template <class momentFieldSetType, class nodeType> | ||
36 | Foam::fieldMomentInversion& | ||
37 | Foam::quadratureApproximation<momentFieldSetType, nodeType> | ||
38 | ::momentFieldInverter() | ||
48 | 39 | { | { |
49 | return momentsNei_; | ||
40 | return momentFieldInverter_(); | ||
50 | 41 | } | } |
51 | 42 | ||
52 | Foam::basicSurfaceUnivariateMomentFieldSet& | ||
53 | Foam::univariateQuadratureApproximation::momentsNei() | ||
43 | template <class momentFieldSetType, class nodeType> | ||
44 | const Foam::PtrList<nodeType>& | ||
45 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nodes() const | ||
54 | 46 | { | { |
55 | return momentsNei_; | ||
47 | return nodes_(); | ||
56 | 48 | } | } |
57 | 49 | ||
58 | const Foam::basicSurfaceUnivariateMomentFieldSet& | ||
59 | Foam::univariateQuadratureApproximation::momentsOwn() const | ||
50 | template <class momentFieldSetType, class nodeType> | ||
51 | const momentFieldSetType& | ||
52 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::moments() const | ||
60 | 53 | { | { |
61 | return momentsOwn_; | ||
54 | return moments_; | ||
62 | 55 | } | } |
63 | 56 | ||
64 | Foam::basicSurfaceUnivariateMomentFieldSet& | ||
65 | Foam::univariateQuadratureApproximation::momentsOwn() | ||
57 | template <class momentFieldSetType, class nodeType> | ||
58 | momentFieldSetType& | ||
59 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::moments() | ||
66 | 60 | { | { |
67 | return momentsOwn_; | ||
61 | return moments_; | ||
68 | 62 | } | } |
69 | 63 | ||
70 | Foam::label Foam::univariateQuadratureApproximation::nDimensions() const | ||
64 | template <class momentFieldSetType, class nodeType> | ||
65 | Foam::label | ||
66 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nDimensions() const | ||
71 | 67 | { | { |
72 | 68 | return nDimensions_; | return nDimensions_; |
73 | 69 | } | } |
74 | 70 | ||
75 | Foam::label Foam::univariateQuadratureApproximation::nMoments() const | ||
71 | template <class momentFieldSetType, class nodeType> | ||
72 | Foam::label | ||
73 | Foam::quadratureApproximation<momentFieldSetType, nodeType>::nMoments() const | ||
76 | 74 | { | { |
77 | 75 | return nMoments_; | return nMoments_; |
78 | 76 | } | } |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureApproximations/quadratureApproximations.H copied from file multiphaseEulerPbeFoam/quadratureMethods/moments/moments.H (similarity 76%) (mode: 100644) (index 46e0acc..3b71911) | |||
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-2017 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::moments | ||
24 | InClass | ||
25 | Foam::quadratureApproximations | ||
26 | 26 | ||
27 | 27 | Description | Description |
28 | 28 | ||
... | ... | SourceFiles | |
30 | 30 | ||
31 | 31 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
32 | 32 | ||
33 | #ifndef moments_H | ||
34 | #define moments_H | ||
33 | #ifndef quadratureApproximations_H | ||
34 | #define quadratureApproximations_H | ||
35 | 35 | ||
36 | 36 | #include "volFields.H" | #include "volFields.H" |
37 | 37 | #include "quadratureNodes.H" | #include "quadratureNodes.H" |
38 | #include "moment.H" | ||
38 | #include "momentFieldSets.H" | ||
39 | #include "quadratureApproximation.H" | ||
40 | #include "monoKineticQuadratureApproximation.H" | ||
39 | 41 | ||
40 | 42 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 43 | ||
42 | 44 | namespace Foam | namespace Foam |
43 | 45 | { | { |
44 | 46 | ||
45 | typedef moment<volScalarField, extendedVolScalarNode> volUnivariateMoment; | ||
46 | |||
47 | typedef moment<surfaceScalarField, extendedSurfaceScalarNode> | ||
48 | surfaceUnivariateMoment; | ||
49 | |||
50 | typedef moment<volScalarField, extendedVolScalarNode> basicVolUnivariateMoment; | ||
51 | |||
52 | typedef moment<surfaceScalarField, basicSurfaceScalarNode> | ||
53 | basicSurfaceUnivariateMoment; | ||
47 | typedef quadratureApproximation<volUnivariateMomentFieldSet, volScalarNode> | ||
48 | univariateQuadratureApproximation; | ||
54 | 49 | ||
55 | 50 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
56 | 51 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/extendedQuadratureNode.C deleted (index e6c47e3..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 | #include "extendedQuadratureNode.H" | ||
27 | |||
28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
29 | template <class weightType, class abscissaType, class sigmaType> | ||
30 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
31 | extendedQuadratureNode | ||
32 | ( | ||
33 | const word& name, | ||
34 | const word& distributionName, | ||
35 | const label nSecondaryNodes, | ||
36 | const fvMesh& mesh, | ||
37 | const dimensionSet& weightDimensions, | ||
38 | const dimensionSet& abscissaDimensions | ||
39 | ) | ||
40 | : | ||
41 | quadratureNode<weightType, abscissaType> | ||
42 | ( | ||
43 | name, | ||
44 | distributionName, | ||
45 | mesh, | ||
46 | weightDimensions, | ||
47 | abscissaDimensions | ||
48 | ), | ||
49 | name_(IOobject::groupName(name, distributionName)), | ||
50 | nSecondaryNodes_(nSecondaryNodes), | ||
51 | secondaryWeights_(nSecondaryNodes_), | ||
52 | secondaryAbscissae_(nSecondaryNodes_), | ||
53 | sigma_ | ||
54 | ( | ||
55 | IOobject | ||
56 | ( | ||
57 | IOobject::groupName(name_, "sigma"), | ||
58 | mesh.time().timeName(), | ||
59 | mesh, | ||
60 | IOobject::NO_READ, | ||
61 | IOobject::NO_WRITE | ||
62 | ), | ||
63 | mesh, | ||
64 | dimensioned<typename sigmaType::value_type> | ||
65 | ( | ||
66 | "zeroSigma", | ||
67 | dimless, | ||
68 | pTraits<typename sigmaType::value_type>::zero | ||
69 | ) | ||
70 | ), | ||
71 | extended_(true) | ||
72 | { | ||
73 | forAll(secondaryWeights_, nodei) | ||
74 | { | ||
75 | secondaryWeights_.set | ||
76 | ( | ||
77 | nodei, | ||
78 | new weightType | ||
79 | ( | ||
80 | IOobject | ||
81 | ( | ||
82 | IOobject::groupName | ||
83 | ( | ||
84 | name_, | ||
85 | "secondaryWeight." + Foam::name(nodei) | ||
86 | ), | ||
87 | mesh.time().timeName(), | ||
88 | mesh, | ||
89 | IOobject::NO_READ, | ||
90 | IOobject::NO_WRITE | ||
91 | ), | ||
92 | mesh, | ||
93 | dimensioned<typename weightType::value_type> | ||
94 | ( | ||
95 | "zeroWeight", | ||
96 | dimless, | ||
97 | pTraits<typename weightType::value_type>::zero | ||
98 | ) | ||
99 | ) | ||
100 | ); | ||
101 | |||
102 | secondaryAbscissae_.set | ||
103 | ( | ||
104 | nodei, | ||
105 | new abscissaType | ||
106 | ( | ||
107 | IOobject | ||
108 | ( | ||
109 | IOobject::groupName | ||
110 | ( | ||
111 | name_, | ||
112 | "secondaryAbscissa." + Foam::name(nodei) | ||
113 | ), | ||
114 | mesh.time().timeName(), | ||
115 | mesh, | ||
116 | IOobject::NO_READ, | ||
117 | IOobject::NO_WRITE | ||
118 | ), | ||
119 | mesh, | ||
120 | dimensioned<typename abscissaType::value_type> | ||
121 | ( | ||
122 | "zeroAbscissa", | ||
123 | abscissaDimensions, | ||
124 | pTraits<typename abscissaType::value_type>::zero | ||
125 | ) | ||
126 | ) | ||
127 | ); | ||
128 | } | ||
129 | } | ||
130 | |||
131 | |||
132 | template <class weightType, class abscissaType, class sigmaType> | ||
133 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
134 | extendedQuadratureNode | ||
135 | ( | ||
136 | const word& name, | ||
137 | const word& distributionName, | ||
138 | const dictionary& nodeDict, | ||
139 | const fvMesh& mesh, | ||
140 | const dimensionSet& weightDimensions, | ||
141 | const dimensionSet& abscissaDimensions, | ||
142 | const wordList& boundaryTypes | ||
143 | ) | ||
144 | : | ||
145 | quadratureNode<weightType, abscissaType> | ||
146 | ( | ||
147 | name, | ||
148 | distributionName, | ||
149 | nodeDict, | ||
150 | mesh, | ||
151 | weightDimensions, | ||
152 | abscissaDimensions, | ||
153 | boundaryTypes | ||
154 | ), | ||
155 | name_(IOobject::groupName(name, distributionName)), | ||
156 | nSecondaryNodes_ | ||
157 | ( | ||
158 | nodeDict.lookupOrDefault("nSecondaryNodes", 10) | ||
159 | ), | ||
160 | secondaryWeights_(nSecondaryNodes_), | ||
161 | secondaryAbscissae_(nSecondaryNodes_), | ||
162 | sigma_ | ||
163 | ( | ||
164 | IOobject | ||
165 | ( | ||
166 | IOobject::groupName(name_, "sigma"), | ||
167 | mesh.time().timeName(), | ||
168 | mesh, | ||
169 | IOobject::NO_READ, | ||
170 | IOobject::NO_WRITE | ||
171 | ), | ||
172 | mesh, | ||
173 | dimensioned<typename sigmaType::value_type> | ||
174 | ( | ||
175 | "zeroSigma", | ||
176 | dimless, | ||
177 | pTraits<typename sigmaType::value_type>::zero | ||
178 | ), | ||
179 | boundaryTypes | ||
180 | ), | ||
181 | extended_(true) | ||
182 | { | ||
183 | forAll(secondaryWeights_, nodei) | ||
184 | { | ||
185 | secondaryWeights_.set | ||
186 | ( | ||
187 | nodei, | ||
188 | new weightType | ||
189 | ( | ||
190 | IOobject | ||
191 | ( | ||
192 | IOobject::groupName | ||
193 | ( | ||
194 | name_, | ||
195 | "secondaryWeight." + Foam::name(nodei) | ||
196 | ), | ||
197 | mesh.time().timeName(), | ||
198 | mesh, | ||
199 | IOobject::NO_READ, | ||
200 | IOobject::NO_WRITE | ||
201 | ), | ||
202 | mesh, | ||
203 | dimensioned<typename weightType::value_type> | ||
204 | ( | ||
205 | "zeroWeight", | ||
206 | dimless, | ||
207 | pTraits<typename weightType::value_type>::zero | ||
208 | ), | ||
209 | boundaryTypes | ||
210 | ) | ||
211 | ); | ||
212 | |||
213 | secondaryAbscissae_.set | ||
214 | ( | ||
215 | nodei, | ||
216 | new abscissaType | ||
217 | ( | ||
218 | IOobject | ||
219 | ( | ||
220 | IOobject::groupName | ||
221 | ( | ||
222 | name_, | ||
223 | "secondaryAbscissa." + Foam::name(nodei) | ||
224 | ), | ||
225 | mesh.time().timeName(), | ||
226 | mesh, | ||
227 | IOobject::NO_READ, | ||
228 | IOobject::NO_WRITE | ||
229 | ), | ||
230 | mesh, | ||
231 | dimensioned<typename abscissaType::value_type> | ||
232 | ( | ||
233 | "zeroAbscissa", | ||
234 | abscissaDimensions, | ||
235 | pTraits<typename abscissaType::value_type>::zero | ||
236 | ), | ||
237 | boundaryTypes | ||
238 | ) | ||
239 | ); | ||
240 | } | ||
241 | } | ||
242 | |||
243 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | ||
244 | |||
245 | template <class weightType, class abscissaType, class sigmaType> | ||
246 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
247 | ~extendedQuadratureNode() | ||
248 | {} | ||
249 | |||
250 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
251 | |||
252 | template <class weightType, class abscissaType, class sigmaType> | ||
253 | Foam::autoPtr | ||
254 | < | ||
255 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
256 | > | ||
257 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>::clone() const | ||
258 | { | ||
259 | notImplemented("extendedQuadratureNode::clone() const"); | ||
260 | return autoPtr | ||
261 | < | ||
262 | extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
263 | >(NULL); | ||
264 | } | ||
265 | |||
266 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/extendedQuadratureNode.H deleted (index 99cdd32..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 | Class | ||
25 | Foam::extendedQuadratureNode | ||
26 | |||
27 | Description | ||
28 | Extended version of the quadrature node, which stores the list of secondary | ||
29 | weights and abscissae associated to the primary weight and abscissa, and | ||
30 | the sigma parameter. | ||
31 | |||
32 | SourceFiles | ||
33 | extendedQuadratureNode.C | ||
34 | extendedQuadratureNodeI.H | ||
35 | |||
36 | \*---------------------------------------------------------------------------*/ | ||
37 | |||
38 | #ifndef extendedQuadratureNode_H | ||
39 | #define extendedQuadratureNode_H | ||
40 | |||
41 | #include "fvMesh.H" | ||
42 | #include "PtrList.H" | ||
43 | #include "dictionary.H" | ||
44 | #include "dictionaryEntry.H" | ||
45 | #include "quadratureNode.H" | ||
46 | |||
47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
48 | |||
49 | namespace Foam | ||
50 | { | ||
51 | |||
52 | /*---------------------------------------------------------------------------*\ | ||
53 | Class extendedQuadratureNode Declaration | ||
54 | \*---------------------------------------------------------------------------*/ | ||
55 | template <class weightType, class abscissaType, class sigmaType> | ||
56 | class extendedQuadratureNode | ||
57 | : | ||
58 | public quadratureNode<weightType, abscissaType> | ||
59 | { | ||
60 | // Private data | ||
61 | |||
62 | //- Name of the quadrature node | ||
63 | word name_; | ||
64 | |||
65 | //- Number of secondary nodes | ||
66 | label nSecondaryNodes_; | ||
67 | |||
68 | //- List of secondary weights of the node | ||
69 | PtrList<weightType> secondaryWeights_; | ||
70 | |||
71 | //- List of secondary abscissae of the node | ||
72 | PtrList<abscissaType> secondaryAbscissae_; | ||
73 | |||
74 | //- Parameter of the kernel density function used in EQMOM | ||
75 | sigmaType sigma_; | ||
76 | |||
77 | //- Boolean variable to identify extended nodes | ||
78 | bool extended_; | ||
79 | |||
80 | public: | ||
81 | |||
82 | // Constructors | ||
83 | |||
84 | //- Construct from name, dictionary, mesh and dimensions | ||
85 | extendedQuadratureNode | ||
86 | ( | ||
87 | const word& name, | ||
88 | const word& distributionName, | ||
89 | const dictionary& nodeDict, | ||
90 | const fvMesh& mesh, | ||
91 | const dimensionSet& weightDimensions, | ||
92 | const dimensionSet& abscissaDimensions, | ||
93 | const wordList& boundaryTypes | ||
94 | ); | ||
95 | |||
96 | //- Construct from name, number of secondary nodes, mesh and dimensions | ||
97 | extendedQuadratureNode | ||
98 | ( | ||
99 | const word& name, | ||
100 | const word& distributionName, | ||
101 | const label nSecondaryNodes, | ||
102 | const fvMesh& mesh, | ||
103 | const dimensionSet& weightDimensions, | ||
104 | const dimensionSet& abscissaDimensions | ||
105 | ); | ||
106 | |||
107 | //- Return clone | ||
108 | autoPtr<extendedQuadratureNode<weightType, abscissaType, sigmaType>> | ||
109 | clone() const; | ||
110 | |||
111 | //- Return a pointer to a new quadrature node created on freestore | ||
112 | // from Istream | ||
113 | class iNew | ||
114 | { | ||
115 | const word distributionName_; | ||
116 | const fvMesh& mesh_; | ||
117 | const dimensionSet& weightDimensions_; | ||
118 | const dimensionSet& abscissaDimensions_; | ||
119 | const wordList& boundaryTypes_; | ||
120 | |||
121 | public: | ||
122 | |||
123 | iNew | ||
124 | ( | ||
125 | const word& distributionName, | ||
126 | const fvMesh& mesh, | ||
127 | const dimensionSet& weightDimensions, | ||
128 | const dimensionSet& abscissaDimensions, | ||
129 | const wordList& boundaryTypes | ||
130 | ) | ||
131 | : | ||
132 | distributionName_(distributionName), | ||
133 | mesh_(mesh), | ||
134 | weightDimensions_(weightDimensions), | ||
135 | abscissaDimensions_(abscissaDimensions), | ||
136 | boundaryTypes_(boundaryTypes) | ||
137 | {} | ||
138 | |||
139 | autoPtr | ||
140 | < | ||
141 | extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
142 | > | ||
143 | operator() | ||
144 | ( | ||
145 | Istream& is | ||
146 | ) const | ||
147 | { | ||
148 | dictionaryEntry ent(dictionary::null, is); | ||
149 | return autoPtr | ||
150 | < | ||
151 | extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
152 | > | ||
153 | ( | ||
154 | new extendedQuadratureNode | ||
155 | < | ||
156 | weightType, abscissaType, sigmaType | ||
157 | > | ||
158 | ( | ||
159 | ent.keyword(), | ||
160 | distributionName_, | ||
161 | ent, | ||
162 | mesh_, | ||
163 | weightDimensions_, | ||
164 | abscissaDimensions_, | ||
165 | boundaryTypes_ | ||
166 | ) | ||
167 | ); | ||
168 | } | ||
169 | }; | ||
170 | |||
171 | |||
172 | //- Destructor | ||
173 | virtual ~extendedQuadratureNode(); | ||
174 | |||
175 | |||
176 | // Member Functions | ||
177 | |||
178 | // Access | ||
179 | |||
180 | //- Return the name of the node | ||
181 | inline const word& name() const; | ||
182 | |||
183 | inline bool extended() const; | ||
184 | |||
185 | //- Returns the number of secondary nodes | ||
186 | inline label nSecondaryNodes() const; | ||
187 | |||
188 | //- Const access to the secondary weights of the node | ||
189 | inline const PtrList<weightType>& secondaryWeights() const; | ||
190 | |||
191 | //- Non-const access to the secondary weights of the node | ||
192 | inline PtrList<weightType>& secondaryWeights(); | ||
193 | |||
194 | //- Const access to the list of secondary abscissae of the node | ||
195 | inline const PtrList<abscissaType>& secondaryAbscissae() const; | ||
196 | |||
197 | //- Non-const access to the list of secondary abscissae of the node | ||
198 | inline PtrList<abscissaType>& secondaryAbscissae(); | ||
199 | |||
200 | //- Const access to sigma | ||
201 | inline const sigmaType& sigma() const; | ||
202 | |||
203 | //- Non-const access to sigma | ||
204 | inline sigmaType& sigma(); | ||
205 | }; | ||
206 | |||
207 | |||
208 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
209 | |||
210 | } // End namespace Foam | ||
211 | |||
212 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
213 | #ifdef NoRepository | ||
214 | # include "extendedQuadratureNodeI.H" | ||
215 | # include "extendedQuadratureNode.C" | ||
216 | #endif | ||
217 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
218 | |||
219 | #endif | ||
220 | |||
221 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/extendedQuadratureNodeI.H deleted (index 67d273c..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::extendedQuadratureNode<weightType, abscissaType, sigmaType>::name() const | ||
30 | { | ||
31 | return name_; | ||
32 | } | ||
33 | |||
34 | template <class weightType, class abscissaType, class sigmaType> | ||
35 | inline bool Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
36 | extended() const | ||
37 | { | ||
38 | return extended_; | ||
39 | } | ||
40 | |||
41 | template <class weightType, class abscissaType, class sigmaType> | ||
42 | Foam::label | ||
43 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
44 | nSecondaryNodes() const | ||
45 | { | ||
46 | return nSecondaryNodes_; | ||
47 | } | ||
48 | |||
49 | template <class weightType, class abscissaType, class sigmaType> | ||
50 | const Foam::PtrList<weightType>& | ||
51 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
52 | secondaryWeights() const | ||
53 | { | ||
54 | return secondaryWeights_; | ||
55 | } | ||
56 | |||
57 | template <class weightType, class abscissaType, class sigmaType> | ||
58 | Foam::PtrList<weightType>& | ||
59 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>:: | ||
60 | secondaryWeights() | ||
61 | { | ||
62 | return secondaryWeights_; | ||
63 | } | ||
64 | |||
65 | template <class weightType, class abscissaType, class sigmaType> | ||
66 | const Foam::PtrList<abscissaType>& | ||
67 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
68 | ::secondaryAbscissae() const | ||
69 | { | ||
70 | return secondaryAbscissae_; | ||
71 | } | ||
72 | |||
73 | template <class weightType, class abscissaType, class sigmaType> | ||
74 | Foam::PtrList<abscissaType>& | ||
75 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
76 | ::secondaryAbscissae() | ||
77 | { | ||
78 | return secondaryAbscissae_; | ||
79 | } | ||
80 | |||
81 | template <class weightType, class abscissaType, class sigmaType> | ||
82 | const sigmaType& | ||
83 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType> | ||
84 | ::sigma() const | ||
85 | { | ||
86 | return sigma_; | ||
87 | } | ||
88 | |||
89 | template <class weightType, class abscissaType, class sigmaType> | ||
90 | sigmaType& | ||
91 | Foam::extendedQuadratureNode<weightType, abscissaType, sigmaType>::sigma() | ||
92 | { | ||
93 | return sigma_; | ||
94 | } | ||
95 | |||
96 | |||
97 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.C changed (mode: 100644) (index 18728fa..687d41b) | |||
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 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 2015-02-19 Alberto Passalacqua: Templated class on type of weight and abscissa. | ||
9 | 2015-11-02 Alberto Passalacqua: Generalized initialization of fields based on | ||
10 | value_type of the field. | ||
11 | ------------------------------------------------------------------------------- | ||
12 | 8 | License | License |
13 | 9 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
14 | 10 | ||
... | ... | License | |
30 | 26 | #include "quadratureNode.H" | #include "quadratureNode.H" |
31 | 27 | ||
32 | 28 | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // |
33 | template <class weightType, class abscissaType> | ||
34 | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | ||
29 | template <class weightType, class abscissaType, class sigmaType> | ||
30 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
31 | quadratureNode | ||
35 | 32 | ( | ( |
36 | 33 | const word& name, | const word& name, |
37 | 34 | const word& distributionName, | const word& distributionName, |
38 | 35 | const fvMesh& mesh, | const fvMesh& mesh, |
39 | 36 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
40 | const dimensionSet& abscissaDimensions | ||
37 | const dimensionSet& abscissaDimensions, | ||
38 | const bool extended, | ||
39 | const label nSecondaryNodes | ||
41 | 40 | ) | ) |
42 | 41 | : | : |
43 | 42 | name_(IOobject::groupName(name, distributionName)), | name_(IOobject::groupName(name, distributionName)), |
43 | nodeDict_(), | ||
44 | 44 | weight_ | weight_ |
45 | 45 | ( | ( |
46 | 46 | IOobject | IOobject |
... | ... | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | |
77 | 77 | pTraits<typename abscissaType::value_type>::zero | pTraits<typename abscissaType::value_type>::zero |
78 | 78 | ) | ) |
79 | 79 | ), | ), |
80 | extended_(false) | ||
81 | {} | ||
80 | secondaryWeights_(), | ||
81 | secondaryAbscissae_(), | ||
82 | sigma_(), | ||
83 | nSecondaryNodes_(nSecondaryNodes), | ||
84 | extended_(extended) | ||
85 | { | ||
86 | if (extended_) | ||
87 | { | ||
88 | // Allocating secondary quadrature only if the node is of extended type | ||
89 | secondaryWeights_.setSize(nSecondaryNodes_); | ||
90 | secondaryAbscissae_.setSize(nSecondaryNodes_); | ||
91 | |||
92 | // Allocating secondary weights and abscissae | ||
93 | forAll(secondaryWeights_, nodei) | ||
94 | { | ||
95 | secondaryWeights_.set | ||
96 | ( | ||
97 | nodei, | ||
98 | new weightType | ||
99 | ( | ||
100 | IOobject | ||
101 | ( | ||
102 | IOobject::groupName | ||
103 | ( | ||
104 | name_, | ||
105 | "secondaryWeight." + Foam::name(nodei) | ||
106 | ), | ||
107 | mesh.time().timeName(), | ||
108 | mesh, | ||
109 | IOobject::NO_READ, | ||
110 | IOobject::NO_WRITE | ||
111 | ), | ||
112 | mesh, | ||
113 | dimensioned<typename weightType::value_type> | ||
114 | ( | ||
115 | "zeroWeight", | ||
116 | dimless, | ||
117 | pTraits<typename weightType::value_type>::zero | ||
118 | ) | ||
119 | ) | ||
120 | ); | ||
82 | 121 | ||
122 | secondaryAbscissae_.set | ||
123 | ( | ||
124 | nodei, | ||
125 | new abscissaType | ||
126 | ( | ||
127 | IOobject | ||
128 | ( | ||
129 | IOobject::groupName | ||
130 | ( | ||
131 | name_, | ||
132 | "secondaryAbscissa." + Foam::name(nodei) | ||
133 | ), | ||
134 | mesh.time().timeName(), | ||
135 | mesh, | ||
136 | IOobject::NO_READ, | ||
137 | IOobject::NO_WRITE | ||
138 | ), | ||
139 | mesh, | ||
140 | dimensioned<typename abscissaType::value_type> | ||
141 | ( | ||
142 | "zeroAbscissa", | ||
143 | abscissaDimensions, | ||
144 | pTraits<typename abscissaType::value_type>::zero | ||
145 | ) | ||
146 | ) | ||
147 | ); | ||
148 | } | ||
83 | 149 | ||
84 | template <class weightType, class abscissaType> | ||
85 | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | ||
150 | // Allocating sigma | ||
151 | sigma_ = autoPtr<sigmaType> | ||
152 | ( | ||
153 | new sigmaType | ||
154 | ( | ||
155 | IOobject | ||
156 | ( | ||
157 | IOobject::groupName(name_, "sigma"), | ||
158 | mesh.time().timeName(), | ||
159 | mesh, | ||
160 | IOobject::NO_READ, | ||
161 | IOobject::NO_WRITE | ||
162 | ), | ||
163 | mesh, | ||
164 | dimensioned<typename sigmaType::value_type> | ||
165 | ( | ||
166 | "zeroSigma", | ||
167 | dimless, | ||
168 | pTraits<typename sigmaType::value_type>::zero | ||
169 | ) | ||
170 | ) | ||
171 | ); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | |||
176 | template <class weightType, class abscissaType, class sigmaType> | ||
177 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
178 | quadratureNode | ||
86 | 179 | ( | ( |
87 | 180 | const word& name, | const word& name, |
88 | 181 | const word& distributionName, | const word& distributionName, |
... | ... | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | |
90 | 183 | const fvMesh& mesh, | const fvMesh& mesh, |
91 | 184 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
92 | 185 | const dimensionSet& abscissaDimensions, | const dimensionSet& abscissaDimensions, |
93 | const wordList& boundaryTypes | ||
186 | const wordList& boundaryTypes, | ||
187 | const bool extended, | ||
188 | const label nSecondaryNodes | ||
94 | 189 | ) | ) |
95 | 190 | : | : |
96 | 191 | name_(IOobject::groupName(name, distributionName)), | name_(IOobject::groupName(name, distributionName)), |
... | ... | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | |
111 | 206 | "zeroWeight", | "zeroWeight", |
112 | 207 | weightDimensions, | weightDimensions, |
113 | 208 | pTraits<typename weightType::value_type>::zero | pTraits<typename weightType::value_type>::zero |
114 | ), | ||
115 | boundaryTypes | ||
209 | ) | ||
116 | 210 | ), | ), |
117 | 211 | abscissa_ | abscissa_ |
118 | 212 | ( | ( |
... | ... | Foam::quadratureNode<weightType, abscissaType>::quadratureNode | |
130 | 224 | "zeroAbscissa", | "zeroAbscissa", |
131 | 225 | abscissaDimensions, | abscissaDimensions, |
132 | 226 | pTraits<typename abscissaType::value_type>::zero | pTraits<typename abscissaType::value_type>::zero |
133 | ), | ||
134 | boundaryTypes | ||
227 | ) | ||
135 | 228 | ), | ), |
136 | extended_(false) | ||
137 | {} | ||
229 | secondaryWeights_(), | ||
230 | secondaryAbscissae_(), | ||
231 | sigma_(), | ||
232 | nSecondaryNodes_(nSecondaryNodes), | ||
233 | extended_(extended) | ||
234 | { | ||
235 | if (extended_) | ||
236 | { | ||
237 | // Allocating secondary quadrature only if the node is of extended type | ||
238 | secondaryWeights_.setSize(nSecondaryNodes_); | ||
239 | secondaryAbscissae_.setSize(nSecondaryNodes_); | ||
240 | |||
241 | // Allocating secondary weights and abscissae | ||
242 | forAll(secondaryWeights_, nodei) | ||
243 | { | ||
244 | secondaryWeights_.set | ||
245 | ( | ||
246 | nodei, | ||
247 | new weightType | ||
248 | ( | ||
249 | IOobject | ||
250 | ( | ||
251 | IOobject::groupName | ||
252 | ( | ||
253 | name_, | ||
254 | "secondaryWeight." + Foam::name(nodei) | ||
255 | ), | ||
256 | mesh.time().timeName(), | ||
257 | mesh, | ||
258 | IOobject::NO_READ, | ||
259 | IOobject::NO_WRITE | ||
260 | ), | ||
261 | mesh, | ||
262 | dimensioned<typename weightType::value_type> | ||
263 | ( | ||
264 | "zeroWeight", | ||
265 | dimless, | ||
266 | pTraits<typename weightType::value_type>::zero | ||
267 | ), | ||
268 | boundaryTypes | ||
269 | ) | ||
270 | ); | ||
271 | |||
272 | secondaryAbscissae_.set | ||
273 | ( | ||
274 | nodei, | ||
275 | new abscissaType | ||
276 | ( | ||
277 | IOobject | ||
278 | ( | ||
279 | IOobject::groupName | ||
280 | ( | ||
281 | name_, | ||
282 | "secondaryAbscissa." + Foam::name(nodei) | ||
283 | ), | ||
284 | mesh.time().timeName(), | ||
285 | mesh, | ||
286 | IOobject::NO_READ, | ||
287 | IOobject::NO_WRITE | ||
288 | ), | ||
289 | mesh, | ||
290 | dimensioned<typename abscissaType::value_type> | ||
291 | ( | ||
292 | "zeroAbscissa", | ||
293 | abscissaDimensions, | ||
294 | pTraits<typename abscissaType::value_type>::zero | ||
295 | ), | ||
296 | boundaryTypes | ||
297 | ) | ||
298 | ); | ||
299 | |||
300 | sigma_ = autoPtr<sigmaType> | ||
301 | ( | ||
302 | new sigmaType | ||
303 | ( | ||
304 | IOobject | ||
305 | ( | ||
306 | IOobject::groupName(name_, "sigma"), | ||
307 | mesh.time().timeName(), | ||
308 | mesh, | ||
309 | IOobject::NO_READ, | ||
310 | IOobject::NO_WRITE | ||
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 | } | ||
138 | 325 | ||
139 | 326 | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // |
140 | 327 | ||
141 | template <class weightType, class abscissaType> | ||
142 | Foam::quadratureNode<weightType, abscissaType>::~quadratureNode() | ||
328 | template <class weightType, class abscissaType, class sigmaType> | ||
329 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
330 | ~quadratureNode() | ||
143 | 331 | {} | {} |
144 | 332 | ||
145 | 333 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
146 | 334 | ||
147 | template <class weightType, class abscissaType> | ||
148 | Foam::autoPtr<Foam::quadratureNode<weightType, abscissaType>> | ||
149 | Foam::quadratureNode<weightType, abscissaType>::clone() const | ||
335 | template <class weightType, class abscissaType, class sigmaType> | ||
336 | Foam::autoPtr | ||
337 | < | ||
338 | Foam::quadratureNode<weightType, abscissaType, sigmaType> | ||
339 | > | ||
340 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::clone() const | ||
150 | 341 | { | { |
151 | 342 | notImplemented("quadratureNode::clone() const"); | notImplemented("quadratureNode::clone() const"); |
152 | return autoPtr<quadratureNode<weightType, abscissaType>>(NULL); | ||
343 | return autoPtr | ||
344 | < | ||
345 | quadratureNode<weightType, abscissaType, sigmaType> | ||
346 | >(NULL); | ||
153 | 347 | } | } |
154 | 348 | ||
155 | 349 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNode.H changed (mode: 100644) (index 7e56aac..3016bd4) | |||
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 OpenFOAM Foundation | ||
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 2015-02-19 Alberto Passalacqua: Templated class on type of weight and abscissa | ||
9 | to store a basic quadrature node made of weight | ||
10 | and abscissa. | ||
11 | 2015-11-02 Alberto Passalacqua: Generalized initialization of fields based on | ||
12 | value_type of the field. | ||
13 | 2015-11-05 Alberto Passalacqua: Added interface functions for secondary | ||
14 | quadrature (not implemented). | ||
15 | ------------------------------------------------------------------------------- | ||
16 | 8 | License | License |
17 | 9 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
18 | 10 | ||
... | ... | Class | |
33 | 25 | Foam::quadratureNode | Foam::quadratureNode |
34 | 26 | ||
35 | 27 | Description | Description |
36 | Stores a quadrature weight and a quadrature abscissa, whose type is | ||
37 | templated. | ||
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. | ||
38 | 31 | ||
39 | 32 | SourceFiles | SourceFiles |
40 | 33 | quadratureNode.C | quadratureNode.C |
... | ... | namespace Foam | |
58 | 51 | /*---------------------------------------------------------------------------*\ | /*---------------------------------------------------------------------------*\ |
59 | 52 | Class quadratureNode Declaration | Class quadratureNode Declaration |
60 | 53 | \*---------------------------------------------------------------------------*/ | \*---------------------------------------------------------------------------*/ |
61 | template <class weightType, class abscissaType> | ||
54 | template <class weightType, class abscissaType, class sigmaType> | ||
62 | 55 | class quadratureNode | class quadratureNode |
63 | 56 | { | { |
64 | 57 | // Private data | // Private data |
65 | 58 | ||
66 | //- Name of node | ||
67 | const word name_; | ||
59 | //- Name of the quadrature node | ||
60 | word name_; | ||
68 | 61 | ||
69 | 62 | //- Node dictionary | //- Node dictionary |
70 | 63 | dictionary nodeDict_; | dictionary nodeDict_; |
... | ... | class quadratureNode | |
75 | 68 | //- Primary abscissa of the node | //- Primary abscissa of the node |
76 | 69 | abscissaType abscissa_; | abscissaType abscissa_; |
77 | 70 | ||
71 | //- List of secondary weights of the node | ||
72 | PtrList<weightType> secondaryWeights_; | ||
73 | |||
74 | //- List of secondary abscissae of the node | ||
75 | PtrList<abscissaType> secondaryAbscissae_; | ||
76 | |||
77 | //- Parameter of the kernel density function used in EQMOM | ||
78 | autoPtr<sigmaType> sigma_; | ||
79 | |||
80 | //- Number of secondary nodes | ||
81 | label nSecondaryNodes_; | ||
82 | |||
78 | 83 | //- Boolean variable to identify extended nodes | //- Boolean variable to identify extended nodes |
79 | 84 | bool extended_; | bool extended_; |
80 | 85 | ||
... | ... | public: | |
91 | 96 | const fvMesh& mesh, | const fvMesh& mesh, |
92 | 97 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
93 | 98 | const dimensionSet& abscissaDimensions, | const dimensionSet& abscissaDimensions, |
94 | const wordList& boundaryTypes | ||
99 | const wordList& boundaryTypes, | ||
100 | const bool extended = false, | ||
101 | const label nSecondaryNodes = 0 | ||
95 | 102 | ); | ); |
96 | 103 | ||
97 | //- Construct from name, mesh and dimensions | ||
104 | //- Construct from name, number of secondary nodes, mesh and dimensions | ||
98 | 105 | quadratureNode | quadratureNode |
99 | 106 | ( | ( |
100 | 107 | const word& name, | const word& name, |
101 | 108 | const word& distributionName, | const word& distributionName, |
102 | 109 | const fvMesh& mesh, | const fvMesh& mesh, |
103 | 110 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
104 | const dimensionSet& abscissaDimensions | ||
111 | const dimensionSet& abscissaDimensions, | ||
112 | const bool extended = false, | ||
113 | const label nSecondaryNodes = 0 | ||
105 | 114 | ); | ); |
106 | 115 | ||
107 | 116 | //- Return clone | //- Return clone |
108 | autoPtr<quadratureNode<weightType, abscissaType>> clone() const; | ||
117 | autoPtr<quadratureNode<weightType, abscissaType, sigmaType>> | ||
118 | clone() const; | ||
109 | 119 | ||
110 | 120 | //- Return a pointer to a new quadrature node created on freestore | //- Return a pointer to a new quadrature node created on freestore |
111 | 121 | // from Istream | // from Istream |
... | ... | public: | |
116 | 126 | const dimensionSet& weightDimensions_; | const dimensionSet& weightDimensions_; |
117 | 127 | const dimensionSet& abscissaDimensions_; | const dimensionSet& abscissaDimensions_; |
118 | 128 | const wordList& boundaryTypes_; | const wordList& boundaryTypes_; |
129 | const bool extended_; | ||
130 | const label nSecondaryNodes_; | ||
119 | 131 | ||
120 | 132 | public: | public: |
121 | 133 | ||
... | ... | public: | |
125 | 137 | const fvMesh& mesh, | const fvMesh& mesh, |
126 | 138 | const dimensionSet& weightDimensions, | const dimensionSet& weightDimensions, |
127 | 139 | const dimensionSet& abscissaDimensions, | const dimensionSet& abscissaDimensions, |
128 | const wordList& boundaryTypes | ||
140 | const wordList& boundaryTypes, | ||
141 | const bool extended, | ||
142 | const label nSecondaryNodes | ||
129 | 143 | ) | ) |
130 | 144 | : | : |
131 | 145 | distributionName_(distributionName), | distributionName_(distributionName), |
132 | 146 | mesh_(mesh), | mesh_(mesh), |
133 | 147 | weightDimensions_(weightDimensions), | weightDimensions_(weightDimensions), |
134 | 148 | abscissaDimensions_(abscissaDimensions), | abscissaDimensions_(abscissaDimensions), |
135 | boundaryTypes_(boundaryTypes) | ||
149 | boundaryTypes_(boundaryTypes), | ||
150 | extended_(extended), | ||
151 | nSecondaryNodes_(nSecondaryNodes) | ||
136 | 152 | {} | {} |
137 | 153 | ||
138 | autoPtr<quadratureNode<weightType, abscissaType>> operator() | ||
154 | autoPtr | ||
155 | < | ||
156 | quadratureNode<weightType, abscissaType, sigmaType> | ||
157 | > | ||
158 | operator() | ||
139 | 159 | ( | ( |
140 | 160 | Istream& is | Istream& is |
141 | 161 | ) const | ) const |
142 | 162 | { | { |
143 | 163 | dictionaryEntry ent(dictionary::null, is); | dictionaryEntry ent(dictionary::null, is); |
144 | return autoPtr<quadratureNode<weightType, abscissaType>> | ||
164 | return autoPtr | ||
165 | < | ||
166 | quadratureNode<weightType, abscissaType, sigmaType> | ||
167 | > | ||
145 | 168 | ( | ( |
146 | new quadratureNode<weightType, abscissaType> | ||
169 | new quadratureNode | ||
170 | < | ||
171 | weightType, abscissaType, sigmaType | ||
172 | > | ||
147 | 173 | ( | ( |
148 | 174 | ent.keyword(), | ent.keyword(), |
149 | 175 | distributionName_, | distributionName_, |
... | ... | public: | |
151 | 177 | mesh_, | mesh_, |
152 | 178 | weightDimensions_, | weightDimensions_, |
153 | 179 | abscissaDimensions_, | abscissaDimensions_, |
154 | boundaryTypes_ | ||
180 | boundaryTypes_, | ||
181 | extended_, | ||
182 | nSecondaryNodes_ | ||
155 | 183 | ) | ) |
156 | 184 | ); | ); |
157 | 185 | } | } |
... | ... | public: | |
186 | 214 | //- Non-const access to the abscissa of the node | //- Non-const access to the abscissa of the node |
187 | 215 | inline abscissaType& primaryAbscissa(); | inline abscissaType& primaryAbscissa(); |
188 | 216 | ||
189 | //- Const access to the secondary weight of the node | ||
217 | //- Const access to the secondary weights of the node | ||
190 | 218 | inline const PtrList<weightType>& secondaryWeights() const; | inline const PtrList<weightType>& secondaryWeights() const; |
191 | 219 | ||
192 | //- Non-const access to the secondary weight of the node | ||
220 | //- Non-const access to the secondary weights of the node | ||
193 | 221 | inline PtrList<weightType>& secondaryWeights(); | inline PtrList<weightType>& secondaryWeights(); |
194 | 222 | ||
195 | 223 | //- Const access to the list of secondary abscissae of the node | //- Const access to the list of secondary abscissae of the node |
... | ... | public: | |
197 | 225 | ||
198 | 226 | //- Non-const access to the list of secondary abscissae of the node | //- Non-const access to the list of secondary abscissae of the node |
199 | 227 | inline PtrList<abscissaType>& secondaryAbscissae(); | inline PtrList<abscissaType>& secondaryAbscissae(); |
228 | |||
229 | //- Const access to sigma | ||
230 | inline const sigmaType& sigma() const; | ||
231 | |||
232 | //- Non-const access to sigma | ||
233 | inline sigmaType& sigma(); | ||
200 | 234 | }; | }; |
201 | 235 | ||
202 | 236 |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNodeI.H changed (mode: 100644) (index 296b9ed..23903cf) | |||
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 OpenFOAM Foundation | ||
6 | ------------------------------------------------------------------------------- | ||
7 | 2015-02-19 Alberto Passalacqua: Templated class on type of weight and abscissa. | ||
8 | 2015-11-05 Alberto Passalacqua: Added interface functions for secondary | ||
9 | quadrature (not implemented). | ||
5 | \\ / A nd | Copyright (C) 2015-2017 Alberto Passalacqua | ||
10 | 6 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
11 | 7 | License | License |
12 | 8 | This file is derivative work of OpenFOAM. | This file is derivative work of OpenFOAM. |
... | ... | License | |
28 | 24 | ||
29 | 25 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
30 | 26 | ||
31 | template <class weightType, class abscissaType> | ||
32 | const Foam::word& Foam::quadratureNode<weightType, abscissaType>::name() const | ||
27 | template <class weightType, class abscissaType, class sigmaType> | ||
28 | const Foam::word& | ||
29 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::name() const | ||
33 | 30 | { | { |
34 | 31 | return name_; | return name_; |
35 | 32 | } | } |
36 | 33 | ||
37 | template <class weightType, class abscissaType> | ||
38 | inline bool Foam::quadratureNode<weightType, abscissaType>::extended() const | ||
34 | template <class weightType, class abscissaType, class sigmaType> | ||
35 | inline bool Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
36 | extended() const | ||
39 | 37 | { | { |
40 | 38 | return extended_; | return extended_; |
41 | 39 | } | } |
42 | 40 | ||
43 | template <class weightType, class abscissaType> | ||
44 | Foam::label Foam::quadratureNode<weightType, abscissaType>:: | ||
41 | template <class weightType, class abscissaType, class sigmaType> | ||
42 | Foam::label | ||
43 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
45 | 44 | nSecondaryNodes() const | nSecondaryNodes() const |
46 | 45 | { | { |
47 | NotImplemented; | ||
48 | return 0; | ||
46 | return nSecondaryNodes_; | ||
49 | 47 | } | } |
50 | 48 | ||
51 | template <class weightType, class abscissaType> | ||
49 | template <class weightType, class abscissaType, class sigmaType> | ||
52 | 50 | const weightType& | const weightType& |
53 | Foam::quadratureNode<weightType, abscissaType>::primaryWeight() const | ||
51 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
52 | primaryWeight() const | ||
54 | 53 | { | { |
55 | 54 | return weight_; | return weight_; |
56 | 55 | } | } |
57 | 56 | ||
58 | template <class weightType, class abscissaType> | ||
59 | weightType& Foam::quadratureNode<weightType, abscissaType>::primaryWeight() | ||
57 | template <class weightType, class abscissaType, class sigmaType> | ||
58 | weightType& | ||
59 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::primaryWeight() | ||
60 | 60 | { | { |
61 | 61 | return weight_; | return weight_; |
62 | 62 | } | } |
63 | 63 | ||
64 | template <class weightType, class abscissaType> | ||
64 | template <class weightType, class abscissaType, class sigmaType> | ||
65 | 65 | const abscissaType& | const abscissaType& |
66 | Foam::quadratureNode<weightType, abscissaType>::primaryAbscissa() const | ||
66 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
67 | primaryAbscissa() const | ||
67 | 68 | { | { |
68 | 69 | return abscissa_; | return abscissa_; |
69 | 70 | } | } |
70 | 71 | ||
71 | template <class weightType, class abscissaType> | ||
72 | abscissaType& Foam::quadratureNode<weightType, abscissaType>::primaryAbscissa() | ||
72 | template <class weightType, class abscissaType, class sigmaType> | ||
73 | abscissaType& | ||
74 | Foam::quadratureNode<weightType, abscissaType, sigmaType>::primaryAbscissa() | ||
73 | 75 | { | { |
74 | 76 | return abscissa_; | return abscissa_; |
75 | 77 | } | } |
76 | 78 | ||
77 | template <class weightType, class abscissaType> | ||
79 | template <class weightType, class abscissaType, class sigmaType> | ||
78 | 80 | const Foam::PtrList<weightType>& | const Foam::PtrList<weightType>& |
79 | Foam::quadratureNode<weightType, abscissaType>::secondaryWeights() const | ||
81 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
82 | secondaryWeights() const | ||
80 | 83 | { | { |
81 | NotImplemented; | ||
82 | return NullObjectRef<Foam::PtrList<weightType>>(); | ||
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_; | ||
83 | 93 | } | } |
84 | 94 | ||
85 | template <class weightType, class abscissaType> | ||
95 | template <class weightType, class abscissaType, class sigmaType> | ||
86 | 96 | Foam::PtrList<weightType>& | Foam::PtrList<weightType>& |
87 | Foam::quadratureNode<weightType, abscissaType>::secondaryWeights() | ||
97 | Foam::quadratureNode<weightType, abscissaType, sigmaType>:: | ||
98 | secondaryWeights() | ||
88 | 99 | { | { |
89 | NotImplemented; | ||
90 | return NullObjectRef<Foam::PtrList<weightType>>(); | ||
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_; | ||
91 | 108 | } | } |
92 | 109 | ||
93 | template <class weightType, class abscissaType> | ||
110 | template <class weightType, class abscissaType, class sigmaType> | ||
94 | 111 | const Foam::PtrList<abscissaType>& | const Foam::PtrList<abscissaType>& |
95 | Foam::quadratureNode<weightType, abscissaType>::secondaryAbscissae() const | ||
112 | Foam::quadratureNode<weightType, abscissaType, sigmaType> | ||
113 | ::secondaryAbscissae() const | ||
96 | 114 | { | { |
97 | NotImplemented; | ||
98 | return NullObjectRef<Foam::PtrList<abscissaType>>(); | ||
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_; | ||
99 | 124 | } | } |
100 | 125 | ||
101 | template <class weightType, class abscissaType> | ||
126 | template <class weightType, class abscissaType, class sigmaType> | ||
102 | 127 | Foam::PtrList<abscissaType>& | Foam::PtrList<abscissaType>& |
103 | Foam::quadratureNode<weightType, abscissaType>::secondaryAbscissae() | ||
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 | ||
104 | 146 | { | { |
105 | NotImplemented; | ||
106 | return NullObjectRef<Foam::PtrList<abscissaType>>(); | ||
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_(); | ||
107 | 156 | } | } |
108 | 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 | |||
109 | 174 | // ************************************************************************* // | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/quadratureNode/quadratureNodes.H changed (mode: 100644) (index 36da3a4..6806fd6) | |||
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-2017 Alberto Passalacqua | ||
6 | 6 | \\/ M anipulation | | \\/ M anipulation | |
7 | 7 | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
8 | 8 | License | License |
... | ... | SourceFiles | |
35 | 35 | ||
36 | 36 | #include "volFields.H" | #include "volFields.H" |
37 | 37 | #include "quadratureNode.H" | #include "quadratureNode.H" |
38 | #include "extendedQuadratureNode.H" | ||
39 | 38 | ||
40 | 39 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
41 | 40 | ||
42 | 41 | namespace Foam | namespace Foam |
43 | 42 | { | { |
44 | 43 | ||
45 | typedef quadratureNode<volScalarField, volScalarField> basicVolScalarNode; | ||
44 | typedef quadratureNode<volScalarField, volScalarField, volScalarField> | ||
45 | volScalarNode; | ||
46 | 46 | ||
47 | typedef quadratureNode<surfaceScalarField, surfaceScalarField> | ||
48 | basicSurfaceScalarNode; | ||
49 | |||
50 | typedef quadratureNode<volScalarField, volVectorField> basicVolVectorNode; | ||
51 | |||
52 | typedef quadratureNode<surfaceScalarField, surfaceVectorField> | ||
53 | basicSurfaceVectorNode; | ||
54 | |||
55 | typedef extendedQuadratureNode<volScalarField, volScalarField, volScalarField> | ||
56 | extendedVolScalarNode; | ||
57 | |||
58 | typedef extendedQuadratureNode | ||
47 | typedef quadratureNode | ||
59 | 48 | < | < |
60 | 49 | surfaceScalarField, surfaceScalarField, surfaceScalarField | surfaceScalarField, surfaceScalarField, surfaceScalarField |
61 | 50 | > | > |
62 | extendedSurfaceScalarNode; | ||
51 | surfaceScalarNode; | ||
63 | 52 | ||
64 | typedef extendedQuadratureNode<volScalarField, volVectorField, volScalarField> | ||
65 | extendedVolVectorNode; | ||
53 | typedef quadratureNode<volScalarField, volVectorField, volScalarField> | ||
54 | volVectorNode; | ||
66 | 55 | ||
67 | typedef extendedQuadratureNode | ||
56 | typedef quadratureNode | ||
68 | 57 | < | < |
69 | 58 | surfaceScalarField, surfaceVectorField, surfaceScalarField | surfaceScalarField, surfaceVectorField, surfaceScalarField |
70 | 59 | > | > |
71 | extendedSurfaceVectorNode; | ||
60 | surfaceVectorNode; | ||
72 | 61 | ||
73 | 62 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // |
74 | 63 |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/Make/files deleted (index 2bee21b..0000000) | |||
1 | univariateMomentSet.C | ||
2 | |||
3 | LIB = $(FOAM_USER_LIBBIN)/libmomentSet |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/univariateMomentSet.H deleted (index c7cc687..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-2016 Alberto Passalacqua | ||
6 | \\/ M anipulation | | ||
7 | ------------------------------------------------------------------------------- | ||
8 | License | ||
9 | This file is derivative work of OpenFOAM. | ||
10 | |||
11 | OpenFOAM is free software: you can redistribute it and/or modify it | ||
12 | under the terms of the GNU General Public License as published by | ||
13 | the Free Software Foundation, either version 3 of the License, or | ||
14 | (at your option) any later version. | ||
15 | |||
16 | OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
18 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
19 | for more details. | ||
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
23 | |||
24 | Class | ||
25 | Foam::univariateMomentSet | ||
26 | |||
27 | Description | ||
28 | Stores, checks realizability and calculates the quadrature representation of | ||
29 | a measure from a set of univariate moments. | ||
30 | |||
31 | References | ||
32 | \verbatim | ||
33 | "Modified moments and Gaussian quadratures" | ||
34 | J C Wheeler | ||
35 | Rocky Mountain Journal of Mathematics | ||
36 | Volume 4, Pages 287-296, 1974 | ||
37 | \endverbatim | ||
38 | |||
39 | \verbatim | ||
40 | "Numerical Recipes in C++" | ||
41 | W H Press, S A Teukolsky, W Vetterling, B P Flannery | ||
42 | Cambridge University Press, 2007 | ||
43 | \endverbatim | ||
44 | |||
45 | \verbatim | ||
46 | "The theory of canonical moments with applications in Statistics, | ||
47 | Probability and Analysis" | ||
48 | H Dette, W. J. Studden | ||
49 | Wiley & Sons, 1997 | ||
50 | \endverbatim | ||
51 | |||
52 | \verbatim | ||
53 | "Matrix measures, moment spaces and Favard’s theorem for the interval | ||
54 | [0, 1] and [0,∞)" | ||
55 | H Dette, W. J. Studden | ||
56 | Linear algebra and its applications | ||
57 | Issue 345, Pages 169-193, 2002 | ||
58 | \endverbatim | ||
59 | |||
60 | SourceFiles | ||
61 | univariateMomentSet.C | ||
62 | univariateMomentSetI.H | ||
63 | |||
64 | \*---------------------------------------------------------------------------*/ | ||
65 | |||
66 | #ifndef univariateMomentSet_H | ||
67 | #define univariateMomentSet_H | ||
68 | |||
69 | #include "scalarMatrices.H" | ||
70 | |||
71 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
72 | |||
73 | namespace Foam | ||
74 | { | ||
75 | |||
76 | /*---------------------------------------------------------------------------*\ | ||
77 | Class univariateMomentSet Declaration | ||
78 | \*---------------------------------------------------------------------------*/ | ||
79 | |||
80 | class univariateMomentSet | ||
81 | : | ||
82 | public scalarDiagonalMatrix | ||
83 | { | ||
84 | // Private data | ||
85 | |||
86 | //- Number of moments | ||
87 | label nMoments_; | ||
88 | |||
89 | //- Alpha coefficients of the recurrence relation | ||
90 | scalarDiagonalMatrix alpha_; | ||
91 | |||
92 | //- Beta coefficients of the recurrence relation | ||
93 | scalarDiagonalMatrix beta_; | ||
94 | |||
95 | //- Type of quadrature formula computed when inverting the moment set | ||
96 | word quadratureType_; | ||
97 | |||
98 | //- Type of support of the measure associated to the moment set | ||
99 | word support_; | ||
100 | |||
101 | //- Position of first negative zeta | ||
102 | label negativeZeta_; | ||
103 | |||
104 | //- Bool to indicate if moment set is degenerate, with only the | ||
105 | // zero-order moment realizable | ||
106 | bool degenerate_; | ||
107 | |||
108 | //- Bool to indicate if moments were inverted | ||
109 | bool inverted_; | ||
110 | |||
111 | //- Bool to indicate if the full moment set is realizable | ||
112 | bool fullyRealizable_; | ||
113 | |||
114 | //- Bool to indicate if a subset of the full moment set is realizable | ||
115 | bool subsetRealizable_; | ||
116 | |||
117 | //- Bool to indicate if the moment set is on the boundary of the | ||
118 | // moment space | ||
119 | bool onMomentSpaceBoundary_; | ||
120 | |||
121 | //- Bool to indicate moment realizability was checked | ||
122 | bool realizabilityChecked_; | ||
123 | |||
124 | //- Bool to indicate quadrature setup was completed | ||
125 | bool quadratureSetUp_; | ||
126 | |||
127 | //- Bool to force Gauss quadrature when using other quadrature | ||
128 | // formulae. Usually needed to preserve the largest possible | ||
129 | // number of moments. | ||
130 | bool forceGauss_; | ||
131 | |||
132 | //- Number of invertible moments | ||
133 | label nInvertibleMoments_; | ||
134 | |||
135 | //- Number of realizable moments | ||
136 | label nRealizableMoments_; | ||
137 | |||
138 | //- Number of quadrature nodes | ||
139 | label nNodes_; | ||
140 | |||
141 | //- Known abscissa for Gauss-Radau quadrature | ||
142 | // Optionally specified at construction. If not specified, it is | ||
143 | // assumed to be zero. | ||
144 | scalar knownAbscissa_; | ||
145 | |||
146 | //- Quadrature weights | ||
147 | scalarDiagonalMatrix weights_; | ||
148 | |||
149 | //- Quadrature abscissae | ||
150 | scalarDiagonalMatrix abscissae_; | ||
151 | |||
152 | // Private member functions | ||
153 | |||
154 | //- Check moment realizability | ||
155 | void checkRealizability(); | ||
156 | |||
157 | //- Checks canonical moments for measures with support over [0,1] | ||
158 | void checkCanonicalMoments | ||
159 | ( | ||
160 | const scalarDiagonalMatrix& zeta, | ||
161 | const label nZeta | ||
162 | ); | ||
163 | |||
164 | //- Computes the number of invertible moments | ||
165 | inline void calcNInvertibleMoments(); | ||
166 | |||
167 | //- Setup quadrature storage based on realizability | ||
168 | void setupQuadrature(bool clear = false, bool nullMomentSet = false); | ||
169 | |||
170 | public: | ||
171 | |||
172 | // Constructors | ||
173 | |||
174 | //- Construct from number of moments and initial value | ||
175 | univariateMomentSet | ||
176 | ( | ||
177 | const label nMoments, | ||
178 | const scalar initValue, | ||
179 | const word& quadratureType, | ||
180 | const word& support, | ||
181 | const scalar knownAbscissa = 0.0 | ||
182 | ); | ||
183 | |||
184 | //- Construct from diagonalMatrix | ||
185 | univariateMomentSet | ||
186 | ( | ||
187 | const scalarDiagonalMatrix& m, | ||
188 | const word& quadratureType, | ||
189 | const word& support, | ||
190 | const scalar knownAbscissa = 0.0 | ||
191 | ); | ||
192 | |||
193 | //- Destructor | ||
194 | virtual ~univariateMomentSet(); | ||
195 | |||
196 | |||
197 | // Member Functions | ||
198 | |||
199 | //- Return quadrature abscissae | ||
200 | inline const scalarDiagonalMatrix& abscissae() const; | ||
201 | |||
202 | //- Invert the set of moments to compute weights and abscissae | ||
203 | void invert(); | ||
204 | |||
205 | //- Update moments from weights and abscissae | ||
206 | void update(); | ||
207 | |||
208 | //- Returns degenerate status of the moment set | ||
209 | inline bool isDegenerate(); | ||
210 | |||
211 | //- Returns the status of inversion | ||
212 | inline bool isInverted() const; | ||
213 | |||
214 | //- Return realizability status of the moment set | ||
215 | inline bool isFullyRealizable(); | ||
216 | |||
217 | //- Return realizability status of the moment subsets | ||
218 | inline bool isSubsetRealizable(); | ||
219 | |||
220 | //- Return true if the moment set is on the boundary of the moment space | ||
221 | inline bool isOnMomentSpaceBoundary(); | ||
222 | |||
223 | //- Return the number of invertible moments | ||
224 | inline label nInvertibleMoments(); | ||
225 | |||
226 | //- Return the number of realizable moments | ||
227 | inline label nRealizableMoments(); | ||
228 | |||
229 | //- Return the number of moments | ||
230 | inline label nMoments() const; | ||
231 | |||
232 | //- Return the number of nodes | ||
233 | inline label nNodes() const; | ||
234 | |||
235 | //- Return quadrature weights | ||
236 | inline const scalarDiagonalMatrix& weights() const; | ||
237 | |||
238 | //- Return support | ||
239 | inline const word quadratureType() const; | ||
240 | |||
241 | //- Return support | ||
242 | inline const word support() const; | ||
243 | }; | ||
244 | |||
245 | |||
246 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
247 | |||
248 | } // End namespace Foam | ||
249 | |||
250 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
251 | |||
252 | #include "univariateMomentSetI.H" | ||
253 | |||
254 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
255 | |||
256 | #endif | ||
257 | |||
258 | // ************************************************************************* // |
File multiphaseEulerPbeFoam/quadratureMethods/univariateMomentSet/univariateMomentSetI.H deleted (index dd06aad..0000000) | |||
1 | /*---------------------------------------------------------------------------*\ | ||
2 | ========= | | ||
3 | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
4 | \\ / O peration | | ||
5 | \\ / A nd | Copyright (C) 2014-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 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // | ||
27 | bool Foam::univariateMomentSet::isDegenerate() | ||
28 | { | ||
29 | // Checking if moments of order higher than zero are null | ||
30 | // The case when m0 = 0 is already managed | ||
31 | for (label momentI = 1; momentI < nMoments_; momentI++) | ||
32 | { | ||
33 | if (mag((*this)[momentI]) > SMALL) | ||
34 | { | ||
35 | degenerate_ = false; | ||
36 | |||
37 | return degenerate_; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | degenerate_ = true; | ||
42 | |||
43 | return degenerate_; | ||
44 | } | ||
45 | |||
46 | bool Foam::univariateMomentSet::isInverted() const | ||
47 | { | ||
48 | return inverted_; | ||
49 | } | ||
50 | |||
51 | bool Foam::univariateMomentSet::isFullyRealizable() | ||
52 | { | ||
53 | if (!realizabilityChecked_) | ||
54 | { | ||
55 | checkRealizability(); | ||
56 | } | ||
57 | |||
58 | return fullyRealizable_; | ||
59 | } | ||
60 | |||
61 | bool Foam::univariateMomentSet::isSubsetRealizable() | ||
62 | { | ||
63 | if (!realizabilityChecked_) | ||
64 | { | ||
65 | checkRealizability(); | ||
66 | } | ||
67 | |||
68 | return subsetRealizable_; | ||
69 | } | ||
70 | |||
71 | bool Foam::univariateMomentSet::isOnMomentSpaceBoundary() | ||
72 | { | ||
73 | if (!realizabilityChecked_) | ||
74 | { | ||
75 | checkRealizability(); | ||
76 | } | ||
77 | |||
78 | return onMomentSpaceBoundary_; | ||
79 | } | ||
80 | |||
81 | Foam::label Foam::univariateMomentSet::nInvertibleMoments() | ||
82 | { | ||
83 | if (!realizabilityChecked_) | ||
84 | { | ||
85 | checkRealizability(); | ||
86 | } | ||
87 | |||
88 | return nInvertibleMoments_; | ||
89 | } | ||
90 | |||
91 | Foam::label Foam::univariateMomentSet::nRealizableMoments() | ||
92 | { | ||
93 | if (!realizabilityChecked_) | ||
94 | { | ||
95 | checkRealizability(); | ||
96 | } | ||
97 | |||
98 | return nRealizableMoments_; | ||
99 | } | ||
100 | |||
101 | Foam::label Foam::univariateMomentSet::nMoments() const | ||
102 | { | ||
103 | return nMoments_; | ||
104 | } | ||
105 | |||
106 | Foam::label Foam::univariateMomentSet::nNodes() const | ||
107 | { | ||
108 | return nNodes_; | ||
109 | } | ||
110 | |||
111 | //- Return primary quadrature weights | ||
112 | const Foam::scalarDiagonalMatrix& Foam::univariateMomentSet::weights() const | ||
113 | { | ||
114 | return weights_; | ||
115 | } | ||
116 | |||
117 | //- Return primary quadrature abscissae | ||
118 | const Foam::scalarDiagonalMatrix& Foam::univariateMomentSet::abscissae() const | ||
119 | { | ||
120 | return abscissae_; | ||
121 | } | ||
122 | |||
123 | //- Return support of the measure associated to the moment set | ||
124 | const Foam::word Foam::univariateMomentSet::support() const | ||
125 | { | ||
126 | return support_; | ||
127 | } | ||
128 | |||
129 | //- Return type of quadrature | ||
130 | const Foam::word Foam::univariateMomentSet::quadratureType() const | ||
131 | { | ||
132 | return quadratureType_; | ||
133 | } | ||
134 | |||
135 | // ************************************************************************* // |