Compare commits

..

7 Commits

12806 changed files with 72861 additions and 175291 deletions

View File

@ -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
View File

@ -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

View File

@ -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()
{

View File

@ -1,39 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
# 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
#------------------------------------------------------------------------------

View File

@ -1,39 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
# 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
#------------------------------------------------------------------------------

View File

@ -9,7 +9,6 @@ It is likely incomplete...
- Yu Ankun
- Tetsuo Aoyagi
- Akira Azami
- Pete Bachant
- William Bainbridge
- Gabriel Barajas
- Kutalmis Bercin
@ -27,7 +26,6 @@ It is likely incomplete...
- Bernhard Gschaider
- Andrew Heather
- David Hill
- Crist<73>bal Ib<49><62>ez
- Yoshiaki Inoue
- Mattijs Janssens
- Andrew Jackson

View File

@ -1,2 +1,2 @@
api=2506
api=2312
patch=0

View File

@ -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

View File

@ -13,14 +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 = dimensionedVector(U.dimensions(), Zero);
{
const dimensionedVector dt(U.dimensions(), Zero);
U.internalFieldRef() = dt;
U.boundaryFieldRef() = dt.value();
}
U = dimensionedVector(U.dimensions(), Zero);
surfaceScalarField phi
(

View File

@ -1,10 +1,15 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-ldynamicMesh \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lsampling

View File

@ -56,6 +56,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fvOptions.H"
#include "simpleControl.H"
@ -71,7 +72,7 @@ int main(int argc, char *argv[])
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createDynamicFvMesh.H"
simpleControl simple(mesh);
@ -87,6 +88,16 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
// Do any mesh changes
mesh.controlledUpdate();
if (mesh.changing())
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & fvc::interpolate(U);
}
while (simple.correctNonOrthogonal())
{
fvScalarMatrix TEqn

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -94,14 +93,24 @@ Foam::PDRDragModels::basic::~basic()
Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const
{
auto tDragDcu = volSymmTensorField::New
tmp<volSymmTensorField> tDragDcu
(
"tDragDcu",
IOobject::NO_REGISTER,
U_.mesh(),
dimensionedSymmTensor(dimMass/dimTime/dimVolume, Zero)
new volSymmTensorField
(
IOobject
(
"tDragDcu",
U_.mesh().time().constant(),
U_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
U_.mesh(),
dimensionedSymmTensor(dimMass/dimTime/dimVolume, Zero)
)
);
auto& DragDcu = tDragDcu.ref();
volSymmTensorField& DragDcu = tDragDcu.ref();
if (on_)
{
@ -118,14 +127,24 @@ Foam::tmp<Foam::volSymmTensorField> Foam::PDRDragModels::basic::Dcu() const
Foam::tmp<Foam::volScalarField> Foam::PDRDragModels::basic::Gk() const
{
auto tGk = volScalarField::New
tmp<volScalarField> tGk
(
"tGk",
IOobject::NO_REGISTER,
U_.mesh(),
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
new volScalarField
(
IOobject
(
"tGk",
U_.mesh().time().constant(),
U_.mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
U_.mesh(),
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
);
auto& Gk = tGk.ref();
volScalarField& Gk = tGk.ref();
if (on_)
{

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -94,14 +93,23 @@ Foam::tmp<Foam::volScalarField> Foam::XiEqModels::SCOPEXiEq::XiEq() const
volScalarField K(0.157*upBySu/sqrt(Rl));
volScalarField Ma(MaModel.Ma());
auto tXiEq = volScalarField::New
tmp<volScalarField> tXiEq
(
"XiEq",
IOobject::NO_REGISTER,
epsilon.mesh(),
dimensionedScalar(dimless, Zero)
new volScalarField
(
IOobject
(
"XiEq",
epsilon.time().timeName(),
epsilon.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
epsilon.mesh(),
dimensionedScalar(dimless, Zero)
)
);
auto& xieq = tXiEq.ref();
volScalarField& xieq = tXiEq.ref();
forAll(xieq, celli)
{

View File

@ -78,10 +78,11 @@ bool Foam::XiEqModel::read(const dictionary& XiEqProperties)
void Foam::XiEqModel::writeFields() const
{
//***HGW It is not clear why B is written here
const auto* B = Su_.mesh().cfindObject<volSymmTensorField>("B");
if (B)
if (Su_.mesh().foundObject<volSymmTensorField>("B"))
{
B->write();
const volSymmTensorField& B =
Su_.mesh().lookupObject<volSymmTensorField>("B");
B.write();
}
}
@ -97,26 +98,39 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
const volSymmTensorField& nsv =
mesh.lookupObject<volSymmTensorField>("nsv");
auto tN = volScalarField::New
tmp<volScalarField> tN
(
"tN",
IOobject::NO_REGISTER,
mesh,
dimensionedScalar(Nv.dimensions(), Zero)
new volScalarField
(
IOobject
(
"tN",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(Nv.dimensions(), Zero)
)
);
auto& N = tN.ref();
volScalarField& N = tN.ref();
N.primitiveFieldRef() = Nv.primitiveField()*pow(mesh.V(), 2.0/3.0);
auto tns = volSymmTensorField::New
volSymmTensorField ns
(
"tns",
IOobject::NO_REGISTER,
IOobject
(
"tns",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedSymmTensor(nsv.dimensions(), Zero)
);
auto& ns = tns.ref();
ns.primitiveFieldRef() = nsv.primitiveField()*pow(mesh.V(), 2.0/3.0);
const volVectorField Uhat

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -256,14 +255,24 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
scalar phi
) const
{
auto tSu0 = volScalarField::New
tmp<volScalarField> tSu0
(
"Su0",
IOobject::NO_REGISTER,
p.mesh(),
dimensionedScalar(dimVelocity, Zero)
new volScalarField
(
IOobject
(
"Su0",
p.time().timeName(),
p.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
p.mesh(),
dimensionedScalar(dimVelocity, Zero)
)
);
auto& Su0 = tSu0.ref();
volScalarField& Su0 = tSu0.ref();
forAll(Su0, celli)
{
@ -295,14 +304,24 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Su0pTphi
const volScalarField& phi
) const
{
auto tSu0 = volScalarField::New
tmp<volScalarField> tSu0
(
"Su0",
IOobject::NO_REGISTER,
p.mesh(),
dimensionedScalar(dimVelocity, Zero)
new volScalarField
(
IOobject
(
"Su0",
p.time().timeName(),
p.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
p.mesh(),
dimensionedScalar(dimVelocity, Zero)
)
);
auto& Su0 = tSu0.ref();
volScalarField& Su0 = tSu0.ref();
forAll(Su0, celli)
{
@ -339,14 +358,24 @@ Foam::tmp<Foam::volScalarField> Foam::laminarFlameSpeedModels::SCOPE::Ma
const volScalarField& phi
) const
{
auto tMa = volScalarField::New
tmp<volScalarField> tMa
(
"Ma",
IOobject::NO_REGISTER,
phi.mesh(),
dimensionedScalar(dimless, Zero)
new volScalarField
(
IOobject
(
"Ma",
phi.time().timeName(),
phi.db(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
phi.mesh(),
dimensionedScalar(dimless, Zero)
)
);
auto& ma = tMa.ref();
volScalarField& ma = tMa.ref();
forAll(ma, celli)
{
@ -389,12 +418,21 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const
{
const fvMesh& mesh = psiuReactionThermo_.p().mesh();
return volScalarField::New
return tmp<volScalarField>
(
"Ma",
IOobject::NO_REGISTER,
mesh,
dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_))
new volScalarField
(
IOobject
(
"Ma",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("Ma", dimless, Ma(equivalenceRatio_))
)
);
}
}

View File

@ -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

View File

@ -1,6 +1,5 @@
if (adjustTimeStep)
{
runTime.setDeltaT(Foam::min(dtChem, maxDeltaT));
runTime.setDeltaT(min(dtChem, maxDeltaT));
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}

View File

@ -10,8 +10,7 @@ if (pimple.dict().getOrDefault("hydrostaticInitialization", false))
"0",
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
IOobject::REGISTER
IOobject::NO_WRITE
),
mesh
)

View File

@ -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
)
);

View File

@ -21,11 +21,6 @@
+ fvOptions(rho, he)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -20,11 +20,6 @@
fvOptions(rho, he)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -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;
}
}

View File

@ -14,11 +14,6 @@
fvOptions(rho, he)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -9,11 +9,6 @@
fvOptions(rho, e)
);
if (MRF.active())
{
EEqn += fvc::div(MRF.phi(), p);
}
EEqn.relax();
fvOptions.constrain(EEqn);

View File

@ -1,7 +1,7 @@
scalar CoNum = -GREAT;
forAll(fluidRegions, regionI)
{
CoNum = Foam::max
CoNum = max
(
compressibleCourantNo
(

View File

@ -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() << ' '

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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
(

View File

@ -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;

View File

@ -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
)
);

View File

@ -22,7 +22,7 @@ forAll(solidRegions, i)
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
DiNum = Foam::max
DiNum = max
(
solidRegionDiffNo
(

View File

@ -17,7 +17,7 @@ scalar DiNum = -GREAT;
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();
DiNum = Foam::max
DiNum = max
(
solidRegionDiffNo
(

View File

@ -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;
}
}

View File

@ -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
(

View File

@ -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();

View File

@ -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())

View File

@ -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;
}
}

View File

@ -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 \

View File

@ -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();

View File

@ -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"

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -3,7 +3,12 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -3,7 +3,12 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -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

View File

@ -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;
}
}

View File

@ -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

View File

@ -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

View File

@ -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_);

View File

@ -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);
}
}

View File

@ -4,19 +4,26 @@ if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
talphaPhi1.reset
talphaPhi1 = new surfaceScalarField
(
new surfaceScalarField
IOobject
(
mesh.newIOobject("alphaPhi1"),
mesh,
dimensionedScalar(alphaPhi10.dimensions(), Zero)
)
"alphaPhi1",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(alphaPhi10.dimensions(), Zero)
);
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -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;

View File

@ -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);
}
}

View File

@ -13,19 +13,26 @@ if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
talphaPhi1.reset
talphaPhi1 = new surfaceScalarField
(
new surfaceScalarField
IOobject
(
mesh.newIOobject("alphaPhi1"),
mesh,
dimensionedScalar(alphaPhi10.dimensions(), Zero)
)
"alphaPhi1",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(alphaPhi10.dimensions(), Zero)
);
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -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);
}
}

View File

@ -135,7 +135,7 @@ public:
virtual volScalarField& he()
{
NotImplemented;
return volScalarField::null().constCast();
return const_cast<volScalarField&>(volScalarField::null());
}
//- Enthalpy/Internal energy [J/kg]

View File

@ -99,8 +99,7 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimless, Zero)
@ -999,12 +998,19 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixtureThermo::K
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixtureThermo::nearInterface() const
{
auto tnearInt = volScalarField::New
tmp<volScalarField> tnearInt
(
"nearInterface",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimless, Zero)
new volScalarField
(
IOobject
(
"nearInterface",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
)
);
for (const phaseModel& phase : phases_)

View File

@ -243,7 +243,7 @@ public:
virtual volScalarField& he()
{
NotImplemented;
return volScalarField::null().constCast();
return const_cast<volScalarField&>(volScalarField::null());
}
//- Enthalpy/Internal energy [J/kg]

View File

@ -18,7 +18,12 @@
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField alphaPhiSum
(
mesh.newIOobject("alphaPhiSum"),
IOobject
(
"alphaPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(phi.dimensions(), Zero)
);

View File

@ -158,11 +158,13 @@ Foam::tmp<Foam::volSymmTensorField> Foam::relativeVelocityModel::tauDm() const
// Calculate the relative velocity of the continuous phase w.r.t the mean
volVectorField Ucm(betad*Udm_/betac);
return volSymmTensorField::New
return tmp<volSymmTensorField>
(
"tauDm",
IOobject::NO_REGISTER,
betad*sqr(Udm_) + betac*sqr(Ucm)
new volSymmTensorField
(
"tauDm",
betad*sqr(Udm_) + betac*sqr(Ucm)
)
);
}

View File

@ -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())
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2025 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -407,8 +407,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimPower/dimVolume, Zero)
@ -505,8 +504,7 @@ Foam::radiation::laserDTRM::laserDTRM
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimPower/pow3(dimLength), Zero)
@ -537,23 +535,42 @@ Foam::label Foam::radiation::laserDTRM::nBands() const
void Foam::radiation::laserDTRM::calculate()
{
auto treflectingCells = volScalarField::New
tmp<volScalarField> treflectingCells
(
"reflectingCellsVol",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar("zero", dimless, -1)
new volScalarField
(
IOobject
(
"reflectingCellsVol",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimless, -1)
)
);
auto& reflectingCellsVol = treflectingCells.ref();
volScalarField& reflectingCellsVol = treflectingCells.ref();
auto tnHat = volVectorField::New
tmp<volVectorField> tnHat
(
"nHat",
IOobject::NO_REGISTER,
mesh_,
dimensionedVector(dimless, Zero)
new volVectorField
(
IOobject
(
"nHat",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedVector(dimless, Zero)
)
);
auto& nHat = tnHat.ref();
volVectorField& nHat = tnHat.ref();
// Reset the field
@ -669,9 +686,9 @@ void Foam::radiation::laserDTRM::calculate()
globalIndex::gatherInplaceOp(lines);
if (UPstream::master())
if (Pstream::master())
{
OBJstream os(type() + "-particlePath.obj");
OBJstream os(type() + ":particlePath.obj");
for (label pointi = 0; pointi < lines.size(); pointi += 2)
{
@ -679,7 +696,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())

View File

@ -88,14 +88,25 @@ Foam::radiation::localDensityAbsorptionEmission::localDensityAbsorptionEmission
Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
{
auto ta = volScalarField::New
tmp<volScalarField> ta
(
"a",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(inv(dimLength), Zero)
new volScalarField
(
IOobject
(
"a",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(inv(dimLength), Zero)
)
);
auto& a = ta.ref();
volScalarField& a = ta.ref();
forAll(alphaNames_, i)
{
@ -110,14 +121,25 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
{
auto te = volScalarField::New
tmp<volScalarField> te
(
"e",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(inv(dimLength), Zero)
new volScalarField
(
IOobject
(
"e",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(inv(dimLength), Zero)
)
);
auto& e = te.ref();
volScalarField& e = te.ref();
forAll(alphaNames_, i)
{
@ -132,12 +154,22 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
{
auto tE = volScalarField::New
tmp<volScalarField> tE
(
"E",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
new volScalarField
(
IOobject
(
"E",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
);
scalarField& E = tE.ref().primitiveFieldRef();

View File

@ -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;
}

View File

@ -171,8 +171,16 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::TSource() const
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
auto tTSource = tmp<fvScalarMatrix>::New(T, dimEnergy/dimTime);
auto& TSource = tTSource.ref();
tmp<fvScalarMatrix> tTSource
(
new fvScalarMatrix
(
T,
dimEnergy/dimTime
)
);
fvScalarMatrix& TSource = tTSource.ref();
const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo>

View File

@ -382,7 +382,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappaEff
const volScalarField& kappat
) const
{
tmp<volScalarField> kappaEff(kappa() + kappat);
tmp<Foam::volScalarField> kappaEff(kappa() + kappat);
kappaEff.ref().rename("kappaEff");
return kappaEff;
}

View File

@ -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]

View File

@ -3,7 +3,12 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -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();

View File

@ -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())

View File

@ -32,7 +32,12 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -21,7 +21,12 @@
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -50,8 +50,7 @@
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(dimVelocity*dimArea, Zero)

View File

@ -68,9 +68,8 @@ Foam::multiphaseMixture::multiphaseMixture
"transportProperties",
U.time().constant(),
U.db(),
IOobject::READ_MODIFIED,
IOobject::NO_WRITE,
IOobject::REGISTER
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
),
@ -86,7 +85,9 @@ Foam::multiphaseMixture::multiphaseMixture
(
"rhoPhi",
mesh_.time().timeName(),
mesh_
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(dimMass/dimTime, Zero)
@ -100,8 +101,7 @@ Foam::multiphaseMixture::multiphaseMixture
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::REGISTER
IOobject::AUTO_WRITE
),
mesh_,
dimensionedScalar(dimless, Zero)
@ -257,12 +257,19 @@ Foam::multiphaseMixture::nuf() const
Foam::tmp<Foam::surfaceScalarField>
Foam::multiphaseMixture::surfaceTensionForce() const
{
auto tstf = surfaceScalarField::New
tmp<surfaceScalarField> tstf
(
"surfaceTensionForce",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
new surfaceScalarField
(
IOobject
(
"surfaceTensionForce",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimensionSet(1, -2, -2, 0, 0), Zero)
)
);
surfaceScalarField& stf = tstf.ref();
@ -317,7 +324,12 @@ void Foam::multiphaseMixture::solve()
{
surfaceScalarField rhoPhiSum
(
mesh_.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh_
),
mesh_,
dimensionedScalar(rhoPhi_.dimensions(), Zero)
);
@ -540,12 +552,19 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::K
Foam::tmp<Foam::volScalarField>
Foam::multiphaseMixture::nearInterface() const
{
auto tnearInt = volScalarField::New
tmp<volScalarField> tnearInt
(
"nearInterface",
IOobject::NO_REGISTER,
mesh_,
dimensionedScalar(dimless, Zero)
new volScalarField
(
IOobject
(
"nearInterface",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
)
);
for (const phase& ph : phases_)
@ -630,7 +649,12 @@ void Foam::multiphaseMixture::solveAlphas
volScalarField sumAlpha
(
mesh_.newIOobject("sumAlpha"),
IOobject
(
"sumAlpha",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
);

View File

@ -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
(

View File

@ -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)
{

View File

@ -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(),

View File

@ -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(),

View File

@ -272,7 +272,10 @@ while (pimple.correct())
).ptr()
);
pEqnComps[phasei].faceFluxCorrectionPtr(nullptr);
deleteDemandDrivenData
(
pEqnComps[phasei].faceFluxCorrectionPtr()
);
pEqnComps[phasei].relax();
}

View File

@ -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;
}

View File

@ -8,5 +8,5 @@
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
CoNum = Foam::max(CoNum, UrCoNum);
CoNum = max(CoNum, UrCoNum);
}

View File

@ -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();

View File

@ -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;
}

View File

@ -5,7 +5,12 @@ if (nAlphaSubCycles > 1)
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum
(
mesh.newIOobject("rhoPhiSum"),
IOobject
(
"rhoPhiSum",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar(rhoPhi.dimensions(), Zero)
);

View File

@ -8,5 +8,5 @@
Info<< "Max Ur Courant Number = " << UrCoNum << endl;
CoNum = Foam::max(CoNum, UrCoNum);
CoNum = max(CoNum, UrCoNum);
}

View File

@ -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
)

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
set -- -no-recursion "$@" # Parse arguments only
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments -no-recursion "$@"
. ${WM_PROJECT_DIR:?}/wmake/scripts/wmakeFunctions # Require wmake functions
#------------------------------------------------------------------------------

View File

@ -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");

View File

@ -1,3 +1,3 @@
Test-CircularBuffer.cxx
Test-CircularBuffer.C
EXE = $(FOAM_USER_APPBIN)/Test-CircularBuffer

Some files were not shown because too many files have changed in this diff Show More