Compare commits
1 Commits
develop.mo
...
feature-co
| Author | SHA1 | Date | |
|---|---|---|---|
| 54dcde5f9a |
3
.gitignore
vendored
3
.gitignore
vendored
@ -11,7 +11,6 @@
|
||||
|
||||
# File-browser settings - anywhere
|
||||
.directory
|
||||
.DS_Store # OSX app store
|
||||
|
||||
# Backup/recovery versions - anywhere
|
||||
.#*
|
||||
@ -39,8 +38,6 @@ linux*Gcc*/
|
||||
linux*Icc*/
|
||||
solaris*Gcc*/
|
||||
SunOS*Gcc*/
|
||||
darwin*Clang*/
|
||||
darwin*Gcc*/
|
||||
platforms/
|
||||
|
||||
# Top-level build directories
|
||||
|
||||
@ -49,10 +49,10 @@
|
||||
|
||||
<!--
|
||||
Providing details of your set-up can help us identify any issues, e.g.
|
||||
OpenFOAM version : v2506|v2412|v2406|v2312|v2306 etc
|
||||
Operating system : ubuntu|openSUSE|RedHat etc
|
||||
OpenFOAM version : v2312|v2306|v2212|v2206|v2112 etc
|
||||
Operating system : ubuntu|openSUSE|centos etc
|
||||
Hardware info : any info that may help?
|
||||
Compiler : gcc|clang etc
|
||||
Compiler : gcc|intel|clang etc
|
||||
-->
|
||||
|
||||
- OpenFOAM version :
|
||||
|
||||
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -1,8 +1,8 @@
|
||||
[submodule "cfmesh"]
|
||||
path = plugins/cfmesh
|
||||
path = modules/cfmesh
|
||||
url = https://develop.openfoam.com/Community/integration-cfmesh.git
|
||||
[submodule "avalanche"]
|
||||
path = plugins/avalanche
|
||||
path = modules/avalanche
|
||||
url = https://develop.openfoam.com/Community/avalanche.git
|
||||
[submodule "adios"]
|
||||
path = modules/adios
|
||||
@ -18,8 +18,5 @@
|
||||
path = modules/external-solver
|
||||
url = https://develop.openfoam.com/Modules/external-solver.git
|
||||
[submodule "turbulence-community"]
|
||||
path = plugins/turbulence-community
|
||||
path = modules/turbulence-community
|
||||
url = https://gitlab.com/openfoam/community/tc-turbulence/turbulence-community.git
|
||||
[submodule "plugins/data-community"]
|
||||
path = plugins/data-community
|
||||
url = https://gitlab.com/openfoam/community/sig-data-modelling/data-community.git
|
||||
|
||||
17
Allwmake
17
Allwmake
@ -68,34 +68,19 @@ src/Allwmake $targetType $*
|
||||
# OpenFOAM applications
|
||||
applications/Allwmake $targetType $*
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Additional components
|
||||
|
||||
# Additional components/modules
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo ========================================
|
||||
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo "Can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-modules -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
;;
|
||||
(*)
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all )
|
||||
|
||||
echo ========================================
|
||||
echo "The optional plugins can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-plugins -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Count files in given directory. Ignore "Test-*" binaries.
|
||||
_foamCountDirEntries()
|
||||
{
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
set -- -all="${0##*/}" "$@" # Execute this instead of ./Allwmake
|
||||
|
||||
# Run from OPENFOAM top-level directory only
|
||||
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
|
||||
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
}
|
||||
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||
echo "Argument parse error"
|
||||
else
|
||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Additional components
|
||||
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo ========================================
|
||||
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo "Can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-modules -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
;;
|
||||
(*)
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all $* )
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
set -- -all="${0##*/}" "$@" # Execute this instead of ./Allwmake
|
||||
|
||||
# Run from OPENFOAM top-level directory only
|
||||
wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
|
||||
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
}
|
||||
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||
echo "Argument parse error"
|
||||
else
|
||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||
echo " Check your OpenFOAM environment and installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Additional components
|
||||
|
||||
case "$FOAM_MODULE_PREFIX" in
|
||||
(false | none)
|
||||
echo ========================================
|
||||
echo "OpenFOAM plugins disabled (prefix=${FOAM_MODULE_PREFIX})"
|
||||
echo "Can be built separately:"
|
||||
echo
|
||||
echo " ./Allwmake-plugins -prefix=..."
|
||||
echo
|
||||
echo ========================================
|
||||
echo
|
||||
;;
|
||||
(*)
|
||||
# Use wmake -all instead of Allwmake to allow for overrides
|
||||
( cd "$WM_PROJECT_DIR/plugins" 2>/dev/null && wmake -all $* )
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -27,7 +27,6 @@ It is likely incomplete...
|
||||
- Bernhard Gschaider
|
||||
- Andrew Heather
|
||||
- David Hill
|
||||
- Crist<73>bal Ib<49><62>ez
|
||||
- Yoshiaki Inoue
|
||||
- Mattijs Janssens
|
||||
- Andrew Jackson
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=2507
|
||||
patch=0
|
||||
api=2402
|
||||
patch=240220
|
||||
|
||||
16
README.md
16
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
|
||||
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
|
||||
For example, for the OpenFOAM-v2506 version:
|
||||
For example, for the OpenFOAM-v2312 version:
|
||||
```
|
||||
source /installation/path/OpenFOAM-v2506/etc/bashrc
|
||||
source /installation/path/OpenFOAM-v2312/etc/bashrc
|
||||
```
|
||||
|
||||
## Compiling OpenFOAM
|
||||
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
|
||||
to the OpenFOAM directory. For example,
|
||||
```
|
||||
/path/parent
|
||||
|-- OpenFOAM-v2506
|
||||
\-- ThirdParty-v2506
|
||||
|-- OpenFOAM-v2312
|
||||
\-- ThirdParty-v2312
|
||||
```
|
||||
There are, however, many cases where this simple convention is inadequate:
|
||||
|
||||
@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
|
||||
operating system or cluster installation provides it)
|
||||
|
||||
* When we have changed the OpenFOAM directory name to some arbitrary
|
||||
directory name, e.g. openfoam-sandbox2412, etc..
|
||||
directory name, e.g. openfoam-sandbox2312, etc..
|
||||
|
||||
* When we would like any additional 3rd party software to be located
|
||||
inside of the OpenFOAM directory to ensure that the installation is
|
||||
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
|
||||
2. PREFIX/ThirdParty-VERSION
|
||||
* this corresponds to the traditional approach
|
||||
3. PREFIX/ThirdParty-vAPI
|
||||
* allows for an updated value of VERSION, *eg*, `v2506-myCustom`,
|
||||
* allows for an updated value of VERSION, *eg*, `v2312-myCustom`,
|
||||
without requiring a renamed ThirdParty. The API value would still
|
||||
be `2412` and the original `ThirdParty-v2506/` would be found.
|
||||
be `2312` and the original `ThirdParty-v2312/` would be found.
|
||||
4. PREFIX/ThirdParty-API
|
||||
* same as the previous example, but using an unadorned API value.
|
||||
5. PREFIX/ThirdParty-common
|
||||
@ -213,4 +213,4 @@ ThirdParty directory will contain either an `Allwmake` file or a
|
||||
- [Governance](http://www.openfoam.com/governance/), [Governance Projects](https://www.openfoam.com/governance/projects)
|
||||
- [Contacting OpenCFD](http://www.openfoam.com/contact/)
|
||||
|
||||
Copyright 2016-2024 OpenCFD Ltd
|
||||
Copyright 2016-2023 OpenCFD Ltd
|
||||
|
||||
@ -13,13 +13,7 @@ volVectorField U
|
||||
);
|
||||
|
||||
// Initialise the velocity internal field to zero
|
||||
// Note: explicitly bypass evaluation of contraint patch overrides
|
||||
// (e.g. swirlFanVelocity might lookup phi,rho)
|
||||
//U = Zero;
|
||||
{
|
||||
U.internalFieldRef() = Zero;
|
||||
U.boundaryFieldRef() = Zero;
|
||||
}
|
||||
U = dimensionedVector(U.dimensions(), Zero);
|
||||
|
||||
surfaceScalarField phi
|
||||
(
|
||||
|
||||
@ -36,13 +36,11 @@ Description
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact = maxCo/(CoNum + StCoNum + SMALL);
|
||||
|
||||
const scalar deltaTFact =
|
||||
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
runTime.setDeltaT(Foam::min(dtChem, maxDeltaT));
|
||||
|
||||
runTime.setDeltaT(min(dtChem, maxDeltaT));
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
}
|
||||
|
||||
@ -54,18 +54,9 @@ if (adjustTimeStep)
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
dt0
|
||||
* Foam::min
|
||||
(
|
||||
Foam::min
|
||||
(
|
||||
TFactorFluid,
|
||||
Foam::min(TFactorFilm, TFactorSolid)
|
||||
),
|
||||
1.2
|
||||
),
|
||||
dt0*min(min(TFactorFluid, min(TFactorFilm, TFactorSolid)), 1.2),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
@ -21,11 +21,6 @@
|
||||
+ fvOptions(rho, he)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -57,23 +57,11 @@ License
|
||||
// (relative to reference value)
|
||||
scalar alphaY(pimpleDict.getOrDefault<scalar>("alphaY", 1.0));
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
Info<< "Time scales min/max:" << endl;
|
||||
|
||||
// Cache old reciprocal time scale field
|
||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||
|
||||
// Flow time scale
|
||||
{
|
||||
rDeltaT.ref() =
|
||||
@ -82,14 +70,12 @@ License
|
||||
/((2*maxCo)*mesh.V()*rho())
|
||||
);
|
||||
|
||||
// Limit the largest time scale (=> smallest reciprocal time)
|
||||
rDeltaT.clamp_min(1/maxDeltaT);
|
||||
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
// Limit the largest time scale
|
||||
rDeltaT.max(1/maxDeltaT);
|
||||
|
||||
Info<< " Flow = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< 1/gMax(rDeltaT.primitiveField()) << ", "
|
||||
<< 1/gMin(rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
// Heat release rate time scale
|
||||
@ -100,13 +86,11 @@ License
|
||||
mag(Qdot)/(alphaTemp*rho*thermo.Cp()*T)
|
||||
);
|
||||
|
||||
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT);
|
||||
|
||||
auto limits = gMinMax(rDeltaTT.field());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< " Temperature = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< 1/(gMax(rDeltaTT.field()) + VSMALL) << ", "
|
||||
<< 1/(gMin(rDeltaTT.field()) + VSMALL) << endl;
|
||||
|
||||
rDeltaT.ref() = max(rDeltaT(), rDeltaTT);
|
||||
}
|
||||
|
||||
// Reaction rate time scale
|
||||
@ -154,13 +138,11 @@ License
|
||||
|
||||
if (foundY)
|
||||
{
|
||||
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTY);
|
||||
|
||||
auto limits = gMinMax(rDeltaTY.field());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< " Composition = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< 1/(gMax(rDeltaTY.field()) + VSMALL) << ", "
|
||||
<< 1/(gMin(rDeltaTY.field()) + VSMALL) << endl;
|
||||
|
||||
rDeltaT.ref() = max(rDeltaT(), rDeltaTY);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -179,22 +161,28 @@ License
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
// - only increase at a fraction of old time scale
|
||||
if (rDeltaT0_damped)
|
||||
if
|
||||
(
|
||||
rDeltaTDampingCoeff < 1
|
||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||
rDeltaT = max
|
||||
(
|
||||
rDeltaT,
|
||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
||||
);
|
||||
}
|
||||
|
||||
// Update tho boundary values of the reciprocal time-step
|
||||
rDeltaT.correctBoundaryConditions();
|
||||
|
||||
auto limits = gMinMax(rDeltaT.field());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< " Overall = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< 1/gMax(rDeltaT.primitiveField())
|
||||
<< ", " << 1/gMin(rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -106,7 +106,7 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
if (!this->readValueEntry(dict))
|
||||
{
|
||||
// Fallback: set to the internal field
|
||||
this->extrapolateInternal();
|
||||
fvPatchField<scalar>::patchInternalField(*this);
|
||||
}
|
||||
|
||||
refValue() = *this;
|
||||
|
||||
@ -23,11 +23,7 @@
|
||||
|
||||
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 = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
@ -20,11 +20,6 @@
|
||||
fvOptions(rho, he)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -52,26 +52,18 @@
|
||||
// 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<< "Flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
if (rDeltaTSmoothingCoeff < 1.0)
|
||||
{
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
{
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
@ -86,10 +78,8 @@
|
||||
rDeltaT0
|
||||
*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 = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,11 +14,6 @@
|
||||
fvOptions(rho, he)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -9,11 +9,6 @@
|
||||
fvOptions(rho, e)
|
||||
);
|
||||
|
||||
if (MRF.active())
|
||||
{
|
||||
EEqn += fvc::div(MRF.phi(), p);
|
||||
}
|
||||
|
||||
EEqn.relax();
|
||||
|
||||
fvOptions.constrain(EEqn);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
scalar CoNum = -GREAT;
|
||||
forAll(fluidRegions, regionI)
|
||||
{
|
||||
CoNum = Foam::max
|
||||
CoNum = max
|
||||
(
|
||||
compressibleCourantNo
|
||||
(
|
||||
|
||||
@ -78,8 +78,8 @@
|
||||
}
|
||||
|
||||
rho = thermo.rho();
|
||||
|
||||
rho.clamp_range(rhoMin[i], rhoMax[i]);
|
||||
rho = max(rho, rhoMin[i]);
|
||||
rho = min(rho, rhoMax[i]);
|
||||
rho.relax();
|
||||
|
||||
Info<< "Min/max rho:" << min(rho).value() << ' '
|
||||
|
||||
@ -387,18 +387,15 @@ updateCoeffs()
|
||||
{
|
||||
scalar Q = gSum(kappa(Tp)*patch().magSf()*snGrad());
|
||||
|
||||
auto limits = gMinMax(Tp);
|
||||
auto avg = gAverage(Tp);
|
||||
Info<< "T solid : " << nl << endl;
|
||||
|
||||
Info<< "T solid : " << nl << endl;
|
||||
|
||||
Info
|
||||
<< " heat transfer rate from solid:" << Q
|
||||
<< " walltemperature "
|
||||
<< " min:" << limits.min()
|
||||
<< " max:" << limits.max()
|
||||
<< " avg:" << avg << nl
|
||||
<< endl;
|
||||
Info
|
||||
<< " heat transfer rate from solid:" << Q
|
||||
<< " walltemperature "
|
||||
<< " min:" << gMin(Tp)
|
||||
<< " max:" << gMax(Tp)
|
||||
<< " avg:" << gAverage(Tp) << nl
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
else if (regionType_ == fluid)
|
||||
@ -448,16 +445,10 @@ updateCoeffs()
|
||||
scalarField qLiq((Tp - Tc)*KdeltaLiq);
|
||||
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<< " qLiq: " << infoLiq.min() << " - " << infoLiq.max() << nl
|
||||
<< " qVap: " << infoVap.min() << " - " << infoVap.max() << nl;
|
||||
Info<< " qLiq: " << gMin(qLiq) << " - " << gMax(qLiq) << endl;
|
||||
Info<< " qVap: " << gMin(qVap) << " - " << gMax(qVap) << endl;
|
||||
|
||||
scalar QLiq = gSum(qLiq*patch().magSf());
|
||||
scalar QVap = gSum(qVap*patch().magSf());
|
||||
@ -466,9 +457,9 @@ updateCoeffs()
|
||||
Info<< " Heat transfer to Vap: " << QVap << endl;
|
||||
|
||||
Info<< " walltemperature "
|
||||
<< " min:" << infoT.min()
|
||||
<< " max:" << infoT.max()
|
||||
<< " avg:" << avgT
|
||||
<< " min:" << gMin(Tp)
|
||||
<< " max:" << gMax(Tp)
|
||||
<< " avg:" << gAverage(Tp)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
);
|
||||
|
||||
|
||||
scalar regionCoNum =
|
||||
CoNum =
|
||||
0.5*gMax
|
||||
(
|
||||
sumPhi/fluidRegions[regioni].V().field()
|
||||
@ -41,9 +41,9 @@
|
||||
(
|
||||
fvc::surfaceSum(mag(phi1 - phi2))().primitiveField()
|
||||
/ fluidRegions[regioni].V().field()
|
||||
)*runTime.deltaTValue();
|
||||
)*runTime.deltaTValue(),
|
||||
|
||||
CoNum = Foam::max(CoNum, Foam::max(regionCoNum, UrCoNum));
|
||||
CoNum = max(UrCoNum, CoNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,13 +8,11 @@
|
||||
|
||||
volVectorField& U1 = phase1.URef();
|
||||
surfaceScalarField& phi1 = phase1.phiRef();
|
||||
const tmp<surfaceScalarField> talphaPhi1 = phase1.alphaPhi();
|
||||
const auto& alphaPhi1 = talphaPhi1();
|
||||
const surfaceScalarField& alphaPhi1 = phase1.alphaPhi();
|
||||
|
||||
volVectorField& U2 = phase2.URef();
|
||||
surfaceScalarField& phi2 = phase2.phiRef();
|
||||
const tmp<surfaceScalarField> talphaPhi2 = phase2.alphaPhi();
|
||||
const auto& alphaPhi2 = talphaPhi2();
|
||||
const surfaceScalarField& alphaPhi2 = phase2.alphaPhi();
|
||||
|
||||
surfaceScalarField& phi = fluid.phi();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
forAll(fluidRegions, regioni)
|
||||
{
|
||||
CoNum = Foam::max
|
||||
CoNum = max
|
||||
(
|
||||
compressibleCourantNo
|
||||
(
|
||||
@ -17,7 +17,7 @@
|
||||
/*
|
||||
forAll(porousFluidRegions, porousi)
|
||||
{
|
||||
CoNum = Foam::max
|
||||
CoNum = max
|
||||
(
|
||||
compressibleCourantNo
|
||||
(
|
||||
|
||||
@ -47,10 +47,10 @@ if (adjustTimeStep)
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
Foam::min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(),
|
||||
Foam::min(runTime.deltaTValue(), maxDeltaT)
|
||||
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(),
|
||||
min(runTime.deltaTValue(), maxDeltaT)
|
||||
)
|
||||
);
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
|
||||
@ -48,14 +48,18 @@ if (adjustTimeStep)
|
||||
scalar maxDeltaTFluid = maxCo/(CoNum + SMALL);
|
||||
scalar maxDeltaTSolid = maxDi/(DiNum + SMALL);
|
||||
|
||||
const scalar deltaTFluid =
|
||||
Foam::min(Foam::min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid), 1.2);
|
||||
scalar deltaTFluid =
|
||||
min
|
||||
(
|
||||
min(maxDeltaTFluid, 1.0 + 0.1*maxDeltaTFluid),
|
||||
1.2
|
||||
);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
Foam::min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(),
|
||||
min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
@ -22,7 +22,7 @@ forAll(solidRegions, i)
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
DiNum = Foam::max
|
||||
DiNum = max
|
||||
(
|
||||
solidRegionDiffNo
|
||||
(
|
||||
|
||||
@ -17,7 +17,7 @@ scalar DiNum = -GREAT;
|
||||
tmp<volScalarField> trho = thermo.rho();
|
||||
const volScalarField& rho = trho();
|
||||
|
||||
DiNum = Foam::max
|
||||
DiNum = max
|
||||
(
|
||||
solidRegionDiffNo
|
||||
(
|
||||
|
||||
@ -60,10 +60,13 @@ template<class Type>
|
||||
void zeroCells
|
||||
(
|
||||
GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const labelUList& cells
|
||||
const labelList& cells
|
||||
)
|
||||
{
|
||||
UIndirectList<Type>(vf.primitiveField(), cells) = Zero;
|
||||
forAll(cells, i)
|
||||
{
|
||||
vf[cells[i]] = Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -103,8 +103,8 @@ dimensionedScalar alphaMax
|
||||
laminarTransport
|
||||
);
|
||||
|
||||
const labelUList& inletCells = mesh.boundary()["inlet"].faceCells();
|
||||
//const labelUList& outletCells = mesh.boundary()["outlet"].faceCells();
|
||||
const labelList& inletCells = mesh.boundary()["inlet"].faceCells();
|
||||
//const labelList& outletCells = mesh.boundary()["outlet"].faceCells();
|
||||
|
||||
volScalarField alpha
|
||||
(
|
||||
|
||||
@ -33,12 +33,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
const DimensionedField<scalar, volMesh> contErr
|
||||
(
|
||||
interpolatedCells.internalField()
|
||||
*cellMask.internalField()
|
||||
*fvc::div(phi)().internalField()
|
||||
);
|
||||
volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi));
|
||||
|
||||
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||
|
||||
@ -55,7 +55,7 @@ if (mesh.changing())
|
||||
dimensionedScalar rAUf("rAUf", dimTime, 1.0);
|
||||
|
||||
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
||||
const labelUList& cellTypes = overlap.cellTypes();
|
||||
const labelList& cellTypes = overlap.cellTypes();
|
||||
const labelIOList& zoneIDs = overlap.zoneID();
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
|
||||
@ -36,26 +36,18 @@
|
||||
// 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<< "Flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
if (rDeltaTSmoothingCoeff < 1.0)
|
||||
{
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
{
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
@ -70,10 +62,8 @@
|
||||
rDeltaT0
|
||||
*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 = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,17 +5,13 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
|
||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh \
|
||||
-lturbulenceModels \
|
||||
-lincompressibleTurbulenceModels \
|
||||
-lincompressibleTransportModels \
|
||||
|
||||
@ -33,12 +33,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
const DimensionedField<scalar, volMesh> contErr
|
||||
(
|
||||
interpolatedCells.internalField()
|
||||
*cellMask.internalField()
|
||||
*fvc::div(phi)().internalField()
|
||||
);
|
||||
volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi));
|
||||
|
||||
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||
|
||||
@ -64,7 +64,6 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "simpleControl.H"
|
||||
@ -84,7 +83,7 @@ int main(int argc, char *argv[])
|
||||
#include "addCheckCaseOptions.H"
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "createMesh.H"
|
||||
#include "createControl.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
@ -99,14 +98,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.controlledUpdate();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
}
|
||||
|
||||
// --- Pressure-velocity SIMPLE corrector
|
||||
{
|
||||
#include "UEqn.H"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,22 +54,11 @@ License
|
||||
scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
Info<< "Time scales min/max:" << endl;
|
||||
|
||||
// Cache old reciprocal time scale field
|
||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||
|
||||
// Flow time scale
|
||||
{
|
||||
rDeltaT.ref() =
|
||||
@ -78,14 +67,12 @@ License
|
||||
/((2*maxCo)*mesh.V()*rho())
|
||||
);
|
||||
|
||||
// Limit the largest time scale (=> smallest reciprocal time)
|
||||
rDeltaT.clamp_min(1/maxDeltaT);
|
||||
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
// Limit the largest time scale
|
||||
rDeltaT.max(1/maxDeltaT);
|
||||
|
||||
Info<< " Flow = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField()) << ", "
|
||||
<< gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
// Reaction source time scale
|
||||
@ -106,13 +93,15 @@ License
|
||||
)
|
||||
);
|
||||
|
||||
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT);
|
||||
|
||||
auto limits = gMinMax(rDeltaTT.field());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< " Temperature = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
|
||||
<< gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
|
||||
|
||||
rDeltaT.ref() = max
|
||||
(
|
||||
rDeltaT(),
|
||||
rDeltaTT
|
||||
);
|
||||
}
|
||||
|
||||
// Update tho boundary values of the reciprocal time-step
|
||||
@ -124,19 +113,25 @@ License
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
// - only increase at a fraction of old time scale
|
||||
if (rDeltaT0_damped)
|
||||
if
|
||||
(
|
||||
rDeltaTDampingCoeff < 1.0
|
||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||
rDeltaT = max
|
||||
(
|
||||
rDeltaT,
|
||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
||||
);
|
||||
}
|
||||
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< " Overall = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
+ MRF.DDt(U)
|
||||
+ turbulence->divDevReff(U)
|
||||
==
|
||||
invRhoInf*parcels.SU(U)
|
||||
parcels.SU(U, true)
|
||||
+ fvOptions(U)
|
||||
);
|
||||
|
||||
|
||||
@ -39,11 +39,6 @@ dimensionedScalar rhoInfValue
|
||||
laminarTransport
|
||||
);
|
||||
|
||||
const dimensionedScalar invRhoInf
|
||||
(
|
||||
dimless/dimDensity, scalar(1)/rhoInfValue.value()
|
||||
);
|
||||
|
||||
volScalarField rhoInf
|
||||
(
|
||||
IOobject
|
||||
|
||||
@ -36,18 +36,13 @@ Description
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
const scalar maxDeltaTFact =
|
||||
Foam::min
|
||||
(
|
||||
maxCo/(CoNum + SMALL),
|
||||
maxCo/(surfaceFilm.CourantNumber() + SMALL)
|
||||
);
|
||||
|
||||
min(maxCo/(CoNum + SMALL), maxCo/(surfaceFilm.CourantNumber() + SMALL));
|
||||
const scalar deltaTFact =
|
||||
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020,2025 OpenCFD Ltd.
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,22 +54,11 @@ License
|
||||
scalar alphaTemp(pimpleDict.getOrDefault("alphaTemp", 0.05));
|
||||
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
Info<< "Time scales min/max:" << endl;
|
||||
|
||||
// Cache old reciprocal time scale field
|
||||
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
|
||||
|
||||
// Flow time scale
|
||||
{
|
||||
rDeltaT.ref() =
|
||||
@ -78,14 +67,12 @@ License
|
||||
/((2*maxCo)*mesh.V()*rho())
|
||||
);
|
||||
|
||||
// Limit the largest time scale (=> smallest reciprocal time)
|
||||
rDeltaT.clamp_min(1/maxDeltaT);
|
||||
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
// Limit the largest time scale
|
||||
rDeltaT.max(1/maxDeltaT);
|
||||
|
||||
Info<< " Flow = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField()) << ", "
|
||||
<< gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
// Reaction source time scale
|
||||
@ -105,13 +92,15 @@ License
|
||||
)
|
||||
);
|
||||
|
||||
rDeltaT.primitiveFieldRef().clamp_min(rDeltaTT);
|
||||
|
||||
auto limits = gMinMax(rDeltaTT.field());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
|
||||
Info<< " Temperature = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/(rDeltaTT.field() + VSMALL)) << ", "
|
||||
<< gMax(1/(rDeltaTT.field() + VSMALL)) << endl;
|
||||
|
||||
rDeltaT.ref() = max
|
||||
(
|
||||
rDeltaT(),
|
||||
rDeltaTT
|
||||
);
|
||||
}
|
||||
|
||||
// Update the boundary values of the reciprocal time-step
|
||||
@ -123,22 +112,25 @@ License
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
// - only increase at a fraction of old time scale
|
||||
if (rDeltaT0_damped)
|
||||
if
|
||||
(
|
||||
rDeltaTDampingCoeff < 1.0
|
||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||
rDeltaT = max
|
||||
(
|
||||
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 = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -48,7 +48,8 @@ U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
|
||||
rho = thermo.rho();
|
||||
rho.clamp_range(rhoMin, rhoMax);
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
|
||||
Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl;
|
||||
|
||||
@ -49,7 +49,8 @@
|
||||
fvOptions.correct(U);
|
||||
|
||||
rho = thermo.rho();
|
||||
rho.clamp_range(rhoMin, rhoMax);
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
|
||||
Info<< "p min/max = " << min(p).value() << ", " << max(p).value() << endl;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
rho = thermo.rho();
|
||||
rho.clamp_range(rhoMin, rhoMax);
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
@ -93,7 +94,8 @@ p.relax();
|
||||
|
||||
// Recalculate density from the relaxed pressure
|
||||
rho = thermo.rho();
|
||||
rho.clamp_range(rhoMin, rhoMax);
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl;
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
rho = thermo.rho();
|
||||
rho.clamp_range(rhoMin, rhoMax);
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
@ -93,7 +94,8 @@ p.relax();
|
||||
|
||||
// Recalculate density from the relaxed pressure
|
||||
rho = thermo.rho();
|
||||
rho.clamp_range(rhoMin, rhoMax);
|
||||
rho = max(rho, rhoMin);
|
||||
rho = min(rho, rhoMax);
|
||||
rho.relax();
|
||||
Info<< "rho min/max : " << min(rho).value() << " " << max(rho).value() << endl;
|
||||
|
||||
|
||||
@ -36,14 +36,13 @@ Description
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
Foam::min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
|
||||
min(maxCo/(CoNum + SMALL), maxAlphaCo/(alphaCoNum + SMALL));
|
||||
|
||||
const scalar deltaTFact =
|
||||
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
|
||||
@ -53,21 +53,6 @@
|
||||
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);
|
||||
|
||||
// Set the reciprocal time-step from the local Courant number
|
||||
@ -98,13 +83,10 @@
|
||||
// Update tho 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<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
if (rDeltaTSmoothingCoeff < 1.0)
|
||||
{
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
@ -128,25 +110,27 @@
|
||||
fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff);
|
||||
}
|
||||
|
||||
{
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
}
|
||||
|
||||
// Limit rate of change of time scale (=> smallest reciprocal time)
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
// - only increase at a fraction of old time scale
|
||||
if (rDeltaT0_damped)
|
||||
if
|
||||
(
|
||||
rDeltaTDampingCoeff < 1.0
|
||||
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
|
||||
)
|
||||
{
|
||||
rDeltaT.clamp_min(rDeltaT0_damped());
|
||||
|
||||
auto limits = gMinMax(rDeltaT.primitiveField());
|
||||
limits.reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL));
|
||||
rDeltaT = max
|
||||
(
|
||||
rDeltaT,
|
||||
(scalar(1) - rDeltaTDampingCoeff)*rDeltaT0
|
||||
);
|
||||
|
||||
Info<< "Damped flow time scale min/max = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,14 +36,13 @@ Description
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
Foam::min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
const scalar deltaTFact =
|
||||
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
|
||||
@ -37,15 +37,11 @@ if (adjustTimeStep)
|
||||
if (CoNum > SMALL)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
Foam::min
|
||||
(
|
||||
maxCo/(CoNum + SMALL),
|
||||
maxAcousticCo/(acousticCoNum + SMALL)
|
||||
);
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
maxDeltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
|
||||
@ -7,7 +7,6 @@ wclean libso surfaceTensionModels
|
||||
wclean libso VoFphaseCompressibleTurbulenceModels
|
||||
|
||||
wclean
|
||||
wclean compressibleInterDyMFoam
|
||||
wclean compressibleInterFilmFoam
|
||||
wclean compressibleInterIsoFoam
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ wmake $targetType surfaceTensionModels
|
||||
wmake $targetType VoFphaseCompressibleTurbulenceModels
|
||||
|
||||
wmake $targetType
|
||||
wmake $targetType compressibleInterDyMFoam
|
||||
wmake $targetType compressibleInterFilmFoam
|
||||
wmake $targetType compressibleInterIsoFoam
|
||||
wmake $targetType overCompressibleInterDyMFoam
|
||||
|
||||
@ -1,21 +1,25 @@
|
||||
EXE_INC = \
|
||||
-I../VoF \
|
||||
-ItwoPhaseMixtureThermo \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-IVoFphaseCompressibleTurbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-IVoFphaseCompressibleTurbulenceModels/lnInclude
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh \
|
||||
-ltwoPhaseMixtureThermo \
|
||||
-ltwoPhaseSurfaceTension \
|
||||
-lcompressibleTransportModels \
|
||||
|
||||
@ -74,11 +74,8 @@ Foam::compressibleInterPhaseTransportModel::compressibleInterPhaseTransportModel
|
||||
const volScalarField& alpha1(mixture_.alpha1());
|
||||
const volScalarField& alpha2(mixture_.alpha2());
|
||||
|
||||
const tmp<volScalarField> trho1 = mixture_.thermo1().rho();
|
||||
const tmp<volScalarField> trho2 = mixture_.thermo2().rho();
|
||||
|
||||
const auto& rho1 = trho1();
|
||||
const auto& rho2 = trho2();
|
||||
const volScalarField& rho1 = mixture_.thermo1().rho();
|
||||
const volScalarField& rho2 = mixture_.thermo2().rho();
|
||||
|
||||
alphaRhoPhi1_ =
|
||||
(
|
||||
@ -188,8 +185,8 @@ void Foam::compressibleInterPhaseTransportModel::correctPhasePhi()
|
||||
{
|
||||
if (twoPhaseTransport_)
|
||||
{
|
||||
const tmp<volScalarField> rho1 = mixture_.thermo1().rho();
|
||||
const tmp<volScalarField> rho2 = mixture_.thermo2().rho();
|
||||
const volScalarField& rho1 = mixture_.thermo1().rho();
|
||||
const volScalarField& rho2 = mixture_.thermo2().rho();
|
||||
|
||||
alphaRhoPhi1_.ref() = fvc::interpolate(rho1)*alphaPhi10_;
|
||||
alphaRhoPhi2_.ref() = fvc::interpolate(rho2)*(phi_ - alphaPhi10_);
|
||||
|
||||
@ -26,12 +26,12 @@ forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
}
|
||||
else if (dgdt[celli] < 0.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
|
||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
compressibleInterDyMFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/compressibleInterDyMFoam
|
||||
@ -1,35 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I../../VoF \
|
||||
-I../twoPhaseMixtureThermo \
|
||||
-I../VoFphaseCompressibleTurbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
|
||||
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfvOptions \
|
||||
-lmeshTools \
|
||||
-ltwoPhaseMixtureThermo \
|
||||
-ltwoPhaseSurfaceTension \
|
||||
-lcompressibleTransportModels \
|
||||
-lfluidThermophysicalModels \
|
||||
-lspecie \
|
||||
-ltwoPhaseMixture \
|
||||
-ltwoPhaseProperties \
|
||||
-linterfaceProperties \
|
||||
-lturbulenceModels \
|
||||
-lcompressibleTurbulenceModels \
|
||||
-lthermoTools \
|
||||
-lVoFphaseCompressibleTurbulenceModels \
|
||||
-ldynamicMesh \
|
||||
-ldynamicFvMesh
|
||||
@ -1,43 +0,0 @@
|
||||
volScalarField::Internal Sp
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Sp",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dgdt.dimensions(), Zero)
|
||||
);
|
||||
|
||||
volScalarField::Internal Su
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Su",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dgdt.dimensions(), Zero)
|
||||
);
|
||||
|
||||
forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0 && alpha1[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]*alpha1[celli];
|
||||
Su[celli] += dgdt[celli]*alpha1[celli];
|
||||
}
|
||||
else if (dgdt[celli] < 0.0 && alpha1[celli] < 1.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]*(1.0 - alpha1[celli]);
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField::Internal divU
|
||||
(
|
||||
mesh.moving()
|
||||
? fvc::div(phiCN() + mesh.phi())
|
||||
: fvc::div(phiCN())
|
||||
);
|
||||
@ -1,190 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
compressibleInterDyMFoam
|
||||
|
||||
Description
|
||||
Solver for two compressible, non-isothermal immiscible fluids using a VOF
|
||||
(volume of fluid) phase-fraction based interface capturing approach,
|
||||
with optional mesh motion and mesh topology changes including adaptive
|
||||
re-meshing.
|
||||
|
||||
The momentum and other fluid properties are of the "mixture" and a single
|
||||
momentum equation is solved.
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "CMULES.H"
|
||||
#include "EulerDdtScheme.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "CrankNicolsonDdtScheme.H"
|
||||
#include "subCycle.H"
|
||||
#include "compressibleInterPhaseTransportModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Solver for two compressible, non-isothermal immiscible fluids"
|
||||
" using VOF phase-fraction based interface capturing.\n"
|
||||
"With optional mesh motion and mesh topology changes including"
|
||||
" adaptive re-meshing."
|
||||
);
|
||||
|
||||
#include "postProcess.H"
|
||||
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createUf.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
volScalarField& p = mixture.p();
|
||||
volScalarField& T = mixture.T();
|
||||
const volScalarField& psi1 = mixture.thermo1().psi();
|
||||
const volScalarField& psi2 = mixture.thermo2().psi();
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readDyMControls.H"
|
||||
|
||||
// Store divU and divUp from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
||||
volScalarField divUp("divUp", fvc::div(fvc::absolute(phi, U), p));
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
#include "setRDeltaT.H"
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "CourantNo.H"
|
||||
#include "alphaCourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
}
|
||||
|
||||
++runTime;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
}
|
||||
|
||||
if ((mesh.changing() && correctPhi))
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "compressibleAlphaEqnSubCycle.H"
|
||||
|
||||
turbulence.correctPhasePhi();
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "TEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
if (pimple.turbCorr())
|
||||
{
|
||||
turbulence.correct();
|
||||
}
|
||||
}
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
// Correct p_rgh for consistency with p and the updated densities
|
||||
p_rgh = p - rho*gh;
|
||||
p_rgh.correctBoundaryConditions();
|
||||
|
||||
runTime.write();
|
||||
|
||||
runTime.printExecutionTime(Info);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,145 +0,0 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
fvc::flux(HbyA)
|
||||
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, Uf))
|
||||
);
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
|
||||
tmp<fvScalarMatrix> p_rghEqnComp1;
|
||||
tmp<fvScalarMatrix> p_rghEqnComp2;
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
#include "rhofs.H"
|
||||
|
||||
surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi);
|
||||
surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
|
||||
|
||||
p_rghEqnComp1 =
|
||||
pos(alpha1)
|
||||
*(
|
||||
(
|
||||
fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
|
||||
- (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
|
||||
)/rho1
|
||||
- fvc::ddt(alpha1) - fvc::div(alphaPhi1)
|
||||
+ (alpha1/rho1)
|
||||
*correction
|
||||
(
|
||||
psi1*fvm::ddt(p_rgh)
|
||||
+ fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
|
||||
)
|
||||
);
|
||||
p_rghEqnComp1.ref().relax();
|
||||
|
||||
p_rghEqnComp2 =
|
||||
pos(alpha2)
|
||||
*(
|
||||
(
|
||||
fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
|
||||
- (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
|
||||
)/rho2
|
||||
- fvc::ddt(alpha2) - fvc::div(alphaPhi2)
|
||||
+ (alpha2/rho2)
|
||||
*correction
|
||||
(
|
||||
psi2*fvm::ddt(p_rgh)
|
||||
+ fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
|
||||
)
|
||||
);
|
||||
p_rghEqnComp2.ref().relax();
|
||||
}
|
||||
else
|
||||
{
|
||||
p_rghEqnComp1 =
|
||||
fvc::ddt(rho1) + psi1*correction(fvm::ddt(p_rgh))
|
||||
+ fvc::div(phi, rho1) - fvc::Sp(fvc::div(phi), rho1);
|
||||
|
||||
p_rghEqnComp2 =
|
||||
fvc::ddt(rho2) + psi2*correction(fvm::ddt(p_rgh))
|
||||
+ fvc::div(phi, rho2) - fvc::Sp(fvc::div(phi), rho2);
|
||||
}
|
||||
|
||||
// Cache p_rgh prior to solve for density update
|
||||
volScalarField p_rgh_0(p_rgh);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqnIncomp
|
||||
(
|
||||
fvc::div(phiHbyA)
|
||||
- fvm::laplacian(rAUf, p_rgh)
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
(
|
||||
(max(alpha1, scalar(0))/rho1)*p_rghEqnComp1()
|
||||
+ (max(alpha2, scalar(0))/rho2)*p_rghEqnComp2()
|
||||
)
|
||||
+ p_rghEqnIncomp,
|
||||
p_rgh.select(pimple.finalInnerIter())
|
||||
);
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
|
||||
p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
|
||||
|
||||
dgdt =
|
||||
(
|
||||
pos(alpha2)*(p_rghEqnComp2 & p_rgh)/rho2
|
||||
- pos(alpha1)*(p_rghEqnComp1 & p_rgh)/rho1
|
||||
);
|
||||
|
||||
phi = phiHbyA + p_rghEqnIncomp.flux();
|
||||
|
||||
U = HbyA
|
||||
+ rAU*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
surfaceVectorField n(mesh.Sf()/mesh.magSf());
|
||||
Uf += n*(fvc::absolute(phi, U)/mesh.magSf() - (n & Uf));
|
||||
}
|
||||
|
||||
// Update densities from change in p_rgh
|
||||
mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
|
||||
mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
// Correct p_rgh for consistency with p and the updated densities
|
||||
p = max(p_rgh + rho*gh, pMin);
|
||||
p_rgh = p - rho*gh;
|
||||
p_rgh.correctBoundaryConditions();
|
||||
|
||||
|
||||
|
||||
K = 0.5*magSqr(U);
|
||||
}
|
||||
@ -210,7 +210,7 @@ void VoFPatchTransfer::correct
|
||||
film().toRegion(patchi, Vp);
|
||||
|
||||
const polyPatch& pp = pbm[patchi];
|
||||
const labelUList& faceCells = pp.faceCells();
|
||||
const labelList& faceCells = pp.faceCells();
|
||||
|
||||
// Accumulate the total mass removed from patch
|
||||
scalar dMassPatch = 0;
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) OpenCFD OpenCFD Ltd.
|
||||
Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
Copyright (C) 2024 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,9 @@ Group
|
||||
|
||||
Description
|
||||
Solver for two compressible, non-isothermal immiscible fluids using a VOF
|
||||
(volume of fluid) phase-fraction based interface capturing approach.
|
||||
(volume of fluid) phase-fraction based interface capturing approach,
|
||||
with optional mesh motion and mesh topology changes including adaptive
|
||||
re-meshing.
|
||||
|
||||
The momentum and other fluid properties are of the "mixture" and a single
|
||||
momentum equation is solved.
|
||||
@ -45,6 +47,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "CMULES.H"
|
||||
#include "EulerDdtScheme.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
@ -53,6 +56,7 @@ Description
|
||||
#include "compressibleInterPhaseTransportModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvcSmooth.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -70,30 +74,31 @@ int main(int argc, char *argv[])
|
||||
#include "addCheckCaseOptions.H"
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "createControl.H"
|
||||
#include "createTimeControls.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
#include "createUfIfPresent.H"
|
||||
|
||||
volScalarField& p = mixture.p();
|
||||
volScalarField& T = mixture.T();
|
||||
const volScalarField& psi1 = mixture.thermo1().psi();
|
||||
const volScalarField& psi2 = mixture.thermo2().psi();
|
||||
|
||||
if (!LTS)
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
// Store divU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
volScalarField divU("divU0", fvc::div(fvc::absolute(phi, U)));
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
@ -113,6 +118,44 @@ int main(int argc, char *argv[])
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
MRF.update();
|
||||
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf();
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
mixture.correct();
|
||||
}
|
||||
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "compressibleAlphaEqnSubCycle.H"
|
||||
|
||||
|
||||
@ -26,12 +26,12 @@ forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
}
|
||||
else if (dgdt[celli] < 0.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
|
||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,6 +8,4 @@ CorrectPhi
|
||||
pimple
|
||||
);
|
||||
|
||||
//***HGW phi.oldTime() = phi;
|
||||
|
||||
#include "continuityErrs.H"
|
||||
@ -26,12 +26,12 @@ forAll(dgdt, celli)
|
||||
{
|
||||
if (dgdt[celli] > 0.0)
|
||||
{
|
||||
Sp[celli] -= dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/Foam::max(1.0 - alpha1[celli], 1e-4);
|
||||
Sp[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
Su[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
|
||||
}
|
||||
else if (dgdt[celli] < 0.0)
|
||||
{
|
||||
Sp[celli] += dgdt[celli]/Foam::max(alpha1[celli], 1e-4);
|
||||
Sp[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
(
|
||||
"phiHbyA",
|
||||
fvc::flux(HbyA)
|
||||
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi))
|
||||
+ MRF.zeroFilter(fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi, Uf))
|
||||
);
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
@ -23,6 +23,9 @@
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
|
||||
tmp<fvScalarMatrix> p_rghEqnComp1;
|
||||
tmp<fvScalarMatrix> p_rghEqnComp2;
|
||||
|
||||
@ -34,8 +37,7 @@
|
||||
surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi);
|
||||
|
||||
p_rghEqnComp1 =
|
||||
pos(alpha1)
|
||||
*(
|
||||
(
|
||||
(
|
||||
fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f)
|
||||
- (fvOptions(alpha1, mixture.thermo1().rho())&rho1)
|
||||
@ -48,11 +50,9 @@
|
||||
+ fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh)
|
||||
)
|
||||
);
|
||||
p_rghEqnComp1.ref().relax();
|
||||
|
||||
p_rghEqnComp2 =
|
||||
pos(alpha2)
|
||||
*(
|
||||
(
|
||||
(
|
||||
fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f)
|
||||
- (fvOptions(alpha2, mixture.thermo2().rho())&rho2)
|
||||
@ -65,7 +65,6 @@
|
||||
+ fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh)
|
||||
)
|
||||
);
|
||||
p_rghEqnComp2.ref().relax();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -94,6 +93,21 @@
|
||||
);
|
||||
}
|
||||
|
||||
if (mesh.moving())
|
||||
{
|
||||
p_rghEqnComp1.ref() += fvc::div(mesh.phi())*alpha1;
|
||||
p_rghEqnComp2.ref() += fvc::div(mesh.phi())*alpha2;
|
||||
}
|
||||
|
||||
p_rghEqnComp1.ref() *= pos(alpha1);
|
||||
p_rghEqnComp2.ref() *= pos(alpha2);
|
||||
|
||||
if (pimple.transonic())
|
||||
{
|
||||
p_rghEqnComp1.ref().relax();
|
||||
p_rghEqnComp2.ref().relax();
|
||||
}
|
||||
|
||||
// Cache p_rgh prior to solve for density update
|
||||
volScalarField p_rgh_0(p_rgh);
|
||||
|
||||
@ -131,6 +145,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Correct Uf if the mesh is moving
|
||||
fvc::correctUf(Uf, U, fvc::absolute(phi, U));
|
||||
|
||||
// Update densities from change in p_rgh
|
||||
mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0));
|
||||
mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0));
|
||||
|
||||
@ -135,7 +135,7 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return volScalarField::null().constCast();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy [J/kg]
|
||||
|
||||
@ -1086,7 +1086,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
|
||||
|
||||
MULES::limitSum(alphaPhiCorrs);
|
||||
|
||||
rhoPhi_ = Zero;
|
||||
rhoPhi_ = dimensionedScalar(dimensionSet(1, 0, -1, 0, 0), Zero);
|
||||
|
||||
volScalarField sumAlpha
|
||||
(
|
||||
|
||||
@ -243,7 +243,7 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return volScalarField::null().constCast();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Enthalpy/Internal energy [J/kg]
|
||||
|
||||
@ -130,17 +130,10 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
#include "YEqns.H"
|
||||
#include "TEqn.H"
|
||||
|
||||
if (pimple.frozenFlow())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
|
||||
@ -63,11 +63,23 @@ Foam::DTRMParticle::DTRMParticle
|
||||
{
|
||||
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
|
||||
{
|
||||
// No non-native streaming
|
||||
is.fatalCheckNativeSizes(FUNCTION_NAME);
|
||||
|
||||
is.read(reinterpret_cast<char*>(&p0_), sizeofFields_);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2025 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -557,7 +557,7 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
|
||||
|
||||
// Reset the field
|
||||
Q_ == Zero;
|
||||
Q_ == dimensionedScalar(Q_.dimensions(), Zero);
|
||||
|
||||
a_ = absorptionEmission_->a();
|
||||
e_ = absorptionEmission_->e();
|
||||
@ -679,7 +679,7 @@ void Foam::radiation::laserDTRM::calculate()
|
||||
}
|
||||
}
|
||||
|
||||
scalar totalQ = gWeightedSum(mesh_.V(), Q_.primitiveField());
|
||||
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
|
||||
Info << "Total energy absorbed [W]: " << totalQ << endl;
|
||||
|
||||
if (mesh_.time().writeTime())
|
||||
|
||||
@ -36,13 +36,13 @@ Description
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
maxCo/(CoNum + SMALL),
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
maxAlphaCo/(alphaCoNum + SMALL),
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
maxAlphaDdt/(ddtAlphaNum + SMALL),
|
||||
maxDi/(DiNum + SMALL)
|
||||
@ -50,18 +50,16 @@ if (adjustTimeStep)
|
||||
)
|
||||
);
|
||||
|
||||
const scalar deltaTFact =
|
||||
Foam::min(Foam::min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
Foam::min
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaTValue(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaTValue() << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ public:
|
||||
virtual volScalarField& he()
|
||||
{
|
||||
NotImplemented;
|
||||
return volScalarField::null().constCast();
|
||||
return const_cast<volScalarField&>(volScalarField::null());
|
||||
}
|
||||
|
||||
//- Return access to the internal energy field [J/Kg]
|
||||
|
||||
@ -33,12 +33,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
const DimensionedField<scalar, volMesh> contErr
|
||||
(
|
||||
interpolatedCells.internalField()
|
||||
*cellMask.internalField()
|
||||
*fvc::div(phi)().internalField()
|
||||
);
|
||||
volScalarField contErr(interpolatedCells*cellMask*fvc::div(phi));
|
||||
|
||||
scalar sumLocalContErr = runTime.deltaTValue()*
|
||||
mag(contErr)().weightedAverage(mesh.V()).value();
|
||||
|
||||
@ -65,7 +65,7 @@
|
||||
dimensionedScalar rAUf("rAUf", dimTime/rho.dimensions(), 1.0);
|
||||
|
||||
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
||||
const labelUList& cellTypes = overlap.cellTypes();
|
||||
const labelList& cellTypes = overlap.cellTypes();
|
||||
const labelIOList& zoneIDs = overlap.zoneID();
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
|
||||
@ -232,7 +232,7 @@
|
||||
surfaceScalarField mSfGradp("mSfGradp", pEqnIncomp.flux()/rAUf);
|
||||
|
||||
phasei = 0;
|
||||
phi = Zero;
|
||||
phi = dimensionedScalar("phi", phi.dimensions(), Zero);
|
||||
|
||||
for (phaseModel& phase : fluid.phases())
|
||||
{
|
||||
@ -261,7 +261,7 @@
|
||||
|
||||
mSfGradp = pEqnIncomp.flux()/rAUf;
|
||||
|
||||
U = Zero;
|
||||
U = dimensionedVector("U", dimVelocity, Zero);
|
||||
|
||||
phasei = 0;
|
||||
for (phaseModel& phase : fluid.phases())
|
||||
|
||||
@ -626,7 +626,7 @@ void Foam::multiphaseMixture::solveAlphas
|
||||
|
||||
MULES::limitSum(alphaPhiCorrs);
|
||||
|
||||
rhoPhi_ = Zero;
|
||||
rhoPhi_ = dimensionedScalar(dimMass/dimTime, Zero);
|
||||
|
||||
volScalarField sumAlpha
|
||||
(
|
||||
|
||||
@ -12,11 +12,8 @@ for (int Ecorr=0; Ecorr<nEnergyCorrectors; Ecorr++)
|
||||
phaseModel& phase = fluid.anisothermalPhases()[anisothermalPhasei];
|
||||
|
||||
const volScalarField& alpha = phase;
|
||||
const tmp<volScalarField> trho = phase.rho();
|
||||
const tmp<volVectorField> tU = phase.U();
|
||||
|
||||
const auto& rho = trho();
|
||||
const auto& U = tU();
|
||||
const volScalarField& rho = phase.rho();
|
||||
const volVectorField& U = phase.U();
|
||||
|
||||
fvScalarMatrix EEqn
|
||||
(
|
||||
|
||||
@ -11,9 +11,7 @@
|
||||
|
||||
UPtrList<volScalarField>& Y = phase.YActiveRef();
|
||||
const volScalarField& alpha = phase;
|
||||
const tmp<volScalarField> trho = phase.rho();
|
||||
|
||||
const auto& rho = trho();
|
||||
const volScalarField& rho = phase.rho();
|
||||
|
||||
forAll(Y, i)
|
||||
{
|
||||
|
||||
@ -14,11 +14,9 @@ PtrList<fvVectorMatrix> UEqns(phases.size());
|
||||
phaseModel& phase = fluid.movingPhases()[movingPhasei];
|
||||
|
||||
const volScalarField& alpha = phase;
|
||||
const tmp<volScalarField> trho = phase.rho();
|
||||
const volScalarField& rho = phase.rho();
|
||||
volVectorField& U = phase.URef();
|
||||
|
||||
const auto& rho = trho();
|
||||
|
||||
UEqns.set
|
||||
(
|
||||
phase.index(),
|
||||
|
||||
@ -17,11 +17,9 @@ PtrList<fvVectorMatrix> UEqns(phases.size());
|
||||
phaseModel& phase = fluid.movingPhases()[movingPhasei];
|
||||
|
||||
const volScalarField& alpha = phase;
|
||||
const tmp<volScalarField> trho = phase.rho();
|
||||
const volScalarField& rho = phase.rho();
|
||||
volVectorField& U = phase.URef();
|
||||
|
||||
const auto& rho = trho();
|
||||
|
||||
UEqns.set
|
||||
(
|
||||
phase.index(),
|
||||
|
||||
@ -38,9 +38,7 @@
|
||||
|
||||
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 = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
@ -8,5 +8,5 @@
|
||||
|
||||
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
||||
|
||||
CoNum = Foam::max(CoNum, UrCoNum);
|
||||
CoNum = max(CoNum, UrCoNum);
|
||||
}
|
||||
|
||||
@ -6,13 +6,11 @@ const volScalarField& alpha2 = phase2;
|
||||
|
||||
volVectorField& U1 = phase1.URef();
|
||||
surfaceScalarField& phi1 = phase1.phiRef();
|
||||
const tmp<surfaceScalarField> talphaPhi1 = phase1.alphaPhi();
|
||||
const auto& alphaPhi1 = talphaPhi1();
|
||||
const surfaceScalarField& alphaPhi1 = phase1.alphaPhi();
|
||||
|
||||
volVectorField& U2 = phase2.URef();
|
||||
surfaceScalarField& phi2 = phase2.phiRef();
|
||||
const tmp<surfaceScalarField> talphaPhi2 = phase2.alphaPhi();
|
||||
const auto& alphaPhi2 = talphaPhi2();
|
||||
const surfaceScalarField& alphaPhi2 = phase2.alphaPhi();
|
||||
|
||||
surfaceScalarField& phi = fluid.phi();
|
||||
|
||||
|
||||
@ -31,9 +31,7 @@
|
||||
|
||||
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 = "
|
||||
<< limits.min() << ", " << limits.max() << endl;
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
@ -8,5 +8,5 @@
|
||||
|
||||
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
|
||||
|
||||
CoNum = Foam::max(CoNum, UrCoNum);
|
||||
CoNum = max(CoNum, UrCoNum);
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
+ (
|
||||
he2.name() == thermo2.phasePropertyName("e")
|
||||
? fvc::div(fvc::absolute(alphaPhi2, alpha2, U2), p)
|
||||
+ p*fvc::ddt(alpha2)
|
||||
+ p*fvc::ddt(alpha1)
|
||||
: -alpha2*dpdt
|
||||
)
|
||||
|
||||
|
||||
@ -14,6 +14,6 @@ if (!(runTime.timeIndex() % 5))
|
||||
if (smi < -SMALL)
|
||||
{
|
||||
Info<< "Resetting Dcorr to 0" << endl;
|
||||
Dcorr == Zero;
|
||||
Dcorr == dimensionedVector(Dcorr.dimensions(), Zero);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. "${WM_PROJECT_DIR:?}"/wmake/scripts/wmakeFunctions # Need wmake functions
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
set -- -all="${0##*/}" "$@" # Execute this instead of ./Allwmake
|
||||
|
||||
. "${WM_PROJECT_DIR:?}"/wmake/scripts/AllwmakeParseArguments
|
||||
. "${WM_PROJECT_DIR:?}"/wmake/scripts/wmakeFunctions # Need wmake functions
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
|
||||
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Environment
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2025 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,12 +25,9 @@ License
|
||||
|
||||
Description
|
||||
Test the sizeof for basic types.
|
||||
Also tests how the data mapping of OpenFOAM types to UPstream (MPI)
|
||||
type ids are handled.
|
||||
|
||||
Can be compiled and run without any OpenFOAM libraries.
|
||||
|
||||
g++ -std=c++17 -oTest-machine-sizes Test-machine-sizes.cpp
|
||||
g++ -std=c++11 -oTest-machine-sizes Test-machine-sizes.cpp
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,134 +37,6 @@ Description
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Partial copy from UPstream.H
|
||||
|
||||
//- Some MPI data types
|
||||
//
|
||||
//- Mapping of some fundamental and aggregate types to MPI data types
|
||||
enum class dataTypes : int
|
||||
{
|
||||
// Fundamental Types [10]:
|
||||
Basic_begin,
|
||||
type_byte = Basic_begin,
|
||||
type_int16,
|
||||
type_int32,
|
||||
type_int64,
|
||||
type_uint16,
|
||||
type_uint32,
|
||||
type_uint64,
|
||||
type_float,
|
||||
type_double,
|
||||
type_long_double,
|
||||
invalid,
|
||||
Basic_end = invalid
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Partial copy from UPstreamTraits.H
|
||||
|
||||
//- UPstream data type corresponding to an intrinsic (MPI) type
|
||||
template<class T>
|
||||
struct UPstream_mpi_dataType : std::false_type
|
||||
{
|
||||
static constexpr auto datatype_id = dataTypes::invalid;
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Specializations to match elements of UPstream::dataTypes
|
||||
#undef defineUPstreamDataTraits
|
||||
#define defineUPstreamDataTraits(TypeId, Type) \
|
||||
template<> struct UPstream_mpi_dataType<Type> : std::true_type \
|
||||
{ \
|
||||
static constexpr auto datatype_id = dataTypes::TypeId; \
|
||||
};
|
||||
|
||||
|
||||
defineUPstreamDataTraits(type_byte, char);
|
||||
defineUPstreamDataTraits(type_byte, unsigned char);
|
||||
defineUPstreamDataTraits(type_int16, int16_t);
|
||||
defineUPstreamDataTraits(type_int32, int32_t);
|
||||
defineUPstreamDataTraits(type_int64, int64_t);
|
||||
defineUPstreamDataTraits(type_uint16, uint16_t);
|
||||
defineUPstreamDataTraits(type_uint32, uint32_t);
|
||||
defineUPstreamDataTraits(type_uint64, uint64_t);
|
||||
defineUPstreamDataTraits(type_float, float);
|
||||
defineUPstreamDataTraits(type_double, double);
|
||||
defineUPstreamDataTraits(type_long_double, long double);
|
||||
|
||||
#undef defineUPstreamDataTraits
|
||||
|
||||
|
||||
//- Explicit handling of data type aliases. This is necessary since
|
||||
//- different systems map things like 'unsigned long' differently but we
|
||||
//- restrict ourselves to int32/int64 types
|
||||
template<class T>
|
||||
struct UPstream_alias_dataType
|
||||
:
|
||||
std::bool_constant
|
||||
<
|
||||
// Basic MPI type
|
||||
UPstream_mpi_dataType<std::remove_cv_t<T>>::value ||
|
||||
(
|
||||
// Or some int 32/64 type to re-map
|
||||
std::is_integral_v<T>
|
||||
&& (sizeof(T) == sizeof(int32_t) || sizeof(T) == sizeof(int64_t))
|
||||
)
|
||||
>
|
||||
{
|
||||
using base = std::conditional_t
|
||||
<
|
||||
UPstream_mpi_dataType<std::remove_cv_t<T>>::value,
|
||||
std::remove_cv_t<T>, // <- using mpi type (no alias)
|
||||
std::conditional_t // <- using alias
|
||||
<
|
||||
(
|
||||
std::is_integral_v<T>
|
||||
&& (sizeof(T) == sizeof(int32_t) || sizeof(T) == sizeof(int64_t))
|
||||
),
|
||||
std::conditional_t
|
||||
<
|
||||
(sizeof(T) == sizeof(int32_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>
|
||||
>,
|
||||
char // Fallback is a byte (eg, arbitrary contiguous data)
|
||||
>
|
||||
>;
|
||||
|
||||
static constexpr auto 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;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T>
|
||||
void print(const char* name, bool showLimits = true)
|
||||
@ -178,84 +47,28 @@ void print(const char* name, bool showLimits = true)
|
||||
if (showLimits)
|
||||
{
|
||||
std::cout
|
||||
<< " max=<";
|
||||
|
||||
if constexpr (sizeof(T) == 1)
|
||||
{
|
||||
std::cout << int(std::numeric_limits<T>::max());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << std::numeric_limits<T>::max();
|
||||
}
|
||||
std::cout << '>';
|
||||
}
|
||||
|
||||
// A declared or deduced MPI type, or aliased
|
||||
if constexpr (UPstream_mpi_dataType<T>::value)
|
||||
{
|
||||
std::cout
|
||||
<< " is_mpi=("
|
||||
<< int(UPstream_mpi_dataType<T>::datatype_id) << ')';
|
||||
}
|
||||
else
|
||||
{
|
||||
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) << ')';
|
||||
}
|
||||
<< " \"max\"=" << std::numeric_limits<T>::max();
|
||||
}
|
||||
|
||||
std::cout<< '\n';
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout<< "c++ = " << __cplusplus << '\n';
|
||||
std::cout<< "machine sizes (and some MPI traits)\n---\n\n";
|
||||
std::cout<< "machine sizes\n---\n\n";
|
||||
|
||||
print<int8_t>("int8_t");
|
||||
print<uint8_t>("uint8_t");
|
||||
print<int16_t>("int16_t");
|
||||
print<uint16_t>("uint16_t");
|
||||
print<int32_t>("int32_t");
|
||||
print<uint32_t>("uint32_t");
|
||||
print<int64_t>("int64_t");
|
||||
print<uint64_t>("uint64_t");
|
||||
|
||||
std::cout << '\n';
|
||||
print<char>("char");
|
||||
print<signed char>("signed char");
|
||||
print<unsigned char>("unsigned char");
|
||||
print<short>("short");
|
||||
print<int>("int");
|
||||
print<unsigned>("unsigned");
|
||||
print<long>("long");
|
||||
print<unsigned long>("unsigned long");
|
||||
print<std::size_t>("std::size_t");
|
||||
print<long long>("long long");
|
||||
|
||||
std::cout << '\n';
|
||||
print<std::size_t>("std::size_t");
|
||||
print<std::streamsize>("std::streamsize");
|
||||
|
||||
std::cout << '\n';
|
||||
print<float>("float");
|
||||
print<double>("double");
|
||||
print<long double>("long double");
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-CircularBuffer.cxx
|
||||
Test-CircularBuffer.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-CircularBuffer
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
Test-CompactIOList.cxx
|
||||
Test-CompactIOList.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-CompactIOList
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,7 +25,7 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-CompactIOList
|
||||
testCompactIOList
|
||||
|
||||
Description
|
||||
Simple demonstration and test application for the CompactIOList container
|
||||
@ -46,20 +46,13 @@ using namespace Foam;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("ascii", "use ascii format");
|
||||
argList::addOption("count", "number of faces");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
IOstreamOption streamOpt(IOstreamOption::BINARY);
|
||||
// IOstreamOption streamOpt(IOstreamOption::ASCII);
|
||||
|
||||
if (args.found("ascii"))
|
||||
{
|
||||
streamOpt.format(IOstreamOption::ASCII);
|
||||
}
|
||||
|
||||
const label size = args.getOrDefault<label>("count", 20000000);
|
||||
const label size = 20000000;
|
||||
|
||||
// Old format
|
||||
// ~~~~~~~~~~
|
||||
@ -70,50 +63,39 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faces2-plain",
|
||||
"faces2",
|
||||
runTime.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
),
|
||||
size
|
||||
);
|
||||
|
||||
faces2.resize(size, face(identity(4)));
|
||||
const face f(identity(4));
|
||||
|
||||
Info<< "Plain format faceList " << faces2.objectRelPath() << nl;
|
||||
Info<< " constructed in = " << runTime.cpuTimeIncrement()
|
||||
<< " s" << endl;
|
||||
forAll(faces2, i)
|
||||
{
|
||||
faces2[i] = f;
|
||||
}
|
||||
|
||||
Info<< "Constructed faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
faces2.writeObject(streamOpt, true);
|
||||
|
||||
Info<< " wrote in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
// Read (size only)
|
||||
label count = faceIOList::readContentsSize
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faces2-plain",
|
||||
runTime.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " counted " << count << " faces on disk in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||
Info<< "Written old format faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
// Read
|
||||
faceIOList faces2b
|
||||
faceIOList faces3
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faces2-plain",
|
||||
"faces2",
|
||||
runTime.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
@ -123,7 +105,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " read " << faces2b.size() << " faces in = "
|
||||
Info<< "Read old format " << faces3.size() << " faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
|
||||
@ -132,54 +114,44 @@ int main(int argc, char *argv[])
|
||||
// ~~~~~~~~~~
|
||||
|
||||
{
|
||||
// Construct big faceList in compact format
|
||||
// Construct big faceList in new format
|
||||
faceCompactIOList faces2
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faces2-compact",
|
||||
"faces2",
|
||||
runTime.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
),
|
||||
size
|
||||
);
|
||||
|
||||
faces2.resize(size, face(identity(4)));
|
||||
const face f(identity(4));
|
||||
|
||||
Info<< "Compact format faceList" << faces2.objectRelPath() << nl;
|
||||
Info<< " constructed in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||
forAll(faces2, i)
|
||||
{
|
||||
faces2[i] = f;
|
||||
}
|
||||
|
||||
Info<< "Constructed new format faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
|
||||
faces2.writeObject(streamOpt, true);
|
||||
|
||||
Info<< " wrote in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||
|
||||
// Read (size only)
|
||||
label count = faceCompactIOList::readContentsSize
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faces2-compact",
|
||||
runTime.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
);
|
||||
Info<< " counted " << count << " faces on disk in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << endl;
|
||||
Info<< "Written new format faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
|
||||
// Read
|
||||
faceCompactIOList faces2b
|
||||
faceCompactIOList faces3
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"faces2-compact",
|
||||
"faces2",
|
||||
runTime.constant(),
|
||||
polyMesh::meshSubDir,
|
||||
runTime,
|
||||
@ -189,7 +161,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
);
|
||||
|
||||
Info<< " read " << faces2b.size() << " faces in = "
|
||||
Info<< "Read new format " << faces3.size() << " faceList in = "
|
||||
<< runTime.cpuTimeIncrement() << " s" << nl << endl;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2020-2025 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -38,11 +38,12 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "complex.H"
|
||||
#include "Tensor.H"
|
||||
#include "SymmTensor.H"
|
||||
#include "SphericalTensor.H"
|
||||
#include "DiagTensor.H"
|
||||
#include "scalar.H"
|
||||
#include "complex.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -56,11 +57,45 @@ unsigned nTest_ = 0;
|
||||
unsigned nFail_ = 0;
|
||||
|
||||
|
||||
// Compare two floating point types, and print output.
|
||||
// Do ++nFail_ if values of two objects are not equal within a given tolerance.
|
||||
// The function is converted from PEP-485.
|
||||
template<class Type>
|
||||
typename std::enable_if<pTraits<Type>::rank == 0, void>::type
|
||||
cmp
|
||||
(
|
||||
const word& msg,
|
||||
const Type& x,
|
||||
const Type& y,
|
||||
const scalar relTol = 1e-8, //<! are values the same within 8 decimals
|
||||
const scalar absTol = 0 //<! useful for cmps near zero
|
||||
)
|
||||
{
|
||||
Info<< msg << x << endl;
|
||||
|
||||
unsigned nFail = 0;
|
||||
|
||||
if (max(absTol, relTol*max(mag(x), mag(y))) < mag(x - y))
|
||||
{
|
||||
++nFail;
|
||||
}
|
||||
|
||||
if (nFail)
|
||||
{
|
||||
Info<< nl
|
||||
<< " #### Fail in " << nFail << " comps ####" << nl << endl;
|
||||
++nFail_;
|
||||
}
|
||||
++nTest_;
|
||||
}
|
||||
|
||||
|
||||
// Compare two containers elementwise, and print output.
|
||||
// Do ++nFail_ if two components are not equal within a given tolerance.
|
||||
// The function is converted from PEP-485
|
||||
template<class Type>
|
||||
void cmp
|
||||
typename std::enable_if<pTraits<Type>::rank != 0, void>::type
|
||||
cmp
|
||||
(
|
||||
const word& msg,
|
||||
const Type& x,
|
||||
@ -69,37 +104,18 @@ void cmp
|
||||
const scalar absTol = 0
|
||||
)
|
||||
{
|
||||
const auto notEqual = [=](const auto& a, const auto& b) -> bool
|
||||
{
|
||||
return
|
||||
(
|
||||
Foam::max(absTol, relTol*Foam::max(Foam::mag(a), Foam::mag(b)))
|
||||
< Foam::mag(a - b)
|
||||
);
|
||||
};
|
||||
Info<< msg << x << endl;
|
||||
|
||||
unsigned nFail = 0;
|
||||
|
||||
if constexpr (is_vectorspace_v<Type>)
|
||||
for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
|
||||
{
|
||||
for (direction i = 0; i < pTraits<Type>::nComponents; ++i)
|
||||
{
|
||||
if (notEqual(x[i], y[i]))
|
||||
{
|
||||
++nFail;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (notEqual(x, y))
|
||||
if (max(absTol, relTol*max(mag(x[i]), mag(y[i]))) < mag(x[i] - y[i]))
|
||||
{
|
||||
++nFail;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< msg << x << endl;
|
||||
|
||||
if (nFail)
|
||||
{
|
||||
Info<< nl
|
||||
@ -352,26 +368,27 @@ void test_global_opers(Type)
|
||||
|
||||
// Do compile-time recursion over the given types
|
||||
template<std::size_t I = 0, typename... Tp>
|
||||
void run_tests(const std::tuple<Tp...>& types, const List<word>& names)
|
||||
inline typename std::enable_if<I == sizeof...(Tp), void>::type
|
||||
run_tests(const std::tuple<Tp...>& types, const List<word>& typeID){}
|
||||
|
||||
|
||||
template<std::size_t I = 0, typename... Tp>
|
||||
inline typename std::enable_if<I < sizeof...(Tp), void>::type
|
||||
run_tests(const std::tuple<Tp...>& types, const List<word>& typeID)
|
||||
{
|
||||
if constexpr (I < sizeof...(Tp))
|
||||
{
|
||||
const auto& name = names[I];
|
||||
Info<< nl << " ## Test constructors: "<< typeID[I] <<" ##" << nl;
|
||||
test_constructors(std::get<I>(types));
|
||||
|
||||
Info<< nl << " ## Test constructors: " << name << " ##" << nl;
|
||||
test_constructors(std::get<I>(types));
|
||||
Info<< nl << " ## Test member functions: "<< typeID[I] <<" ##" << nl;
|
||||
test_member_funcs(std::get<I>(types));
|
||||
|
||||
Info<< nl << " ## Test member functions: " << name << " ##" << nl;
|
||||
test_member_funcs(std::get<I>(types));
|
||||
Info<< nl << " ## Test global functions: "<< typeID[I] << " ##" << nl;
|
||||
test_global_funcs(std::get<I>(types));
|
||||
|
||||
Info<< nl << " ## Test global functions: " << name << " ##" << nl;
|
||||
test_global_funcs(std::get<I>(types));
|
||||
Info<< nl << " ## Test global operators: "<< typeID[I] <<" ##" << nl;
|
||||
test_global_opers(std::get<I>(types));
|
||||
|
||||
Info<< nl << " ## Test global operators: " << name << " ##" << nl;
|
||||
test_global_opers(std::get<I>(types));
|
||||
|
||||
run_tests<I + 1, Tp...>(types, names);
|
||||
}
|
||||
run_tests<I + 1, Tp...>(types, typeID);
|
||||
}
|
||||
|
||||
|
||||
@ -386,8 +403,8 @@ int main()
|
||||
|
||||
const List<word> typeID
|
||||
({
|
||||
"DiagTensor<float>",
|
||||
"DiagTensor<double>",
|
||||
"DiagTensor<floatScalar>",
|
||||
"DiagTensor<doubleScalar>",
|
||||
"DiagTensor<complex>"
|
||||
});
|
||||
|
||||
|
||||
3
applications/test/Dictionary/Make/files
Normal file
3
applications/test/Dictionary/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-Dictionary.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-Dictionary
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user