Compare commits
265 Commits
feature-fv
...
develop.mo
| Author | SHA1 | Date | |
|---|---|---|---|
| e9fcd75ec4 | |||
| ac34d9fd29 | |||
| 14bece937b | |||
| 2396828a60 | |||
| 9223d238bd | |||
| 4b92bb6533 | |||
| 55c81bce1b | |||
| 1cb0b7b6c9 | |||
| 7f939f6d2d | |||
| cbb66f7bc7 | |||
| 5d7bd9c497 | |||
| 601239f59a | |||
| b25147a4f8 | |||
| 19628b9576 | |||
| b913463d95 | |||
| 3ae725592d | |||
| d6081a18f6 | |||
| e46cc77a5b | |||
| 5321c92e3d | |||
| 97cbe9c54e | |||
| 06b3e9bd0b | |||
| a6c924cf8f | |||
| e5848196ef | |||
| aa96119de2 | |||
| 11166821f1 | |||
| 77b2687503 | |||
| 52c55543b5 | |||
| 41231028da | |||
| 35615174a3 | |||
| b9fecc3898 | |||
| c78b510928 | |||
| a91587e36a | |||
| 9c4d0cdeef | |||
| 7a266b566f | |||
| 278ad6fb44 | |||
| b0d29ba8d6 | |||
| a42fa7949b | |||
| c6fc90b629 | |||
| 1d1e0c5f13 | |||
| 462d04dcd4 | |||
| d39b8a5c94 | |||
| b30d42c391 | |||
| f3998b8833 | |||
| 1fa20428a8 | |||
| ac1c41a51b | |||
| c378893bcb | |||
| d4019e497d | |||
| 8be698528a | |||
| 2d522e921f | |||
| f7fd9f8186 | |||
| 1e715d3847 | |||
| f4b50daa3c | |||
| 6d2a6a5ef9 | |||
| d6e75fb289 | |||
| 63ef1f20e8 | |||
| b9d8f99bc2 | |||
| ec2b71f324 | |||
| 52f2c42e54 | |||
| aee63e7418 | |||
| a26f7c243a | |||
| 88ff32b713 | |||
| 4c13fd8658 | |||
| bd57627955 | |||
| 19caabbd56 | |||
| d8250512f6 | |||
| 7fa861f09b | |||
| 202b448b8f | |||
| 4cc8423c94 | |||
| f96c5fafb0 | |||
| 376674d568 | |||
| b2135600a8 | |||
| 697b8a1436 | |||
| a85b0f0736 | |||
| 3ad17ddf5e | |||
| 2446f3f0c7 | |||
| f3c97d41bd | |||
| 8aa69ad976 | |||
| 9c13057b80 | |||
| 8357b7e28b | |||
| 828693bc90 | |||
| 1f5eb55eeb | |||
| 3a78203863 | |||
| 14b68a7f05 | |||
| 45f34f558b | |||
| f000a8e43d | |||
| 24b79d3469 | |||
| 821cdf6681 | |||
| eaf17337aa | |||
| 1642841868 | |||
| 891ac808de | |||
| fe7006acd7 | |||
| 0483e4826a | |||
| 6a72b0e607 | |||
| fcc8e62e47 | |||
| 631b6e5111 | |||
| 83107a192c | |||
| 233da9adaa | |||
| 954a54ea73 | |||
| 9cbf544ecd | |||
| 1bcad518c6 | |||
| a32493778a | |||
| e4c1a252c6 | |||
| c108153d06 | |||
| 53af711c6a | |||
| a68ed1371f | |||
| 6ac50a3307 | |||
| 0a421c99ab | |||
| 20e04a88f7 | |||
| 9629ae8aa9 | |||
| 7a8089e076 | |||
| 4cd1912e4c | |||
| 9eede215b0 | |||
| d37c685523 | |||
| bbef1bc289 | |||
| 615aae61d7 | |||
| fabb1c2ce5 | |||
| 9f47957df5 | |||
| 50b1c0be53 | |||
| 2e475793bc | |||
| b46b3356bc | |||
| 453efa7ca8 | |||
| 4d702d25a6 | |||
| bf0eb9bede | |||
| 1cdf7d0b00 | |||
| 053f895b2e | |||
| ec7ab996c5 | |||
| 5f580f547f | |||
| 36d1d9b79d | |||
| 9e9c90ddb2 | |||
| 45f8d847b0 | |||
| 1078234f18 | |||
| 3c4e226130 | |||
| 7021b073cf | |||
| cdd1e19f68 | |||
| 09beb5571a | |||
| 23adebdb86 | |||
| 2b0e4dc97a | |||
| e803646228 | |||
| be278abcc0 | |||
| 93f980834b | |||
| e8dce32b0a | |||
| 91925871d9 | |||
| a5090c37a3 | |||
| 0d7816b7fd | |||
| 9bdb75eeef | |||
| a860d48637 | |||
| 97296043c0 | |||
| 6bdceaf29f | |||
| 34df4eaf40 | |||
| 75b2d0b656 | |||
| 9bc6f2f91f | |||
| 96872f031f | |||
| 55d89ac4d6 | |||
| fe0ba07a7a | |||
| 164a3e8330 | |||
| 2f6581133c | |||
| 9e8e14e448 | |||
| ffea136955 | |||
| 5dbc2e5890 | |||
| 1be6991d3f | |||
| 25139e492e | |||
| 0189311026 | |||
| d6e6450834 | |||
| 1d6c77f8f4 | |||
| 83e73e4024 | |||
| 0bb0c1db74 | |||
| 8d9f4c54f3 | |||
| f7c8bfdce0 | |||
| 6ca0c59519 | |||
| 72ce3eb4ef | |||
| a9b59ad27e | |||
| 4668d0e886 | |||
| c78f25035d | |||
| 82e0d76748 | |||
| 4e513cec18 | |||
| ae3adc1007 | |||
| a0bba74950 | |||
| 535a4fccb4 | |||
| e1b04cb6a7 | |||
| a3f74d832a | |||
| a92143400d | |||
| c6220c162e | |||
| e5f147a211 | |||
| ebbeef27b4 | |||
| 5bb030480d | |||
| 4334aa43a0 | |||
| 34143b433a | |||
| c5ceec3c73 | |||
| 91e7870ee8 | |||
| 1d62b6274e | |||
| 5ee8f19bdd | |||
| 2d77f7ae26 | |||
| 5c44f360fe | |||
| 735b701006 | |||
| fd41930377 | |||
| 59f3c55871 | |||
| 0be19b7fae | |||
| 01727c84f1 | |||
| 80d7fe97f0 | |||
| a7e8a43f4a | |||
| 6c20df2808 | |||
| b8a0706e72 | |||
| 7f062a8f5e | |||
| f13a05375c | |||
| eb56c75c4b | |||
| cb6d11d39b | |||
| ad037ac744 | |||
| e3c93a9c85 | |||
| a2df607998 | |||
| e121db6e86 | |||
| e720f823d3 | |||
| bdac68ebc7 | |||
| edf9621ebe | |||
| a9863d9a3f | |||
| bdb890d4e2 | |||
| 707db0b65b | |||
| 8716795d86 | |||
| 8bbfe6eb44 | |||
| aaa9af9ee8 | |||
| 4de0b84c2f | |||
| db871856c0 | |||
| a01f3ed8b7 | |||
| c4b261c615 | |||
| 7b0ab0dbb3 | |||
| b9b0d1b3aa | |||
| b7ce6bf69d | |||
| 034a0524af | |||
| eaa65913f4 | |||
| 6dd8804acb | |||
| a77aaa7582 | |||
| 5cc36dc5b7 | |||
| d4a959a93f | |||
| 09e04003c4 | |||
| 0a53013499 | |||
| 47f2ff618d | |||
| 47575aabf2 | |||
| dcbd546d51 | |||
| d64c6371f1 | |||
| 2d246cd5d1 | |||
| 51bb06764a | |||
| 795bce4519 | |||
| db0709f957 | |||
| 38e08fc092 | |||
| 36ae93d017 | |||
| ab7cfdcf49 | |||
| f13be4f62c | |||
| ae638c2b9c | |||
| 9cd0aa8816 | |||
| 939ca03495 | |||
| 28818c73f9 | |||
| 20b2f46315 | |||
| 5d9f8e9a9d | |||
| 3bf1399098 | |||
| 20b6aeb4dd | |||
| c7fc9d4ddc | |||
| f0b844eb47 | |||
| 151f4df546 | |||
| 7ac83f22c7 | |||
| 8c395357f3 | |||
| d4b5280742 | |||
| be30598e3d | |||
| d64682a7af | |||
| cf9fa16788 | |||
| 9437e8d068 | |||
| dd09aa1289 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
# File-browser settings - anywhere
|
# File-browser settings - anywhere
|
||||||
.directory
|
.directory
|
||||||
|
.DS_Store # OSX app store
|
||||||
|
|
||||||
# Backup/recovery versions - anywhere
|
# Backup/recovery versions - anywhere
|
||||||
.#*
|
.#*
|
||||||
@ -38,6 +39,8 @@ linux*Gcc*/
|
|||||||
linux*Icc*/
|
linux*Icc*/
|
||||||
solaris*Gcc*/
|
solaris*Gcc*/
|
||||||
SunOS*Gcc*/
|
SunOS*Gcc*/
|
||||||
|
darwin*Clang*/
|
||||||
|
darwin*Gcc*/
|
||||||
platforms/
|
platforms/
|
||||||
|
|
||||||
# Top-level build directories
|
# Top-level build directories
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
Providing details of your set-up can help us identify any issues, e.g.
|
Providing details of your set-up can help us identify any issues, e.g.
|
||||||
OpenFOAM version : v2412|v2406|v2312|v2306|v2212 etc
|
OpenFOAM version : v2506|v2412|v2406|v2312|v2306 etc
|
||||||
Operating system : ubuntu|openSUSE|RedHat etc
|
Operating system : ubuntu|openSUSE|RedHat etc
|
||||||
Hardware info : any info that may help?
|
Hardware info : any info that may help?
|
||||||
Compiler : gcc|clang etc
|
Compiler : gcc|clang etc
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
set -- -all="${0##*/}" "$@" # Execute this instead of ./Allwmake
|
||||||
|
|
||||||
# Run from OPENFOAM top-level directory only
|
# Run from OPENFOAM top-level directory only
|
||||||
cd "${0%/*}" || exit
|
|
||||||
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
|
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
|
||||||
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||||
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments -no-recursion "$@" || \
|
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||||
echo "Argument parse error"
|
echo "Argument parse error"
|
||||||
else
|
else
|
||||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||||
@ -31,7 +33,7 @@ case "$FOAM_MODULE_PREFIX" in
|
|||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
# Use wmake -all instead of Allwmake to allow for overrides
|
# Use wmake -all instead of Allwmake to allow for overrides
|
||||||
( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all )
|
( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all $* )
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,13 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
set -- -all="${0##*/}" "$@" # Execute this instead of ./Allwmake
|
||||||
|
|
||||||
# Run from OPENFOAM top-level directory only
|
# Run from OPENFOAM top-level directory only
|
||||||
cd "${0%/*}" || exit
|
|
||||||
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
|
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
|
||||||
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||||
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments -no-recursion "$@" || \
|
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||||
echo "Argument parse error"
|
echo "Argument parse error"
|
||||||
else
|
else
|
||||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||||
@ -31,7 +33,7 @@ case "$FOAM_MODULE_PREFIX" in
|
|||||||
;;
|
;;
|
||||||
(*)
|
(*)
|
||||||
# Use wmake -all instead of Allwmake to allow for overrides
|
# Use wmake -all instead of Allwmake to allow for overrides
|
||||||
( cd "$WM_PROJECT_DIR/plugins" 2>/dev/null && wmake -all )
|
( cd "$WM_PROJECT_DIR/plugins" 2>/dev/null && wmake -all $* )
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
api=2412
|
api=2507
|
||||||
patch=0
|
patch=0
|
||||||
|
|||||||
12
README.md
12
README.md
@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
|
|||||||
|
|
||||||
If OpenFOAM has already been compiled on your system, simply source
|
If OpenFOAM has already been compiled on your system, simply source
|
||||||
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
|
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
|
||||||
For example, for the OpenFOAM-v2412 version:
|
For example, for the OpenFOAM-v2506 version:
|
||||||
```
|
```
|
||||||
source /installation/path/OpenFOAM-v2412/etc/bashrc
|
source /installation/path/OpenFOAM-v2506/etc/bashrc
|
||||||
```
|
```
|
||||||
|
|
||||||
## Compiling OpenFOAM
|
## Compiling OpenFOAM
|
||||||
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
|
|||||||
to the OpenFOAM directory. For example,
|
to the OpenFOAM directory. For example,
|
||||||
```
|
```
|
||||||
/path/parent
|
/path/parent
|
||||||
|-- OpenFOAM-v2412
|
|-- OpenFOAM-v2506
|
||||||
\-- ThirdParty-v2412
|
\-- ThirdParty-v2506
|
||||||
```
|
```
|
||||||
There are, however, many cases where this simple convention is inadequate:
|
There are, however, many cases where this simple convention is inadequate:
|
||||||
|
|
||||||
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
|
|||||||
2. PREFIX/ThirdParty-VERSION
|
2. PREFIX/ThirdParty-VERSION
|
||||||
* this corresponds to the traditional approach
|
* this corresponds to the traditional approach
|
||||||
3. PREFIX/ThirdParty-vAPI
|
3. PREFIX/ThirdParty-vAPI
|
||||||
* allows for an updated value of VERSION, *eg*, `v2412-myCustom`,
|
* allows for an updated value of VERSION, *eg*, `v2506-myCustom`,
|
||||||
without requiring a renamed ThirdParty. The API value would still
|
without requiring a renamed ThirdParty. The API value would still
|
||||||
be `2412` and the original `ThirdParty-v2412/` would be found.
|
be `2412` and the original `ThirdParty-v2506/` would be found.
|
||||||
4. PREFIX/ThirdParty-API
|
4. PREFIX/ThirdParty-API
|
||||||
* same as the previous example, but using an unadorned API value.
|
* same as the previous example, but using an unadorned API value.
|
||||||
5. PREFIX/ThirdParty-common
|
5. PREFIX/ThirdParty-common
|
||||||
|
|||||||
@ -13,7 +13,13 @@ volVectorField U
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Initialise the velocity internal field to zero
|
// Initialise the velocity internal field to zero
|
||||||
U = dimensionedVector(U.dimensions(), Zero);
|
// Note: explicitly bypass evaluation of contraint patch overrides
|
||||||
|
// (e.g. swirlFanVelocity might lookup phi,rho)
|
||||||
|
//U = Zero;
|
||||||
|
{
|
||||||
|
U.internalFieldRef() = Zero;
|
||||||
|
U.boundaryFieldRef() = Zero;
|
||||||
|
}
|
||||||
|
|
||||||
surfaceScalarField phi
|
surfaceScalarField phi
|
||||||
(
|
(
|
||||||
|
|||||||
@ -36,11 +36,13 @@ Description
|
|||||||
if (adjustTimeStep)
|
if (adjustTimeStep)
|
||||||
{
|
{
|
||||||
scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL);
|
scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL);
|
||||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
|
||||||
|
const scalar deltaTFact =
|
||||||
|
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaTValue(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
if (adjustTimeStep)
|
if (adjustTimeStep)
|
||||||
{
|
{
|
||||||
runTime.setDeltaT(min(dtChem, maxDeltaT));
|
runTime.setDeltaT(Foam::min(dtChem, maxDeltaT));
|
||||||
|
|
||||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,9 +54,18 @@ if (adjustTimeStep)
|
|||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
dt0*min(min(TFactorFluid, min(TFactorFilm, TFactorSolid)), 1.2),
|
dt0
|
||||||
|
* Foam::min
|
||||||
|
(
|
||||||
|
Foam::min
|
||||||
|
(
|
||||||
|
TFactorFluid,
|
||||||
|
Foam::min(TFactorFilm, TFactorSolid)
|
||||||
|
),
|
||||||
|
1.2
|
||||||
|
),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,10 +57,22 @@ License
|
|||||||
// (relative to reference value)
|
// (relative to reference value)
|
||||||
scalar alphaY(pimpleDict.getOrDefault<scalar>("alphaY", 1.0));
|
scalar alphaY(pimpleDict.getOrDefault<scalar>("alphaY", 1.0));
|
||||||
|
|
||||||
Info<< "Time scales min/max:" << endl;
|
|
||||||
|
|
||||||
// Cache old reciprocal time scale field
|
// The old reciprocal time scale field, with any damping factor
|
||||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
tmp<volScalarField> rDeltaT0_damped;
|
||||||
|
|
||||||
|
// Calculate damped value before applying any other changes
|
||||||
|
if
|
||||||
|
(
|
||||||
|
rDeltaTDampingCoeff < 1
|
||||||
|
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Time scales min/max:" << endl;
|
||||||
|
|
||||||
// Flow time scale
|
// Flow time scale
|
||||||
{
|
{
|
||||||
@ -70,12 +82,14 @@ License
|
|||||||
/((2*maxCo)*mesh.V()*rho())
|
/((2*maxCo)*mesh.V()*rho())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Limit the largest time scale
|
// Limit the largest time scale (=> smallest reciprocal time)
|
||||||
rDeltaT.max(1/maxDeltaT);
|
rDeltaT.clamp_min(1/maxDeltaT);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< " Flow = "
|
Info<< " Flow = "
|
||||||
<< 1/gMax(rDeltaT.primitiveField()) << ", "
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< 1/gMin(rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heat release rate time scale
|
// Heat release rate time scale
|
||||||
@ -86,11 +100,13 @@ License
|
|||||||
mag(Qdot)/(alphaTemp*rho*thermo.Cp()*T)
|
mag(Qdot)/(alphaTemp*rho*thermo.Cp()*T)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Temperature = "
|
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT);
|
||||||
<< 1/(gMax(rDeltaTT.field()) + VSMALL) << ", "
|
|
||||||
<< 1/(gMin(rDeltaTT.field()) + VSMALL) << endl;
|
|
||||||
|
|
||||||
rDeltaT.ref() = max(rDeltaT(), rDeltaTT);
|
auto limits = gMinMax(rDeltaTT.field());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< " Temperature = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reaction rate time scale
|
// Reaction rate time scale
|
||||||
@ -138,11 +154,13 @@ License
|
|||||||
|
|
||||||
if (foundY)
|
if (foundY)
|
||||||
{
|
{
|
||||||
Info<< " Composition = "
|
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTY);
|
||||||
<< 1/(gMax(rDeltaTY.field()) + VSMALL) << ", "
|
|
||||||
<< 1/(gMin(rDeltaTY.field()) + VSMALL) << endl;
|
|
||||||
|
|
||||||
rDeltaT.ref() = max(rDeltaT(), rDeltaTY);
|
auto limits = gMinMax(rDeltaTY.field());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< " Composition = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -161,28 +179,22 @@ License
|
|||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||||
// - reduce as much as required
|
// - reduce as much as required
|
||||||
// - only increase at a fraction of old time scale
|
// - only increase at a fraction of old time scale
|
||||||
if
|
if (rDeltaT0_damped)
|
||||||
(
|
|
||||||
rDeltaTDampingCoeff < 1
|
|
||||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
rDeltaT = max
|
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||||
(
|
|
||||||
rDeltaT,
|
|
||||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update tho boundary values of the reciprocal time-step
|
// Update tho boundary values of the reciprocal time-step
|
||||||
rDeltaT.correctBoundaryConditions();
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.field());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< " Overall = "
|
Info<< " Overall = "
|
||||||
<< 1/gMax(rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << 1/gMin(rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -106,7 +106,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
|||||||
if (!this->readValueEntry(dict))
|
if (!this->readValueEntry(dict))
|
||||||
{
|
{
|
||||||
// Fallback: set to the internal field
|
// Fallback: set to the internal field
|
||||||
fvPatchField<scalar>::patchInternalField(*this);
|
this->extrapolateInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
refValue() = *this;
|
refValue() = *this;
|
||||||
|
|||||||
@ -23,7 +23,11 @@
|
|||||||
|
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
|
|
||||||
Info<< "Flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< "Flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,18 +52,26 @@
|
|||||||
// Update the boundary values of the reciprocal time-step
|
// Update the boundary values of the reciprocal time-step
|
||||||
rDeltaT.correctBoundaryConditions();
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< "Flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (rDeltaTSmoothingCoeff < 1.0)
|
if (rDeltaTSmoothingCoeff < 1.0)
|
||||||
{
|
{
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Smoothed flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< "Smoothed flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
// Limit rate of change of time scale
|
||||||
// - reduce as much as required
|
// - reduce as much as required
|
||||||
@ -78,8 +86,10 @@
|
|||||||
rDeltaT0
|
rDeltaT0
|
||||||
*max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
|
*max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< "Damped flow time scale min/max = "
|
Info<< "Damped flow time scale min/max = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
scalar CoNum = -GREAT;
|
scalar CoNum = -GREAT;
|
||||||
forAll(fluidRegions, regionI)
|
forAll(fluidRegions, regionI)
|
||||||
{
|
{
|
||||||
CoNum = max
|
CoNum = Foam::max
|
||||||
(
|
(
|
||||||
compressibleCourantNo
|
compressibleCourantNo
|
||||||
(
|
(
|
||||||
|
|||||||
@ -78,8 +78,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin[i]);
|
|
||||||
rho = min(rho, rhoMax[i]);
|
rho.clamp_range(rhoMin[i], rhoMax[i]);
|
||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
Info<< "Min/max rho:" << min(rho).value() << ' '
|
Info<< "Min/max rho:" << min(rho).value() << ' '
|
||||||
|
|||||||
@ -387,15 +387,18 @@ updateCoeffs()
|
|||||||
{
|
{
|
||||||
scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad());
|
scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad());
|
||||||
|
|
||||||
Info<< "T solid : " << nl << endl;
|
auto limits = gMinMax(Tp);
|
||||||
|
auto avg = gAverage(Tp);
|
||||||
|
|
||||||
Info
|
Info<< "T solid : " << nl << endl;
|
||||||
<< " heat transfer rate from solid:" << Q
|
|
||||||
<< " walltemperature "
|
Info
|
||||||
<< " min:" << gMin(Tp)
|
<< " heat transfer rate from solid:" << Q
|
||||||
<< " max:" << gMax(Tp)
|
<< " walltemperature "
|
||||||
<< " avg:" << gAverage(Tp) << nl
|
<< " min:" << limits.min()
|
||||||
<< endl;
|
<< " max:" << limits.max()
|
||||||
|
<< " avg:" << avg << nl
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (regionType_ == fluid)
|
else if (regionType_ == fluid)
|
||||||
@ -445,10 +448,16 @@ updateCoeffs()
|
|||||||
scalarField qLiq((Tp - Tc)*KdeltaLiq);
|
scalarField qLiq((Tp - Tc)*KdeltaLiq);
|
||||||
scalarField qVap((Tp - Tv.patchInternalField())*KdeltaVap);
|
scalarField qVap((Tp - Tv.patchInternalField())*KdeltaVap);
|
||||||
|
|
||||||
|
auto infoT = gMinMax(Tp);
|
||||||
|
auto avgT = gAverage(Tp);
|
||||||
|
|
||||||
|
auto infoLiq = gMinMax(qLiq);
|
||||||
|
auto infoVap = gMinMax(qVap);
|
||||||
|
|
||||||
Info<< "T flow : " << nl << endl;
|
Info<< "T flow : " << nl << endl;
|
||||||
|
|
||||||
Info<< " qLiq: " << gMin(qLiq) << " - " << gMax(qLiq) << endl;
|
Info<< " qLiq: " << infoLiq.min() << " - " << infoLiq.max() << nl
|
||||||
Info<< " qVap: " << gMin(qVap) << " - " << gMax(qVap) << endl;
|
<< " qVap: " << infoVap.min() << " - " << infoVap.max() << nl;
|
||||||
|
|
||||||
scalar QLiq = gSum(qLiq*patch().magSf());
|
scalar QLiq = gSum(qLiq*patch().magSf());
|
||||||
scalar QVap = gSum(qVap*patch().magSf());
|
scalar QVap = gSum(qVap*patch().magSf());
|
||||||
@ -457,9 +466,9 @@ updateCoeffs()
|
|||||||
Info<< " Heat transfer to Vap: " << QVap << endl;
|
Info<< " Heat transfer to Vap: " << QVap << endl;
|
||||||
|
|
||||||
Info<< " walltemperature "
|
Info<< " walltemperature "
|
||||||
<< " min:" << gMin(Tp)
|
<< " min:" << infoT.min()
|
||||||
<< " max:" << gMax(Tp)
|
<< " max:" << infoT.max()
|
||||||
<< " avg:" << gAverage(Tp)
|
<< " avg:" << avgT
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
CoNum =
|
scalar regionCoNum =
|
||||||
0.5*gMax
|
0.5*gMax
|
||||||
(
|
(
|
||||||
sumPhi/fluidRegions[regioni].V().field()
|
sumPhi/fluidRegions[regioni].V().field()
|
||||||
@ -41,9 +41,9 @@
|
|||||||
(
|
(
|
||||||
fvc::surfaceSum(mag(phi1 - phi2))().primitiveField()
|
fvc::surfaceSum(mag(phi1 - phi2))().primitiveField()
|
||||||
/ fluidRegions[regioni].V().field()
|
/ fluidRegions[regioni].V().field()
|
||||||
)*runTime.deltaTValue(),
|
)*runTime.deltaTValue();
|
||||||
|
|
||||||
CoNum = max(UrCoNum, CoNum);
|
CoNum = Foam::max(CoNum, Foam::max(regionCoNum, UrCoNum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
forAll(fluidRegions, regioni)
|
forAll(fluidRegions, regioni)
|
||||||
{
|
{
|
||||||
CoNum = max
|
CoNum = Foam::max
|
||||||
(
|
(
|
||||||
compressibleCourantNo
|
compressibleCourantNo
|
||||||
(
|
(
|
||||||
@ -17,7 +17,7 @@
|
|||||||
/*
|
/*
|
||||||
forAll(porousFluidRegions, porousi)
|
forAll(porousFluidRegions, porousi)
|
||||||
{
|
{
|
||||||
CoNum = max
|
CoNum = Foam::max
|
||||||
(
|
(
|
||||||
compressibleCourantNo
|
compressibleCourantNo
|
||||||
(
|
(
|
||||||
|
|||||||
@ -47,10 +47,10 @@ if (adjustTimeStep)
|
|||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(),
|
Foam::min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(),
|
||||||
min(runTime.deltaTValue(), maxDeltaT)
|
Foam::min(runTime.deltaTValue(), maxDeltaT)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||||
|
|||||||
@ -48,18 +48,14 @@ if (adjustTimeStep)
|
|||||||
scalar maxDeltaTFluid = maxCo/(CoNum + SMALL);
|
scalar maxDeltaTFluid = maxCo/(CoNum + SMALL);
|
||||||
scalar maxDeltaTSolid = maxDi/(DiNum + SMALL);
|
scalar maxDeltaTSolid = maxDi/(DiNum + SMALL);
|
||||||
|
|
||||||
scalar deltaTFluid =
|
const scalar deltaTFluid =
|
||||||
min
|
Foam::min(Foam::min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), 1.2);
|
||||||
(
|
|
||||||
min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid),
|
|
||||||
1.2
|
|
||||||
);
|
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(),
|
Foam::min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -22,7 +22,7 @@ forAll(solidRegions, i)
|
|||||||
tmp<volScalarField> trho = thermo.rho();
|
tmp<volScalarField> trho = thermo.rho();
|
||||||
const volScalarField& rho = trho();
|
const volScalarField& rho = trho();
|
||||||
|
|
||||||
DiNum = max
|
DiNum = Foam::max
|
||||||
(
|
(
|
||||||
solidRegionDiffNo
|
solidRegionDiffNo
|
||||||
(
|
(
|
||||||
|
|||||||
@ -17,7 +17,7 @@ scalar DiNum = -GREAT;
|
|||||||
tmp<volScalarField> trho = thermo.rho();
|
tmp<volScalarField> trho = thermo.rho();
|
||||||
const volScalarField& rho = trho();
|
const volScalarField& rho = trho();
|
||||||
|
|
||||||
DiNum = max
|
DiNum = Foam::max
|
||||||
(
|
(
|
||||||
solidRegionDiffNo
|
solidRegionDiffNo
|
||||||
(
|
(
|
||||||
|
|||||||
@ -60,13 +60,10 @@ template<class Type>
|
|||||||
void zeroCells
|
void zeroCells
|
||||||
(
|
(
|
||||||
GeometricField<Type, fvPatchField, volMesh>& vf,
|
GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||||
const labelList& cells
|
const labelUList& cells
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
forAll(cells, i)
|
UIndirectList<Type>(vf.primitiveField(), cells) = Zero;
|
||||||
{
|
|
||||||
vf[cells[i]] = Zero;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -103,8 +103,8 @@ dimensionedScalar alphaMax
|
|||||||
laminarTransport
|
laminarTransport
|
||||||
);
|
);
|
||||||
|
|
||||||
const labelList& inletCells = mesh.boundary()["inlet"].faceCells();
|
const labelUList& inletCells = mesh.boundary()["inlet"].faceCells();
|
||||||
//const labelList& outletCells = mesh.boundary()["outlet"].faceCells();
|
//const labelUList& outletCells = mesh.boundary()["outlet"].faceCells();
|
||||||
|
|
||||||
volScalarField alpha
|
volScalarField alpha
|
||||||
(
|
(
|
||||||
|
|||||||
@ -55,7 +55,7 @@ if (mesh.changing())
|
|||||||
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
|
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
|
||||||
|
|
||||||
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
||||||
const labelList& cellTypes = overlap.cellTypes();
|
const labelUList& cellTypes = overlap.cellTypes();
|
||||||
const labelIOList& zoneIDs = overlap.zoneID();
|
const labelIOList& zoneIDs = overlap.zoneID();
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
|
|||||||
@ -36,18 +36,26 @@
|
|||||||
// Update the boundary values of the reciprocal time-step
|
// Update the boundary values of the reciprocal time-step
|
||||||
rDeltaT.correctBoundaryConditions();
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< "Flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (rDeltaTSmoothingCoeff < 1.0)
|
if (rDeltaTSmoothingCoeff < 1.0)
|
||||||
{
|
{
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Smoothed flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< "Smoothed flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
// Limit rate of change of time scale
|
||||||
// - reduce as much as required
|
// - reduce as much as required
|
||||||
@ -62,8 +70,10 @@
|
|||||||
rDeltaT0
|
rDeltaT0
|
||||||
*max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
|
*max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< "Damped flow time scale min/max = "
|
Info<< "Damped flow time scale min/max = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -54,10 +54,21 @@ License
|
|||||||
scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
|
scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
|
||||||
|
|
||||||
|
|
||||||
Info<< "Time scales min/max:" << endl;
|
// The old reciprocal time scale field, with any damping factor
|
||||||
|
tmp<volScalarField> rDeltaT0_damped;
|
||||||
|
|
||||||
// Cache old reciprocal time scale field
|
// Calculate damped value before applying any other changes
|
||||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
if
|
||||||
|
(
|
||||||
|
rDeltaTDampingCoeff < 1
|
||||||
|
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Time scales min/max:" << endl;
|
||||||
|
|
||||||
// Flow time scale
|
// Flow time scale
|
||||||
{
|
{
|
||||||
@ -67,12 +78,14 @@ License
|
|||||||
/((2*maxCo)*mesh.V()*rho())
|
/((2*maxCo)*mesh.V()*rho())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Limit the largest time scale
|
// Limit the largest time scale (=> smallest reciprocal time)
|
||||||
rDeltaT.max(1/maxDeltaT);
|
rDeltaT.clamp_min(1/maxDeltaT);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< " Flow = "
|
Info<< " Flow = "
|
||||||
<< gMin(1/rDeltaT.primitiveField()) << ", "
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reaction source time scale
|
// Reaction source time scale
|
||||||
@ -93,15 +106,13 @@ License
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Temperature = "
|
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT);
|
||||||
<< gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
|
|
||||||
<< gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
|
|
||||||
|
|
||||||
rDeltaT.ref() = max
|
auto limits = gMinMax(rDeltaTT.field());
|
||||||
(
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
rDeltaT(),
|
|
||||||
rDeltaTT
|
Info<< " Temperature = "
|
||||||
);
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update tho boundary values of the reciprocal time-step
|
// Update tho boundary values of the reciprocal time-step
|
||||||
@ -113,25 +124,19 @@ License
|
|||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||||
// - reduce as much as required
|
// - reduce as much as required
|
||||||
// - only increase at a fraction of old time scale
|
// - only increase at a fraction of old time scale
|
||||||
if
|
if (rDeltaT0_damped)
|
||||||
(
|
|
||||||
rDeltaTDampingCoeff < 1.0
|
|
||||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
rDeltaT = max
|
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||||
(
|
|
||||||
rDeltaT,
|
|
||||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< " Overall = "
|
Info<< " Overall = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
+ MRF.DDt(U)
|
+ MRF.DDt(U)
|
||||||
+ turbulence->divDevReff(U)
|
+ turbulence->divDevReff(U)
|
||||||
==
|
==
|
||||||
parcels.SU(U, true)
|
invRhoInf*parcels.SU(U)
|
||||||
+ fvOptions(U)
|
+ fvOptions(U)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -39,6 +39,11 @@ dimensionedScalar rhoInfValue
|
|||||||
laminarTransport
|
laminarTransport
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const dimensionedScalar invRhoInf
|
||||||
|
(
|
||||||
|
dimless/dimDensity, scalar(1)/rhoInfValue.value()
|
||||||
|
);
|
||||||
|
|
||||||
volScalarField rhoInf
|
volScalarField rhoInf
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
|
|||||||
@ -36,13 +36,18 @@ Description
|
|||||||
if (adjustTimeStep)
|
if (adjustTimeStep)
|
||||||
{
|
{
|
||||||
const scalar maxDeltaTFact =
|
const scalar maxDeltaTFact =
|
||||||
min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL));
|
Foam::min
|
||||||
|
(
|
||||||
|
maxCo/(CoNum + SMALL),
|
||||||
|
maxCo/(surfaceFilm.CourantNumber() + SMALL)
|
||||||
|
);
|
||||||
|
|
||||||
const scalar deltaTFact =
|
const scalar deltaTFact =
|
||||||
min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaTValue(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -54,10 +54,21 @@ License
|
|||||||
scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
|
scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
|
||||||
|
|
||||||
|
|
||||||
Info<< "Time scales min/max:" << endl;
|
// The old reciprocal time scale field, with any damping factor
|
||||||
|
tmp<volScalarField> rDeltaT0_damped;
|
||||||
|
|
||||||
// Cache old reciprocal time scale field
|
// Calculate damped value before applying any other changes
|
||||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
if
|
||||||
|
(
|
||||||
|
rDeltaTDampingCoeff < 1
|
||||||
|
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "Time scales min/max:" << endl;
|
||||||
|
|
||||||
// Flow time scale
|
// Flow time scale
|
||||||
{
|
{
|
||||||
@ -67,12 +78,14 @@ License
|
|||||||
/((2*maxCo)*mesh.V()*rho())
|
/((2*maxCo)*mesh.V()*rho())
|
||||||
);
|
);
|
||||||
|
|
||||||
// Limit the largest time scale
|
// Limit the largest time scale (=> smallest reciprocal time)
|
||||||
rDeltaT.max(1/maxDeltaT);
|
rDeltaT.clamp_min(1/maxDeltaT);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< " Flow = "
|
Info<< " Flow = "
|
||||||
<< gMin(1/rDeltaT.primitiveField()) << ", "
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reaction source time scale
|
// Reaction source time scale
|
||||||
@ -92,15 +105,13 @@ License
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< " Temperature = "
|
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT);
|
||||||
<< gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
|
|
||||||
<< gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
|
|
||||||
|
|
||||||
rDeltaT.ref() = max
|
auto limits = gMinMax(rDeltaTT.field());
|
||||||
(
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
rDeltaT(),
|
|
||||||
rDeltaTT
|
Info<< " Temperature = "
|
||||||
);
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the boundary values of the reciprocal time-step
|
// Update the boundary values of the reciprocal time-step
|
||||||
@ -112,25 +123,22 @@ License
|
|||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||||
// - reduce as much as required
|
// - reduce as much as required
|
||||||
// - only increase at a fraction of old time scale
|
// - only increase at a fraction of old time scale
|
||||||
if
|
if (rDeltaT0_damped)
|
||||||
(
|
|
||||||
rDeltaTDampingCoeff < 1.0
|
|
||||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
rDeltaT = max
|
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||||
(
|
|
||||||
rDeltaT,
|
|
||||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update the boundary values of the reciprocal time-step
|
||||||
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< " Overall = "
|
Info<< " Overall = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -48,8 +48,7 @@ U.correctBoundaryConditions();
|
|||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin);
|
rho.clamp_range(rhoMin, rhoMax);
|
||||||
rho = min(rho, rhoMax);
|
|
||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl;
|
Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl;
|
||||||
|
|||||||
@ -49,8 +49,7 @@
|
|||||||
fvOptions.correct(U);
|
fvOptions.correct(U);
|
||||||
|
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin);
|
rho.clamp_range(rhoMin, rhoMax);
|
||||||
rho = min(rho, rhoMax);
|
|
||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl;
|
Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin);
|
rho.clamp_range(rhoMin, rhoMax);
|
||||||
rho = min(rho, rhoMax);
|
|
||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
@ -94,8 +93,7 @@ p.relax();
|
|||||||
|
|
||||||
// Recalculate density from the relaxed pressure
|
// Recalculate density from the relaxed pressure
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin);
|
rho.clamp_range(rhoMin, rhoMax);
|
||||||
rho = min(rho, rhoMax);
|
|
||||||
rho.relax();
|
rho.relax();
|
||||||
Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl;
|
Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin);
|
rho.clamp_range(rhoMin, rhoMax);
|
||||||
rho = min(rho, rhoMax);
|
|
||||||
rho.relax();
|
rho.relax();
|
||||||
|
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
@ -94,8 +93,7 @@ p.relax();
|
|||||||
|
|
||||||
// Recalculate density from the relaxed pressure
|
// Recalculate density from the relaxed pressure
|
||||||
rho = thermo.rho();
|
rho = thermo.rho();
|
||||||
rho = max(rho, rhoMin);
|
rho.clamp_range(rhoMin, rhoMax);
|
||||||
rho = min(rho, rhoMax);
|
|
||||||
rho.relax();
|
rho.relax();
|
||||||
Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl;
|
Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl;
|
||||||
|
|
||||||
|
|||||||
@ -36,13 +36,14 @@ Description
|
|||||||
if (adjustTimeStep)
|
if (adjustTimeStep)
|
||||||
{
|
{
|
||||||
scalar maxDeltaTFact =
|
scalar maxDeltaTFact =
|
||||||
min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
|
Foam::min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
|
||||||
|
|
||||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
const scalar deltaTFact =
|
||||||
|
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaTValue(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
|
|||||||
@ -53,6 +53,21 @@
|
|||||||
pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
|
pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// The old reciprocal time scale field, with any damping factor
|
||||||
|
tmp<volScalarField> rDeltaT0_damped;
|
||||||
|
|
||||||
|
// Calculate damped value before applying any other changes
|
||||||
|
if
|
||||||
|
(
|
||||||
|
rDeltaTDampingCoeff < 1
|
||||||
|
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||||
|
)
|
||||||
|
{
|
||||||
|
rDeltaT0_damped = (scalar(1) - rDeltaTDampingCoeff)*(rDeltaT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||||
|
|
||||||
// Set the reciprocal time-step from the local Courant number
|
// Set the reciprocal time-step from the local Courant number
|
||||||
@ -83,10 +98,13 @@
|
|||||||
// Update tho boundary values of the reciprocal time-step
|
// Update tho boundary values of the reciprocal time-step
|
||||||
rDeltaT.correctBoundaryConditions();
|
rDeltaT.correctBoundaryConditions();
|
||||||
|
|
||||||
Info<< "Flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
|
Info<< "Flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
if (rDeltaTSmoothingCoeff < 1.0)
|
if (rDeltaTSmoothingCoeff < 1.0)
|
||||||
{
|
{
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
@ -110,27 +128,25 @@
|
|||||||
fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff);
|
fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< "Smoothed flow time scale min/max = "
|
{
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
// Limit rate of change of time scale
|
Info<< "Smoothed flow time scale min/max = "
|
||||||
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||||
// - reduce as much as required
|
// - reduce as much as required
|
||||||
// - only increase at a fraction of old time scale
|
// - only increase at a fraction of old time scale
|
||||||
if
|
if (rDeltaT0_damped)
|
||||||
(
|
|
||||||
rDeltaTDampingCoeff < 1.0
|
|
||||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
rDeltaT = max
|
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||||
(
|
|
||||||
rDeltaT,
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
);
|
|
||||||
|
|
||||||
Info<< "Damped flow time scale min/max = "
|
Info<< "Damped flow time scale min/max = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,13 +36,14 @@ Description
|
|||||||
if (adjustTimeStep)
|
if (adjustTimeStep)
|
||||||
{
|
{
|
||||||
scalar maxDeltaTFact =
|
scalar maxDeltaTFact =
|
||||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
Foam::min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||||
|
|
||||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
const scalar deltaTFact =
|
||||||
|
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaTValue(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
|
|||||||
@ -37,11 +37,15 @@ if (adjustTimeStep)
|
|||||||
if (CoNum > SMALL)
|
if (CoNum > SMALL)
|
||||||
{
|
{
|
||||||
scalar maxDeltaTFact =
|
scalar maxDeltaTFact =
|
||||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
Foam::min
|
||||||
|
(
|
||||||
|
maxCo/(CoNum + SMALL),
|
||||||
|
maxAcousticCo/(acousticCoNum + SMALL)
|
||||||
|
);
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
maxDeltaTFact*runTime.deltaTValue(),
|
maxDeltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
|
|||||||
@ -26,12 +26,12 @@ forAll(dgdt, celli)
|
|||||||
{
|
{
|
||||||
if (dgdt[celli] > 0.0)
|
if (dgdt[celli] > 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
else if (dgdt[celli] < 0.0)
|
else if (dgdt[celli] < 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -210,7 +210,7 @@ void VoFPatchTransfer::correct
|
|||||||
film().toRegion(patchi, Vp);
|
film().toRegion(patchi, Vp);
|
||||||
|
|
||||||
const polyPatch& pp = pbm[patchi];
|
const polyPatch& pp = pbm[patchi];
|
||||||
const labelList& faceCells = pp.faceCells();
|
const labelUList& faceCells = pp.faceCells();
|
||||||
|
|
||||||
// Accumulate the total mass removed from patch
|
// Accumulate the total mass removed from patch
|
||||||
scalar dMassPatch = 0;
|
scalar dMassPatch = 0;
|
||||||
|
|||||||
@ -26,12 +26,12 @@ forAll(dgdt, celli)
|
|||||||
{
|
{
|
||||||
if (dgdt[celli] > 0.0)
|
if (dgdt[celli] > 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
else if (dgdt[celli] < 0.0)
|
else if (dgdt[celli] < 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,12 +26,12 @@ forAll(dgdt, celli)
|
|||||||
{
|
{
|
||||||
if (dgdt[celli] > 0.0)
|
if (dgdt[celli] > 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
else if (dgdt[celli] < 0.0)
|
else if (dgdt[celli] < 0.0)
|
||||||
{
|
{
|
||||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,7 @@ public:
|
|||||||
virtual volScalarField& he()
|
virtual volScalarField& he()
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return const_cast<volScalarField&>(volScalarField::null());
|
return volScalarField::null().constCast();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Enthalpy/Internal energy [J/kg]
|
//- Enthalpy/Internal energy [J/kg]
|
||||||
|
|||||||
@ -1086,7 +1086,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
|
|||||||
|
|
||||||
MULES::limitSum(alphaPhiCorrs);
|
MULES::limitSum(alphaPhiCorrs);
|
||||||
|
|
||||||
rhoPhi_ = dimensionedScalar(dimensionSet(1, 0, -1, 0, 0), Zero);
|
rhoPhi_ = Zero;
|
||||||
|
|
||||||
volScalarField sumAlpha
|
volScalarField sumAlpha
|
||||||
(
|
(
|
||||||
|
|||||||
@ -243,7 +243,7 @@ public:
|
|||||||
virtual volScalarField& he()
|
virtual volScalarField& he()
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return const_cast<volScalarField&>(volScalarField::null());
|
return volScalarField::null().constCast();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Enthalpy/Internal energy [J/kg]
|
//- Enthalpy/Internal energy [J/kg]
|
||||||
|
|||||||
@ -63,23 +63,11 @@ Foam::DTRMParticle::DTRMParticle
|
|||||||
{
|
{
|
||||||
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
|
is >> p0_ >> p1_ >> I0_ >> I_ >> dA_ >> transmissiveId_;
|
||||||
}
|
}
|
||||||
else if (!is.checkLabelSize<>() || !is.checkScalarSize<>())
|
|
||||||
{
|
|
||||||
// Non-native label or scalar size
|
|
||||||
|
|
||||||
is.beginRawRead();
|
|
||||||
|
|
||||||
readRawScalar(is, p0_.data(), vector::nComponents);
|
|
||||||
readRawScalar(is, p1_.data(), vector::nComponents);
|
|
||||||
readRawScalar(is, &I0_);
|
|
||||||
readRawScalar(is, &I_);
|
|
||||||
readRawScalar(is, &dA_);
|
|
||||||
readRawLabel(is, &transmissiveId_);
|
|
||||||
|
|
||||||
is.endRawRead();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// No non-native streaming
|
||||||
|
is.fatalCheckNativeSizes(FUNCTION_NAME);
|
||||||
|
|
||||||
is.read(reinterpret_cast<char*>(&p0_), sizeofFields_);
|
is.read(reinterpret_cast<char*>(&p0_), sizeofFields_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -557,7 +557,7 @@ void Foam::radiation::laserDTRM::calculate()
|
|||||||
|
|
||||||
|
|
||||||
// Reset the field
|
// Reset the field
|
||||||
Q_ == dimensionedScalar(Q_.dimensions(), Zero);
|
Q_ == Zero;
|
||||||
|
|
||||||
a_ = absorptionEmission_->a();
|
a_ = absorptionEmission_->a();
|
||||||
e_ = absorptionEmission_->e();
|
e_ = absorptionEmission_->e();
|
||||||
@ -679,7 +679,7 @@ void Foam::radiation::laserDTRM::calculate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
|
scalar totalQ = gWeightedSum(mesh_.V(), Q_.primitiveField());
|
||||||
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
||||||
|
|
||||||
if (mesh_.time().writeTime())
|
if (mesh_.time().writeTime())
|
||||||
|
|||||||
@ -36,13 +36,13 @@ Description
|
|||||||
if (adjustTimeStep)
|
if (adjustTimeStep)
|
||||||
{
|
{
|
||||||
scalar maxDeltaTFact =
|
scalar maxDeltaTFact =
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
maxCo/(CoNum + SMALL),
|
maxCo/(CoNum + SMALL),
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
maxAlphaCo/(alphaCoNum + SMALL),
|
maxAlphaCo/(alphaCoNum + SMALL),
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
maxAlphaDdt/(ddtAlphaNum + SMALL),
|
maxAlphaDdt/(ddtAlphaNum + SMALL),
|
||||||
maxDi/(DiNum + SMALL)
|
maxDi/(DiNum + SMALL)
|
||||||
@ -50,16 +50,18 @@ if (adjustTimeStep)
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
const scalar deltaTFact =
|
||||||
|
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||||
|
|
||||||
runTime.setDeltaT
|
runTime.setDeltaT
|
||||||
(
|
(
|
||||||
min
|
Foam::min
|
||||||
(
|
(
|
||||||
deltaTFact*runTime.deltaTValue(),
|
deltaTFact*runTime.deltaTValue(),
|
||||||
maxDeltaT
|
maxDeltaT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,7 +86,7 @@ public:
|
|||||||
virtual volScalarField& he()
|
virtual volScalarField& he()
|
||||||
{
|
{
|
||||||
NotImplemented;
|
NotImplemented;
|
||||||
return const_cast<volScalarField&>(volScalarField::null());
|
return volScalarField::null().constCast();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return access to the internal energy field [J/Kg]
|
//- Return access to the internal energy field [J/Kg]
|
||||||
|
|||||||
@ -65,7 +65,7 @@
|
|||||||
dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0);
|
dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0);
|
||||||
|
|
||||||
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
||||||
const labelList& cellTypes = overlap.cellTypes();
|
const labelUList& cellTypes = overlap.cellTypes();
|
||||||
const labelIOList& zoneIDs = overlap.zoneID();
|
const labelIOList& zoneIDs = overlap.zoneID();
|
||||||
|
|
||||||
while (pimple.correctNonOrthogonal())
|
while (pimple.correctNonOrthogonal())
|
||||||
|
|||||||
@ -232,7 +232,7 @@
|
|||||||
surfaceScalarField mSfGradp("mSfGradp", pEqnIncomp.flux()/rAUf);
|
surfaceScalarField mSfGradp("mSfGradp", pEqnIncomp.flux()/rAUf);
|
||||||
|
|
||||||
phasei = 0;
|
phasei = 0;
|
||||||
phi = dimensionedScalar("phi", phi.dimensions(), Zero);
|
phi = Zero;
|
||||||
|
|
||||||
for (phaseModel& phase : fluid.phases())
|
for (phaseModel& phase : fluid.phases())
|
||||||
{
|
{
|
||||||
@ -261,7 +261,7 @@
|
|||||||
|
|
||||||
mSfGradp = pEqnIncomp.flux()/rAUf;
|
mSfGradp = pEqnIncomp.flux()/rAUf;
|
||||||
|
|
||||||
U = dimensionedVector("U", dimVelocity, Zero);
|
U = Zero;
|
||||||
|
|
||||||
phasei = 0;
|
phasei = 0;
|
||||||
for (phaseModel& phase : fluid.phases())
|
for (phaseModel& phase : fluid.phases())
|
||||||
|
|||||||
@ -626,7 +626,7 @@ void Foam::multiphaseMixture::solveAlphas
|
|||||||
|
|
||||||
MULES::limitSum(alphaPhiCorrs);
|
MULES::limitSum(alphaPhiCorrs);
|
||||||
|
|
||||||
rhoPhi_ = dimensionedScalar(dimMass/dimTime, Zero);
|
rhoPhi_ = Zero;
|
||||||
|
|
||||||
volScalarField sumAlpha
|
volScalarField sumAlpha
|
||||||
(
|
(
|
||||||
|
|||||||
@ -38,7 +38,9 @@
|
|||||||
|
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< "Flow time scale min/max = "
|
Info<< "Flow time scale min/max = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,5 +8,5 @@
|
|||||||
|
|
||||||
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
||||||
|
|
||||||
CoNum = max(CoNum, UrCoNum);
|
CoNum = Foam::max(CoNum, UrCoNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,9 @@
|
|||||||
|
|
||||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||||
|
|
||||||
|
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||||
|
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||||
|
|
||||||
Info<< "Flow time scale min/max = "
|
Info<< "Flow time scale min/max = "
|
||||||
<< gMin(1/rDeltaT.primitiveField())
|
<< limits.min() << ", " << limits.max() << endl;
|
||||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,5 +8,5 @@
|
|||||||
|
|
||||||
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
||||||
|
|
||||||
CoNum = max(CoNum, UrCoNum);
|
CoNum = Foam::max(CoNum, UrCoNum);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,6 @@ if (!(runTime.timeIndex() % 5))
|
|||||||
if (smi < -SMALL)
|
if (smi < -SMALL)
|
||||||
{
|
{
|
||||||
Info<< "Resetting Dcorr to 0" << endl;
|
Info<< "Resetting Dcorr to 0" << endl;
|
||||||
Dcorr == dimensionedVector(Dcorr.dimensions(), Zero);
|
Dcorr == Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
. "${WM_PROJECT_DIR:?}"/wmake/scripts/wmakeFunctions # Need wmake functions
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
|
set -- -all="${0##*/}" "$@" # Execute this instead of ./Allwmake
|
||||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
|
||||||
|
. "${WM_PROJECT_DIR:?}"/wmake/scripts/AllwmakeParseArguments
|
||||||
|
. "${WM_PROJECT_DIR:?}"/wmake/scripts/wmakeFunctions # Need wmake functions
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Environment
|
# Environment
|
||||||
|
|||||||
@ -51,17 +51,20 @@ Description
|
|||||||
//- Mapping of some fundamental and aggregate types to MPI data types
|
//- Mapping of some fundamental and aggregate types to MPI data types
|
||||||
enum class dataTypes : int
|
enum class dataTypes : int
|
||||||
{
|
{
|
||||||
// Builtin Types [8]:
|
// Fundamental Types [10]:
|
||||||
DataTypes_begin, //!< Begin builtin types (internal use)
|
Basic_begin,
|
||||||
type_byte = DataTypes_begin, // also for char, unsigned char
|
type_byte = Basic_begin,
|
||||||
|
type_int16,
|
||||||
type_int32,
|
type_int32,
|
||||||
type_int64,
|
type_int64,
|
||||||
|
type_uint16,
|
||||||
type_uint32,
|
type_uint32,
|
||||||
type_uint64,
|
type_uint64,
|
||||||
type_float,
|
type_float,
|
||||||
type_double,
|
type_double,
|
||||||
type_long_double,
|
type_long_double,
|
||||||
invalid
|
invalid,
|
||||||
|
Basic_end = invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -69,20 +72,19 @@ enum class dataTypes : int
|
|||||||
|
|
||||||
// Partial copy from UPstreamTraits.H
|
// Partial copy from UPstreamTraits.H
|
||||||
|
|
||||||
//- A supported UPstream data type (intrinsic or user-defined)
|
//- UPstream data type corresponding to an intrinsic (MPI) type
|
||||||
template<class T>
|
template<class T>
|
||||||
struct UPstream_base_dataType : std::false_type
|
struct UPstream_mpi_dataType : std::false_type
|
||||||
{
|
{
|
||||||
static constexpr auto datatype_id = dataTypes::invalid;
|
static constexpr auto datatype_id = dataTypes::invalid;
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
// Specializations of the above,
|
|
||||||
// each to match the elements of UPstream::dataTypes
|
|
||||||
|
|
||||||
|
// Specializations to match elements of UPstream::dataTypes
|
||||||
#undef defineUPstreamDataTraits
|
#undef defineUPstreamDataTraits
|
||||||
#define defineUPstreamDataTraits(TypeId, Type) \
|
#define defineUPstreamDataTraits(TypeId, Type) \
|
||||||
template<> struct UPstream_base_dataType<Type> : std::true_type \
|
template<> struct UPstream_mpi_dataType<Type> : std::true_type \
|
||||||
{ \
|
{ \
|
||||||
static constexpr auto datatype_id = dataTypes::TypeId; \
|
static constexpr auto datatype_id = dataTypes::TypeId; \
|
||||||
};
|
};
|
||||||
@ -90,8 +92,10 @@ struct UPstream_base_dataType : std::false_type
|
|||||||
|
|
||||||
defineUPstreamDataTraits(type_byte, char);
|
defineUPstreamDataTraits(type_byte, char);
|
||||||
defineUPstreamDataTraits(type_byte, unsigned char);
|
defineUPstreamDataTraits(type_byte, unsigned char);
|
||||||
|
defineUPstreamDataTraits(type_int16, int16_t);
|
||||||
defineUPstreamDataTraits(type_int32, int32_t);
|
defineUPstreamDataTraits(type_int32, int32_t);
|
||||||
defineUPstreamDataTraits(type_int64, int64_t);
|
defineUPstreamDataTraits(type_int64, int64_t);
|
||||||
|
defineUPstreamDataTraits(type_uint16, uint16_t);
|
||||||
defineUPstreamDataTraits(type_uint32, uint32_t);
|
defineUPstreamDataTraits(type_uint32, uint32_t);
|
||||||
defineUPstreamDataTraits(type_uint64, uint64_t);
|
defineUPstreamDataTraits(type_uint64, uint64_t);
|
||||||
defineUPstreamDataTraits(type_float, float);
|
defineUPstreamDataTraits(type_float, float);
|
||||||
@ -109,8 +113,8 @@ struct UPstream_alias_dataType
|
|||||||
:
|
:
|
||||||
std::bool_constant
|
std::bool_constant
|
||||||
<
|
<
|
||||||
// Base type (no alias needed)
|
// Basic MPI type
|
||||||
UPstream_base_dataType<std::remove_cv_t<T>>::value ||
|
UPstream_mpi_dataType<std::remove_cv_t<T>>::value ||
|
||||||
(
|
(
|
||||||
// Or some int 32/64 type to re-map
|
// Or some int 32/64 type to re-map
|
||||||
std::is_integral_v<T>
|
std::is_integral_v<T>
|
||||||
@ -118,15 +122,11 @@ struct UPstream_alias_dataType
|
|||||||
)
|
)
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
// Is it using the base type? (no alias needed)
|
|
||||||
static constexpr bool is_base =
|
|
||||||
UPstream_base_dataType<std::remove_cv_t<T>>::value;
|
|
||||||
|
|
||||||
using base = std::conditional_t
|
using base = std::conditional_t
|
||||||
<
|
<
|
||||||
UPstream_base_dataType<std::remove_cv_t<T>>::value, // is_base
|
UPstream_mpi_dataType<std::remove_cv_t<T>>::value,
|
||||||
std::remove_cv_t<T>,
|
std::remove_cv_t<T>, // <- using mpi type (no alias)
|
||||||
std::conditional_t
|
std::conditional_t // <- using alias
|
||||||
<
|
<
|
||||||
(
|
(
|
||||||
std::is_integral_v<T>
|
std::is_integral_v<T>
|
||||||
@ -138,12 +138,32 @@ struct UPstream_alias_dataType
|
|||||||
std::conditional_t<std::is_signed_v<T>, int32_t, uint32_t>,
|
std::conditional_t<std::is_signed_v<T>, int32_t, uint32_t>,
|
||||||
std::conditional_t<std::is_signed_v<T>, int64_t, uint64_t>
|
std::conditional_t<std::is_signed_v<T>, int64_t, uint64_t>
|
||||||
>,
|
>,
|
||||||
char // Fallback value (assuming it is contiguous)
|
char // Fallback is a byte (eg, arbitrary contiguous data)
|
||||||
>
|
>
|
||||||
>;
|
>;
|
||||||
|
|
||||||
static constexpr auto datatype_id =
|
static constexpr auto datatype_id =
|
||||||
UPstream_base_dataType<base>::datatype_id;
|
UPstream_mpi_dataType<base>::datatype_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Handle int8_t/uint8_t as aliases since 'signed char' etc may be
|
||||||
|
// ambiguous
|
||||||
|
|
||||||
|
//- Map \c int8_t to UPstream::dataTypes::type_byte
|
||||||
|
template<>
|
||||||
|
struct UPstream_alias_dataType<int8_t> : std::true_type
|
||||||
|
{
|
||||||
|
using base = char;
|
||||||
|
static constexpr auto datatype_id = dataTypes::type_byte;
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Map \c uint8_t to UPstream::dataTypes::type_byte
|
||||||
|
template<>
|
||||||
|
struct UPstream_alias_dataType<uint8_t> : std::true_type
|
||||||
|
{
|
||||||
|
using base = unsigned char;
|
||||||
|
static constexpr auto datatype_id = dataTypes::type_byte;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -172,25 +192,30 @@ void print(const char* name, bool showLimits = true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A declared or deduced MPI type, or aliased
|
// A declared or deduced MPI type, or aliased
|
||||||
std::cout
|
if constexpr (UPstream_mpi_dataType<T>::value)
|
||||||
<< " is_mpi=" << UPstream_base_dataType<T>::value
|
|
||||||
<< " (" << int(UPstream_base_dataType<T>::datatype_id) << ")";
|
|
||||||
|
|
||||||
if (UPstream_alias_dataType<T>::value)
|
|
||||||
{
|
{
|
||||||
if (UPstream_alias_dataType<T>::is_base)
|
std::cout
|
||||||
{
|
<< " is_mpi=("
|
||||||
std::cout<< " is_base";
|
<< int(UPstream_mpi_dataType<T>::datatype_id) << ')';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cout<< " is_alias ("
|
|
||||||
<< int(UPstream_alias_dataType<T>::datatype_id) << ")";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout<< " no_alias";
|
std::cout << " is_mpi=(null)";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Any aliases?
|
||||||
|
if constexpr (UPstream_alias_dataType<T>::value)
|
||||||
|
{
|
||||||
|
if constexpr (UPstream_mpi_dataType<T>::value)
|
||||||
|
{
|
||||||
|
std::cout << " alias=base";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< " alias=("
|
||||||
|
<< int(UPstream_alias_dataType<T>::datatype_id) << ')';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout<< '\n';
|
std::cout<< '\n';
|
||||||
@ -217,6 +242,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
std::cout << '\n';
|
std::cout << '\n';
|
||||||
print<char>("char");
|
print<char>("char");
|
||||||
|
print<signed char>("signed char");
|
||||||
print<unsigned char>("unsigned char");
|
print<unsigned char>("unsigned char");
|
||||||
print<short>("short");
|
print<short>("short");
|
||||||
print<int>("int");
|
print<int>("int");
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-CircularBuffer.C
|
Test-CircularBuffer.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-CircularBuffer
|
EXE = $(FOAM_USER_APPBIN)/Test-CircularBuffer
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-CompactIOList.C
|
Test-CompactIOList.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-CompactIOList
|
EXE = $(FOAM_USER_APPBIN)/Test-CompactIOList
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,7 +25,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Application
|
Application
|
||||||
testCompactIOList
|
Test-CompactIOList
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Simple demonstration and test application for the CompactIOList container
|
Simple demonstration and test application for the CompactIOList container
|
||||||
@ -46,13 +46,20 @@ using namespace Foam;
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
argList::addBoolOption("ascii", "use ascii format");
|
||||||
|
argList::addOption("count", "number of faces");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||||
// IOstreamOption streamOpt(IOstreamOption::ASCII);
|
|
||||||
|
|
||||||
const label size = 20000000;
|
if (args.found("ascii"))
|
||||||
|
{
|
||||||
|
streamOpt.format(IOstreamOption::ASCII);
|
||||||
|
}
|
||||||
|
|
||||||
|
const label size = args.getOrDefault<label>("count", 20000000);
|
||||||
|
|
||||||
// Old format
|
// Old format
|
||||||
// ~~~~~~~~~~
|
// ~~~~~~~~~~
|
||||||
@ -63,39 +70,50 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faces2",
|
"faces2-plain",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
IOobject::NO_REGISTER
|
IOobject::NO_REGISTER
|
||||||
),
|
)
|
||||||
size
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const face f(identity(4));
|
faces2.resize(size, face(identity(4)));
|
||||||
|
|
||||||
forAll(faces2, i)
|
Info<< "Plain format faceList " << faces2.objectRelPath() << nl;
|
||||||
{
|
Info<< " constructed in = " << runTime.cpuTimeIncrement()
|
||||||
faces2[i] = f;
|
<< " s" << endl;
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Constructed faceList in = "
|
|
||||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
|
||||||
|
|
||||||
|
|
||||||
faces2.writeObject(streamOpt, true);
|
faces2.writeObject(streamOpt, true);
|
||||||
|
|
||||||
Info<< "Written old format faceList in = "
|
Info<< " wrote in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||||
|
|
||||||
// Read
|
// Read (size only)
|
||||||
faceIOList faces3
|
label count = faceIOList::readContentsSize
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faces2",
|
"faces2-plain",
|
||||||
|
runTime.constant(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " counted " << count << " faces on disk in = "
|
||||||
|
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||||
|
|
||||||
|
// Read
|
||||||
|
faceIOList faces2b
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"faces2-plain",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
runTime,
|
runTime,
|
||||||
@ -105,7 +123,7 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Read old format " << faces3.size() << " faceList in = "
|
Info<< " read " << faces2b.size() << " faces in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,44 +132,54 @@ int main(int argc, char *argv[])
|
|||||||
// ~~~~~~~~~~
|
// ~~~~~~~~~~
|
||||||
|
|
||||||
{
|
{
|
||||||
// Construct big faceList in new format
|
// Construct big faceList in compact format
|
||||||
faceCompactIOList faces2
|
faceCompactIOList faces2
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faces2",
|
"faces2-compact",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
IOobject::NO_REGISTER
|
IOobject::NO_REGISTER
|
||||||
),
|
)
|
||||||
size
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const face f(identity(4));
|
faces2.resize(size, face(identity(4)));
|
||||||
|
|
||||||
forAll(faces2, i)
|
Info<< "Compact format faceList" << faces2.objectRelPath() << nl;
|
||||||
{
|
Info<< " constructed in = "
|
||||||
faces2[i] = f;
|
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Constructed new format faceList in = "
|
|
||||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
|
||||||
|
|
||||||
|
|
||||||
faces2.writeObject(streamOpt, true);
|
faces2.writeObject(streamOpt, true);
|
||||||
|
|
||||||
Info<< "Written new format faceList in = "
|
Info<< " wrote in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||||
|
|
||||||
// Read
|
// Read (size only)
|
||||||
faceCompactIOList faces3
|
label count = faceCompactIOList::readContentsSize
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"faces2",
|
"faces2-compact",
|
||||||
|
runTime.constant(),
|
||||||
|
polyMesh::meshSubDir,
|
||||||
|
runTime,
|
||||||
|
IOobject::MUST_READ
|
||||||
|
)
|
||||||
|
);
|
||||||
|
Info<< " counted " << count << " faces on disk in = "
|
||||||
|
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||||
|
|
||||||
|
// Read
|
||||||
|
faceCompactIOList faces2b
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"faces2-compact",
|
||||||
runTime.constant(),
|
runTime.constant(),
|
||||||
polyMesh::meshSubDir,
|
polyMesh::meshSubDir,
|
||||||
runTime,
|
runTime,
|
||||||
@ -161,7 +189,7 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Info<< "Read new format " << faces3.size() << " faceList in = "
|
Info<< " read " << faces2b.size() << " faces in = "
|
||||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1,3 +1,3 @@
|
|||||||
Test-DynamicList.C
|
Test-DynamicList.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-DynamicList
|
EXE = $(FOAM_USER_APPBIN)/Test-DynamicList
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-DynamicList2.C
|
Test-DynamicList2.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-DynamicList2
|
EXE = $(FOAM_USER_APPBIN)/Test-DynamicList2
|
||||||
|
|||||||
@ -52,7 +52,8 @@ void printInfo
|
|||||||
if (showSize)
|
if (showSize)
|
||||||
{
|
{
|
||||||
Info<< " size=\"" << list.size()
|
Info<< " size=\"" << list.size()
|
||||||
<< "\" capacity=\"" << list.capacity() << "\"";
|
<< "\" capacity=\"" << list.capacity() << "\""
|
||||||
|
<< "\" min=\"" << SizeMin << "\"" ;
|
||||||
if (list.cdata())
|
if (list.cdata())
|
||||||
{
|
{
|
||||||
Info<< " ptr=\"" << name(list.cdata()) << "\"";
|
Info<< " ptr=\"" << name(list.cdata()) << "\"";
|
||||||
@ -79,7 +80,8 @@ void printInfo
|
|||||||
if (showSize)
|
if (showSize)
|
||||||
{
|
{
|
||||||
Info<< " size=\"" << list.size()
|
Info<< " size=\"" << list.size()
|
||||||
<< "\" capacity=\"" << list.capacity() << "\"";
|
<< "\" capacity=\"" << list.capacity() << "\""
|
||||||
|
<< "\" min=\"" << SizeMin << "\"" ;
|
||||||
if (list.cdata())
|
if (list.cdata())
|
||||||
{
|
{
|
||||||
Info<< " ptr=\"" << name(list.cdata()) << "\"";
|
Info<< " ptr=\"" << name(list.cdata()) << "\"";
|
||||||
@ -168,6 +170,22 @@ int main(int argc, char *argv[])
|
|||||||
printInfo("", list2);
|
printInfo("", list2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
DynamicList<float, 32> list1(std::pair<label,label>(16,0));
|
||||||
|
list1 = -1;
|
||||||
|
|
||||||
|
Info<< "construct with specified size/capacity" << nl;
|
||||||
|
printInfo("", list1);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
DynamicList<float, 32> list1(std::pair<label,label>(8,16));
|
||||||
|
list1 = -1;
|
||||||
|
|
||||||
|
Info<< "construct with specified size/capacity" << nl;
|
||||||
|
printInfo("", list1);
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "\nEnd\n";
|
Info<< "\nEnd\n";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1,3 +1,3 @@
|
|||||||
Test-FixedList.C
|
Test-FixedList.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-FixedList
|
EXE = $(FOAM_USER_APPBIN)/Test-FixedList
|
||||||
|
|||||||
@ -41,7 +41,6 @@ See also
|
|||||||
#include "List.H"
|
#include "List.H"
|
||||||
#include "IPstream.H"
|
#include "IPstream.H"
|
||||||
#include "OPstream.H"
|
#include "OPstream.H"
|
||||||
#include <numeric>
|
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: v2412 |
|
| \\ / O peration | Version: v2506 |
|
||||||
| \\ / A nd | Website: www.openfoam.com |
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: v2412 |
|
| \\ / O peration | Version: v2506 |
|
||||||
| \\ / A nd | Website: www.openfoam.com |
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-HashPtrTable.C
|
Test-HashPtrTable.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-HashPtrTable
|
EXE = $(FOAM_USER_APPBIN)/Test-HashPtrTable
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011 OpenFOAM Foundation
|
Copyright (C) 2011 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,33 +42,55 @@ Description
|
|||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
class Scalar
|
bool verbosity = true;
|
||||||
|
|
||||||
|
// Gratuitous class inheritance
|
||||||
|
template<class T>
|
||||||
|
class BoxedType
|
||||||
{
|
{
|
||||||
scalar data_;
|
T data_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static bool verbose;
|
static bool verbose;
|
||||||
|
|
||||||
constexpr Scalar() noexcept : data_(0) {}
|
constexpr BoxedType() noexcept : data_(0) {}
|
||||||
Scalar(scalar val) noexcept : data_(val) {}
|
BoxedType(T val) noexcept : data_(val) {}
|
||||||
|
|
||||||
|
~BoxedType()
|
||||||
|
{
|
||||||
|
if (verbosity) Info<< " [delete BoxedType: " << value() << ']' << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
T value() const noexcept { return data_; }
|
||||||
|
T& value() noexcept { return data_; }
|
||||||
|
|
||||||
|
auto clone() const { return autoPtr<BoxedType<T>>::New(*this); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class T> Ostream& operator<<(Ostream& os, const BoxedType<T>& item)
|
||||||
|
{
|
||||||
|
return (os << " -> " << item.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Scalar : public BoxedType<scalar>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
using BoxedType<scalar>::BoxedType;
|
||||||
|
|
||||||
~Scalar()
|
~Scalar()
|
||||||
{
|
{
|
||||||
if (verbose) Info<< "delete Scalar: " << data_ << endl;
|
if (verbosity) Info<< "delete Scalar: " << value() << nl;
|
||||||
}
|
|
||||||
|
|
||||||
const scalar& value() const noexcept { return data_; }
|
|
||||||
scalar& value() noexcept { return data_; }
|
|
||||||
|
|
||||||
friend Ostream& operator<<(Ostream& os, const Scalar& item)
|
|
||||||
{
|
|
||||||
os << item.value();
|
|
||||||
return os;
|
|
||||||
}
|
}
|
||||||
|
auto clone() const { return autoPtr<Scalar>::New(*this); }
|
||||||
};
|
};
|
||||||
|
|
||||||
bool Scalar::verbose = true;
|
Ostream& operator<<(Ostream& os, const Scalar& item)
|
||||||
|
{
|
||||||
|
return (os << item.value());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -1,3 +1,3 @@
|
|||||||
Test-HashTable1.C
|
Test-HashTable1.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-HashTable1
|
EXE = $(FOAM_USER_APPBIN)/Test-HashTable1
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-HashTable2.C
|
Test-HashTable2.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-HashTable2
|
EXE = $(FOAM_USER_APPBIN)/Test-HashTable2
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-HashTable3.C
|
Test-HashTable3.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-HashTable3
|
EXE = $(FOAM_USER_APPBIN)/Test-HashTable3
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-Hashing2.C
|
Test-Hashing2.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-Hashing2
|
EXE = $(FOAM_USER_APPBIN)/Test-Hashing2
|
||||||
|
|||||||
@ -274,9 +274,7 @@ int main(int argc, char *argv[])
|
|||||||
Info<< nl << "No " << is.name() << " file found ..." << nl;
|
Info<< nl << "No " << is.name() << " file found ..." << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
token tok;
|
for (token tok; tok.read(is); /*nil*/)
|
||||||
|
|
||||||
while (is.good() && is.read(tok) && tok.good())
|
|
||||||
{
|
{
|
||||||
const word listType(tok.wordToken());
|
const word listType(tok.wordToken());
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
| ========= | |
|
| ========= | |
|
||||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
| \\ / O peration | Version: v2412 |
|
| \\ / O peration | Version: v2506 |
|
||||||
| \\ / A nd | Website: www.openfoam.com |
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
| \\/ M anipulation | |
|
| \\/ M anipulation | |
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-ICharStream1.C
|
Test-ICharStream1.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-ICharStream1
|
EXE = $(FOAM_USER_APPBIN)/Test-ICharStream1
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -83,18 +83,10 @@ Ostream& printView(Ostream& os, const char* first, const char* last)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if __cplusplus >= 201703L
|
|
||||||
Ostream& printView(Ostream& os, std::string_view s)
|
Ostream& printView(Ostream& os, std::string_view s)
|
||||||
{
|
{
|
||||||
return printView(os, s.begin(), s.end());
|
return printView(os, s.begin(), s.end());
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
Ostream& printView(Ostream& os, stdFoam::span<char> s)
|
|
||||||
{
|
|
||||||
return printView(os, s.begin(), s.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Ostream& printView(Ostream& os, const UList<char>& list)
|
Ostream& printView(Ostream& os, const UList<char>& list)
|
||||||
@ -138,17 +130,10 @@ void printInfo(const List<char>& buf)
|
|||||||
void printTokens(Istream& is)
|
void printTokens(Istream& is)
|
||||||
{
|
{
|
||||||
label count = 0;
|
label count = 0;
|
||||||
token t;
|
for (token tok; tok.read(is); ++count)
|
||||||
while (is.good())
|
|
||||||
{
|
{
|
||||||
is >> t;
|
Info<< "token: " << tok << nl;
|
||||||
if (t.good())
|
|
||||||
{
|
|
||||||
++count;
|
|
||||||
Info<<"token: " << t << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< count << " tokens" << endl;
|
Info<< count << " tokens" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
Copyright (C) 2019-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
|||||||
ioOutput.rename(args.executable() + "-labels");
|
ioOutput.rename(args.executable() + "-labels");
|
||||||
Info<< "write " << ioOutput.objectRelPath() << endl;
|
Info<< "write " << ioOutput.objectRelPath() << endl;
|
||||||
{
|
{
|
||||||
IOListRef<label>(ioOutput, ints).write();
|
IOList<label>::writeContents(ioOutput, ints);
|
||||||
}
|
}
|
||||||
|
|
||||||
ioOutput.rename(args.executable() + "-points");
|
ioOutput.rename(args.executable() + "-points");
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-IOobjectList.C
|
Test-IOobjectList.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-IOobjectList
|
EXE = $(FOAM_USER_APPBIN)/Test-IOobjectList
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-ISLList.C
|
Test-ISLList.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-ISLList
|
EXE = $(FOAM_USER_APPBIN)/Test-ISLList
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-IStringStream.C
|
Test-IStringStream.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-IStringStream
|
EXE = $(FOAM_USER_APPBIN)/Test-IStringStream
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,18 +73,13 @@ Ostream& toString(Ostream& os, const List<char>& list)
|
|||||||
|
|
||||||
void printTokens(Istream& is)
|
void printTokens(Istream& is)
|
||||||
{
|
{
|
||||||
label count = 0;
|
Info<< "stream tokens:" << endl;
|
||||||
token t;
|
|
||||||
while (is.good())
|
|
||||||
{
|
|
||||||
is >> t;
|
|
||||||
if (t.good())
|
|
||||||
{
|
|
||||||
++count;
|
|
||||||
Info<< "token: " << t << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
label count = 0;
|
||||||
|
for (token tok; tok.read(is); ++count)
|
||||||
|
{
|
||||||
|
Info<< " : " << tok << nl;
|
||||||
|
}
|
||||||
Info<< count << " tokens" << endl;
|
Info<< count << " tokens" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -455,6 +450,12 @@ int main(int argc, char *argv[])
|
|||||||
"( const char input \"string\" to tokenize )\n"
|
"( const char input \"string\" to tokenize )\n"
|
||||||
"List<label> 5(0 1 2 3 4);";
|
"List<label> 5(0 1 2 3 4);";
|
||||||
|
|
||||||
|
// printTokens
|
||||||
|
{
|
||||||
|
ISpanStream is(charInput);
|
||||||
|
printTokens(is);
|
||||||
|
}
|
||||||
|
|
||||||
string stringInput("( string ; input \"string\" to tokenize )");
|
string stringInput("( string ; input \"string\" to tokenize )");
|
||||||
|
|
||||||
List<char> listInput
|
List<char> listInput
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-IjkField.C
|
Test-IjkField.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-IjkField
|
EXE = $(FOAM_USER_APPBIN)/Test-IjkField
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
Test-List.C
|
Test-List.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-List
|
EXE = $(FOAM_USER_APPBIN)/Test-List
|
||||||
|
|||||||
@ -51,10 +51,10 @@ See also
|
|||||||
#include "IndirectList.H"
|
#include "IndirectList.H"
|
||||||
#include "SubList.H"
|
#include "SubList.H"
|
||||||
#include "SliceList.H"
|
#include "SliceList.H"
|
||||||
|
#include "SubField.H"
|
||||||
#include "ListPolicy.H"
|
#include "ListPolicy.H"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <numeric>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
// see issue #2083
|
// see issue #2083
|
||||||
@ -75,8 +75,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Detail
|
|
||||||
{
|
|
||||||
namespace ListPolicy
|
namespace ListPolicy
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -84,7 +82,6 @@ namespace ListPolicy
|
|||||||
template<> struct short_length<short> : std::integral_constant<int,20> {};
|
template<> struct short_length<short> : std::integral_constant<int,20> {};
|
||||||
|
|
||||||
} // End namespace ListPolicy
|
} // End namespace ListPolicy
|
||||||
} // End namespace Detail
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +106,7 @@ void printMyString(const UList<string>& lst)
|
|||||||
{
|
{
|
||||||
MyStrings slist2(lst);
|
MyStrings slist2(lst);
|
||||||
|
|
||||||
Info<<slist2 << nl;
|
Info<< slist2 << nl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -119,9 +116,9 @@ Ostream& printListOutputType(const char* what)
|
|||||||
Info<< what
|
Info<< what
|
||||||
<< " (contiguous="
|
<< " (contiguous="
|
||||||
<< is_contiguous_v<T> << " no_linebreak="
|
<< is_contiguous_v<T> << " no_linebreak="
|
||||||
<< Detail::ListPolicy::no_linebreak<T>::value
|
<< ListPolicy::no_linebreak<T>::value
|
||||||
<< " short_length="
|
<< " short_length="
|
||||||
<< Detail::ListPolicy::short_length<T>::value << ')';
|
<< ListPolicy::short_length<T>::value << ')';
|
||||||
|
|
||||||
return Info;
|
return Info;
|
||||||
}
|
}
|
||||||
@ -143,8 +140,46 @@ int main(int argc, char *argv[])
|
|||||||
argList::addBoolOption("ListList", "Test list of list functionality");
|
argList::addBoolOption("ListList", "Test list of list functionality");
|
||||||
argList::addBoolOption("flag");
|
argList::addBoolOption("flag");
|
||||||
|
|
||||||
|
argList::addBoolOption("reserve", "Test ListPolicy for reserve_size");
|
||||||
|
|
||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
|
|
||||||
|
if (args.found("reserve"))
|
||||||
|
{
|
||||||
|
using namespace Foam::ListPolicy;
|
||||||
|
|
||||||
|
using control = std::pair<label, label>;
|
||||||
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
const auto& tup :
|
||||||
|
{
|
||||||
|
control{ 10, 5 },
|
||||||
|
control{ 20, 25 }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const auto [len, capacity] = tup;
|
||||||
|
|
||||||
|
Info<< "test " << tup << nl;
|
||||||
|
|
||||||
|
auto size = reserve_size<16,2>(len, capacity);
|
||||||
|
Info<< " => " << size << " (ratio 2)" << nl;
|
||||||
|
|
||||||
|
size = reserve_size<16,3,2>(len, capacity);
|
||||||
|
Info<< " => " << size << " (ratio 3/2)" << nl;
|
||||||
|
|
||||||
|
size = reserve_size<16,13,8>(len, capacity);
|
||||||
|
Info<< " => " << size << " (ratio " << (13.0/8) << ')' << nl;
|
||||||
|
|
||||||
|
size = reserve_size<16,25,16>(len, capacity);
|
||||||
|
Info<< " => " << size << " (ratio " << (25.0/16) << ')' << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< nl << "\nEnd" << endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
List<label> ident(15);
|
List<label> ident(15);
|
||||||
Foam::identity(ident, 0);
|
Foam::identity(ident, 0);
|
||||||
@ -169,16 +204,6 @@ int main(int argc, char *argv[])
|
|||||||
Info<<" " << *iter;
|
Info<<" " << *iter;
|
||||||
}
|
}
|
||||||
Info<< nl;
|
Info<< nl;
|
||||||
|
|
||||||
Info<< "data:" << Foam::name(ident.cdata())
|
|
||||||
<< " size:" << ident.size() << nl;
|
|
||||||
|
|
||||||
|
|
||||||
Info<< "resize_unsafe(10)" << nl;
|
|
||||||
ident.resize_unsafe(10);
|
|
||||||
|
|
||||||
Info<< "data:" << Foam::name(ident.cdata())
|
|
||||||
<< " size:" << ident.size() << nl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false)
|
if (false)
|
||||||
@ -247,6 +272,33 @@ int main(int argc, char *argv[])
|
|||||||
};
|
};
|
||||||
Info<< "list4: " << list4 << endl;
|
Info<< "list4: " << list4 << endl;
|
||||||
|
|
||||||
|
{
|
||||||
|
List<scalar> list4Mag = ListOps::create<scalar>
|
||||||
|
(
|
||||||
|
list4,
|
||||||
|
[](const auto& a){ return a.mag(); }
|
||||||
|
);
|
||||||
|
|
||||||
|
const auto equalMag = [](const auto& a, const auto& b)
|
||||||
|
{
|
||||||
|
return (Foam::mag(a) == Foam::mag(b));
|
||||||
|
};
|
||||||
|
|
||||||
|
Info<< "list4 (mag): " << list4Mag << endl;
|
||||||
|
|
||||||
|
bool same = ListOps::equal(list4, list4Mag, equalMag);
|
||||||
|
Info<< "mag(list4) == list4(mag): " << same << nl;
|
||||||
|
|
||||||
|
SubField<scalar>(list4Mag) *= -1;
|
||||||
|
same = ListOps::equal(list4, list4Mag, equalMag);
|
||||||
|
Info<< "mag(list4) == list4(mag): " << same << nl;
|
||||||
|
|
||||||
|
SubField<scalar>(list4Mag) *= 1.1;
|
||||||
|
same = ListOps::equal(list4, list4Mag, equalMag);
|
||||||
|
Info<< "mag(list4) == list4(mag): " << same << nl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<vector> list5
|
List<vector> list5
|
||||||
{
|
{
|
||||||
{5, 3, 1},
|
{5, 3, 1},
|
||||||
@ -308,7 +360,7 @@ int main(int argc, char *argv[])
|
|||||||
auto shrtList = ListOps::create<short>
|
auto shrtList = ListOps::create<short>
|
||||||
(
|
(
|
||||||
longLabelList,
|
longLabelList,
|
||||||
[](const label& val){ return val; }
|
[](label val){ return val; }
|
||||||
);
|
);
|
||||||
|
|
||||||
printListOutputType<short>("short") << nl;
|
printListOutputType<short>("short") << nl;
|
||||||
@ -505,7 +557,7 @@ int main(int argc, char *argv[])
|
|||||||
auto scalars = ListOps::create<scalar>
|
auto scalars = ListOps::create<scalar>
|
||||||
(
|
(
|
||||||
labels,
|
labels,
|
||||||
[](const label& val){ return scalar(1.5*val); }
|
[](label val){ return scalar(1.5*val); }
|
||||||
);
|
);
|
||||||
Info<< "scalars: " << flatOutput(scalars) << endl;
|
Info<< "scalars: " << flatOutput(scalars) << endl;
|
||||||
}
|
}
|
||||||
@ -514,7 +566,7 @@ int main(int argc, char *argv[])
|
|||||||
auto vectors = ListOps::create<vector>
|
auto vectors = ListOps::create<vector>
|
||||||
(
|
(
|
||||||
labels,
|
labels,
|
||||||
[](const label& val){ return vector(1.2*val, -1.2*val, 0); }
|
[](label val){ return vector(1.2*val, -1.2*val, 0); }
|
||||||
);
|
);
|
||||||
Info<< "vectors: " << flatOutput(vectors) << endl;
|
Info<< "vectors: " << flatOutput(vectors) << endl;
|
||||||
}
|
}
|
||||||
@ -523,7 +575,7 @@ int main(int argc, char *argv[])
|
|||||||
auto longs = ListOps::create<long>
|
auto longs = ListOps::create<long>
|
||||||
(
|
(
|
||||||
labels,
|
labels,
|
||||||
[](const label& val){ return val; }
|
[](label val){ return val; }
|
||||||
);
|
);
|
||||||
Info<< "longs: " << flatOutput(longs) << endl;
|
Info<< "longs: " << flatOutput(longs) << endl;
|
||||||
}
|
}
|
||||||
@ -541,7 +593,7 @@ int main(int argc, char *argv[])
|
|||||||
(
|
(
|
||||||
labelRange().cbegin(),
|
labelRange().cbegin(),
|
||||||
labelRange(15).cend(),
|
labelRange(15).cend(),
|
||||||
[](const label& val){ return scalar(-1.125*val); }
|
[](label val){ return scalar(-1.125*val); }
|
||||||
);
|
);
|
||||||
Info<< "scalars: " << flatOutput(scalars) << endl;
|
Info<< "scalars: " << flatOutput(scalars) << endl;
|
||||||
}
|
}
|
||||||
@ -1,3 +1,3 @@
|
|||||||
Test-List2.C
|
Test-List2.cxx
|
||||||
|
|
||||||
EXE = $(FOAM_USER_APPBIN)/Test-List2
|
EXE = $(FOAM_USER_APPBIN)/Test-List2
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user