Compare commits

..

2 Commits

11785 changed files with 55297 additions and 86317 deletions

View File

@ -49,7 +49,7 @@
<!-- <!--
Providing details of your set-up can help us identify any issues, e.g. Providing details of your set-up can help us identify any issues, e.g.
OpenFOAM version : v2306|v2212|v2206|v2112|v2106 etc OpenFOAM version : v2212|v2206|v2112|v2106|v2012 etc
Operating system : ubuntu|openSUSE|centos etc Operating system : ubuntu|openSUSE|centos etc
Hardware info : any info that may help? Hardware info : any info that may help?
Compiler : gcc|intel|clang etc Compiler : gcc|intel|clang etc

View File

@ -96,12 +96,10 @@ echo " ${WM_PROJECT_DIR##*/}"
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler" echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}" echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo echo
echo " api = $(etc/openfoam -show-api 2>/dev/null)"
# The api/patch information echo " patch = $(etc/openfoam -show-patch 2>/dev/null)"
sed -e 's/^/ /; s/=/ = /' ./META-INFO/api-info 2>/dev/null || true echo " bin = $(_foamCountDirEntries "$FOAM_APPBIN") entries"
echo " lib = $(_foamCountDirEntries "$FOAM_LIBBIN") entries"
echo " bin = $(_foamCountDirEntries "$FOAM_APPBIN") entries"
echo " lib = $(_foamCountDirEntries "$FOAM_LIBBIN") entries"
echo echo
echo ======================================== echo ========================================

View File

@ -5,22 +5,17 @@ It is likely incomplete...
## Contributors (alphabetical by surname) ## Contributors (alphabetical by surname)
- Horacio Aguerre
- Yu Ankun
- Tetsuo Aoyagi - Tetsuo Aoyagi
- Akira Azami - Akira Azami
- William Bainbridge - William Bainbridge
- Gabriel Barajas - Gabriel Barajas
- Kutalmis Bercin - Kutalmis Bercin
- Julius Bergmann
- Ivor Clifford - Ivor Clifford
- Greg Collecutt - Greg Collecutt
- Jonathan Cranford - Jonathan Cranford
- Santiago Marquez Damian
- Sergio Ferraris - Sergio Ferraris
- Matej Forman - Matej Forman
- Marian Fuchs - Marian Fuchs
- Gabriel Gerlero
- Pawan Ghildiyal - Pawan Ghildiyal
- Chris Greenshields - Chris Greenshields
- Bernhard Gschaider - Bernhard Gschaider
@ -55,11 +50,8 @@ It is likely incomplete...
- Gavin Tabor - Gavin Tabor
- Zeljko Tukovic - Zeljko Tukovic
- Eugene De Villiers - Eugene De Villiers
- Louis Vittoz
- Vuko Vukcevic
- Yi Wang - Yi Wang
- Norbert Weber - Norbert Weber
- Volker Weissmann
- Henry Weller - Henry Weller
- Niklas Wikstrom - Niklas Wikstrom
- Guanyang Xue - Guanyang Xue

View File

@ -1,2 +1,2 @@
api=2306 api=2212
patch=0 patch=230110

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 If OpenFOAM has already been compiled on your system, simply source
the appropriate `etc/bashrc` or `etc/cshrc` file and get started. the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
For example, for the OpenFOAM-v2306 version: For example, for the OpenFOAM-v2212 version:
``` ```
source /installation/path/OpenFOAM-v2306/etc/bashrc source /installation/path/OpenFOAM-v2212/etc/bashrc
``` ```
## Compiling OpenFOAM ## Compiling OpenFOAM
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
to the OpenFOAM directory. For example, to the OpenFOAM directory. For example,
``` ```
/path/parent /path/parent
|-- OpenFOAM-v2306 |-- OpenFOAM-v2212
\-- ThirdParty-v2306 \-- ThirdParty-v2212
``` ```
There are, however, many cases where this simple convention is inadequate: 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) operating system or cluster installation provides it)
* When we have changed the OpenFOAM directory name to some arbitrary * When we have changed the OpenFOAM directory name to some arbitrary
directory name, e.g. openfoam-sandbox2306, etc.. directory name, e.g. openfoam-sandbox2212, etc..
* When we would like any additional 3rd party software to be located * When we would like any additional 3rd party software to be located
inside of the OpenFOAM directory to ensure that the installation is 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 2. PREFIX/ThirdParty-VERSION
* this corresponds to the traditional approach * this corresponds to the traditional approach
3. PREFIX/ThirdParty-vAPI 3. PREFIX/ThirdParty-vAPI
* allows for an updated value of VERSION, *eg*, `v2306-myCustom`, * allows for an updated value of VERSION, *eg*, `v2212-myCustom`,
without requiring a renamed ThirdParty. The API value would still without requiring a renamed ThirdParty. The API value would still
be `2306` and the original `ThirdParty-v2306/` would be found. be `2212` and the original `ThirdParty-v2212/` would be found.
4. PREFIX/ThirdParty-API 4. PREFIX/ThirdParty-API
* same as the previous example, but using an unadorned API value. * same as the previous example, but using an unadorned API value.
5. PREFIX/ThirdParty-common 5. PREFIX/ThirdParty-common

View File

@ -18,6 +18,6 @@ dimensionedScalar rho("rho", dimDensity, transportProperties);
scalar MaxCo = scalar MaxCo =
max(mesh.surfaceInterpolation::deltaCoeffs()*c0).value() max(mesh.surfaceInterpolation::deltaCoeffs()*c0).value()
*runTime.deltaTValue(); *runTime.deltaT().value();
Info<< "Max acoustic Courant Number = " << MaxCo << endl; Info<< "Max acoustic Courant Number = " << MaxCo << endl;

View File

@ -1,4 +1,125 @@
#include "../createFields.H" Info<< "Reading velocity field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Initialise the velocity internal field to zero
U = dimensionedVector(U.dimensions(), Zero);
surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
fvc::flux(U)
);
if (args.found("initialiseUBCs"))
{
U.correctBoundaryConditions();
phi = fvc::flux(U);
}
// Construct a pressure field
// If it is available read it otherwise construct from the velocity BCs
// converting fixed-value BCs to zero-gradient and vice versa.
// Allow override from command-line -pName option
const word pName = args.getOrDefault<word>("pName", "p");
// Infer the pressure BCs from the velocity
wordList pBCTypes
(
U.boundaryField().size(),
fixedValueFvPatchScalarField::typeName
);
forAll(U.boundaryField(), patchi)
{
if (U.boundaryField()[patchi].fixesValue())
{
pBCTypes[patchi] = zeroGradientFvPatchScalarField::typeName;
}
}
// Note that registerObject is false for the pressure field. The pressure
// field in this solver doesn't have a physical value during the solution.
// It shouldn't be looked up and used by sub models or boundary conditions.
Info<< "Constructing pressure field " << pName << nl << endl;
volScalarField p
(
IOobject
(
pName,
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
),
mesh,
dimensionedScalar(sqr(dimVelocity), Zero),
pBCTypes
);
// Infer the velocity potential BCs from the pressure
wordList PhiBCTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
);
forAll(p.boundaryField(), patchi)
{
if (p.boundaryField()[patchi].fixesValue())
{
PhiBCTypes[patchi] = fixedValueFvPatchScalarField::typeName;
}
}
Info<< "Constructing velocity potential field Phi\n" << endl;
volScalarField Phi
(
IOobject
(
"Phi",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimLength*dimVelocity, Zero),
PhiBCTypes
);
label PhiRefCell = 0;
scalar PhiRefValue = 0;
setRefCell
(
Phi,
potentialFlow.dict(),
PhiRefCell,
PhiRefValue
);
mesh.setFluxRequired(Phi.name());
#include "createMRF.H"
// Add solver-specific interpolations // Add solver-specific interpolations
{ {

View File

@ -83,7 +83,6 @@ Description
\heading Options \heading Options
\plaintable \plaintable
-writep | write the Euler pressure -writep | write the Euler pressure
-writephi | Write the final volumetric flux
-writePhi | Write the final velocity potential -writePhi | Write the final velocity potential
-initialiseUBCs | Update the velocity boundaries before solving for Phi -initialiseUBCs | Update the velocity boundaries before solving for Phi
\endplaintable \endplaintable
@ -118,12 +117,6 @@ int main(int argc, char *argv[])
"Initialise U boundary conditions" "Initialise U boundary conditions"
); );
argList::addBoolOption
(
"writephi",
"Write the final volumetric flux field"
);
argList::addBoolOption argList::addBoolOption
( (
"writePhi", "writePhi",
@ -142,8 +135,6 @@ int main(int argc, char *argv[])
"Execute functionObjects" "Execute functionObjects"
); );
#include "addRegionOption.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H" #include "setRootCaseLists.H"
#include "createTime.H" #include "createTime.H"
#include "createNamedDynamicFvMesh.H" #include "createNamedDynamicFvMesh.H"
@ -203,16 +194,11 @@ int main(int argc, char *argv[])
<< endl; << endl;
} }
// Write U // Write U and phi
U.write(); U.write();
phi.write();
// Optionally write the volumetric flux, phi // Optionally write Phi
if (args.found("writephi"))
{
phi.write();
}
// Optionally write velocity potential, Phi
if (args.found("writePhi")) if (args.found("writePhi"))
{ {
Phi.write(); Phi.write();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020,2023 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -132,11 +132,6 @@ void PDRkEpsilon::correct()
// Update epsilon and G at the wall // Update epsilon and G at the wall
epsilon_.boundaryFieldRef().updateCoeffs(); epsilon_.boundaryFieldRef().updateCoeffs();
// Push new cell values to
// coupled neighbours. Note that we want to avoid the re-updateCoeffs
// of the wallFunctions so make sure to bypass the evaluate on
// those patches and only do the coupled ones.
epsilon_.boundaryFieldRef().evaluateCoupled<coupledFvPatch>();
// Add the blockage generation term so that it is included consistently // Add the blockage generation term so that it is included consistently
// in both the k and epsilon equations // in both the k and epsilon equations

View File

@ -109,7 +109,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar(Nv.dimensions(), Zero) dimensionedScalar(Nv.dimensions(), Zero)

View File

@ -171,7 +171,10 @@ if (ign.ignited())
fvOptions.correct(Su); fvOptions.correct(Su);
Su.clamp_range(SuMin, SuMax); // Limit the maximum Su
// ~~~~~~~~~~~~~~~~~~~~
Su.min(SuMax);
Su.max(SuMin);
} }
else else
{ {
@ -215,7 +218,7 @@ if (ign.ignited())
+ ( + (
scalar(1) scalar(1)
+ (2*XiShapeCoef) + (2*XiShapeCoef)
*(scalar(0.5) - clamp(b, zero_one{})) *(scalar(0.5) - min(max(b, scalar(0)), scalar(1)))
)*(XiEqStar - scalar(1.001)) )*(XiEqStar - scalar(1.001))
); );
@ -223,7 +226,7 @@ if (ign.ignited())
volScalarField R(Gstar*XiEqStar/(XiEqStar - scalar(1))); volScalarField R(Gstar*XiEqStar/(XiEqStar - scalar(1)));
volScalarField G(R*(XiEq - scalar(1.001))/XiEq); volScalarField G(R*(XiEq - scalar(1.001))/XiEq);
//R *= (Gstar + 2*mag(devSymm(fvc::grad(U))))/Gstar; //R *= (Gstar + 2*mag(dev(symm(fvc::grad(U)))))/Gstar;
// Solve for the flame wrinkling // Solve for the flame wrinkling
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -12,7 +12,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar("Ydefault", dimless, 1) dimensionedScalar("Ydefault", dimless, 1)
@ -29,7 +29,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar("p", dimPressure, p0) dimensionedScalar("p", dimPressure, p0)
@ -46,7 +46,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimensionedScalar("T", dimTemperature, T0) dimensionedScalar("T", dimTemperature, T0)

View File

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

View File

@ -1,3 +1,3 @@
dtChem = chemistry.solve(runTime.deltaTValue()); dtChem = chemistry.solve(runTime.deltaT().value());
scalar Qdot = chemistry.Qdot()()[0]/rho[0]; scalar Qdot = chemistry.Qdot()()[0]/rho[0];
integratedHeat += Qdot*runTime.deltaTValue(); integratedHeat += Qdot*runTime.deltaT().value();

View File

@ -39,13 +39,13 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
radiation->correct(); radiation->correct();

View File

@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -103,10 +103,16 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (!this->readValueEntry(dict)) if (dict.found("value"))
{ {
// Fallback: set to the internal field fvPatchField<scalar>::operator=
fvPatchField<scalar>::patchInternalField(*this); (
scalarField("value", dict, p.size())
);
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
} }
refValue() = *this; refValue() = *this;
@ -159,10 +165,14 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
return; return;
} }
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_); const fvPatchScalarField& pmu =
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(muName_);
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_); const fvPatchScalarField& prho =
const auto& pU = patch().lookupPatchField<volVectorField>(UName_); patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
const fvPatchVectorField& pU =
patch().lookupPatchField<volVectorField, vector>(UName_);
// Prandtl number reading consistent with rhoCentralFoam // Prandtl number reading consistent with rhoCentralFoam
const dictionary& thermophysicalProperties = const dictionary& thermophysicalProperties =
@ -197,7 +207,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
// Write // Write
void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeEntryIfDifferent<word>("U", "U", UName_); os.writeEntryIfDifferent<word>("U", "U", UName_);
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
@ -207,7 +217,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
os.writeEntry("accommodationCoeff", accommodationCoeff_); os.writeEntry("accommodationCoeff", accommodationCoeff_);
Twall_.writeEntry("Twall", os); Twall_.writeEntry("Twall", os);
os.writeEntry("gamma", gamma_); os.writeEntry("gamma", gamma_);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -105,15 +105,18 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
<< exit(FatalIOError); << exit(FatalIOError);
} }
if (this->readValueEntry(dict)) if (dict.found("value"))
{ {
const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL); fvPatchField<vector>::operator=
const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL); (
vectorField("value", dict, p.size())
);
if (hasRefValue && hasFrac) if (dict.found("refValue") && dict.found("valueFraction"))
{ {
this->refValue().assign(*hasRefValue, p.size()); this->refValue() = vectorField("refValue", dict, p.size());
this->valueFraction().assign(*hasFrac, p.size()); this->valueFraction() =
scalarField("valueFraction", dict, p.size());
} }
else else
{ {
@ -152,9 +155,12 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
return; return;
} }
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_); const fvPatchScalarField& pmu =
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_); patch().lookupPatchField<volScalarField, scalar>(muName_);
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_); const fvPatchScalarField& prho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
Field<scalar> C1 Field<scalar> C1
( (
@ -181,8 +187,8 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
if (curvature_) if (curvature_)
{ {
const auto& ptauMC = const fvPatchTensorField& ptauMC =
patch().lookupPatchField<volTensorField>(tauMCName_); patch().lookupPatchField<volTensorField, tensor>(tauMCName_);
vectorField n(patch().nf()); vectorField n(patch().nf());
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC)); refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
@ -194,7 +200,7 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchVectorField::write(os);
os.writeEntryIfDifferent<word>("T", "T", TName_); os.writeEntryIfDifferent<word>("T", "T", TName_);
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_); os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
@ -209,7 +215,7 @@ void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
refValue().writeEntry("refValue", os); refValue().writeEntry("refValue", os);
valueFraction().writeEntry("valueFraction", os); valueFraction().writeEntry("valueFraction", os);
fvPatchField<vector>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -104,8 +104,11 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
return; return;
} }
const auto& psip = patch().lookupPatchField<volScalarField>(psiName_); const fvPatchField<scalar>& psip =
const auto& pp = patch().lookupPatchField<volScalarField>(pName_); patch().lookupPatchField<volScalarField, scalar>(psiName_);
const fvPatchField<scalar>& pp =
patch().lookupPatchField<volScalarField, scalar>(pName_);
operator==(psip*pp); operator==(psip*pp);
@ -115,10 +118,11 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeEntryIfDifferent<word>("p", "p", pName_); os.writeEntryIfDifferent<word>("p", "p", pName_);
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_); os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -17,7 +17,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate
vf, vf,
dir, dir,
"reconstruct(" "reconstruct("
+ (reconFieldName.empty() ? vf.name() : reconFieldName) + (reconFieldName != word::null ? reconFieldName : vf.name())
+ ')' + ')'
) )
); );

View File

@ -29,7 +29,7 @@ if (mesh.changing())
wordList pcorrTypes wordList pcorrTypes
( (
p.boundaryField().size(), p.boundaryField().size(),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
// Set BCs of pcorr to fixed-value for patches at which p is fixed // Set BCs of pcorr to fixed-value for patches at which p is fixed

View File

@ -7,7 +7,7 @@
*mag(aMesh.edgeInterpolation::deltaCoeffs()) *mag(aMesh.edgeInterpolation::deltaCoeffs())
/rhol /rhol
) )
).value()*runTime.deltaTValue(); ).value()*runTime.deltaT().value();
Info<< "Max Capillary Courant Number = " << CoNumSigma << '\n' << endl; Info<< "Max Capillary Courant Number = " << CoNumSigma << '\n' << endl;
} }

View File

@ -87,13 +87,7 @@ int main(int argc, char *argv[])
( (
fam::ddt(h, Us) fam::ddt(h, Us)
+ fam::div(phi2s, Us) + fam::div(phi2s, Us)
+ fam::Sp + fam::Sp(0.0125*frictionFactor*mag(Us), Us)
(
0.0125
*frictionFactor.internalField()
*mag(Us.internalField()),
Us
)
== ==
Gs*h Gs*h
- fam::Sp(Sd, Us) - fam::Sp(Sd, Us)

View File

@ -47,10 +47,10 @@ if (aMesh.nInternalEdges())
); );
CoNum = max(SfUfbyDelta/aMesh.magLe()) CoNum = max(SfUfbyDelta/aMesh.magLe())
.value()*runTime.deltaTValue(); .value()*runTime.deltaT().value();
meanCoNum = (sum(SfUfbyDelta)/sum(aMesh.magLe())) meanCoNum = (sum(SfUfbyDelta)/sum(aMesh.magLe()))
.value()*runTime.deltaTValue(); .value()*runTime.deltaT().value();
velMag = max(mag(phis)/aMesh.magLe()).value(); velMag = max(mag(phis)/aMesh.magLe()).value();
} }

View File

@ -47,7 +47,6 @@ forAll(Us, faceI)
Us[faceI].z() = Us[faceI].z() =
Uinf.value()*0.25*R[faceI].x()*R[faceI].z()/sqr(mag(R[faceI])); Uinf.value()*0.25*R[faceI].x()*R[faceI].z()/sqr(mag(R[faceI]));
} }
Us.boundaryFieldRef().evaluateCoupled<coupledFaPatch>();
Us -= aMesh.faceAreaNormals()*(aMesh.faceAreaNormals() & Us); Us -= aMesh.faceAreaNormals()*(aMesh.faceAreaNormals() & Us);

View File

@ -29,7 +29,7 @@ if (mesh.changing())
wordList pcorrTypes wordList pcorrTypes
( (
p.boundaryField().size(), p.boundaryField().size(),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
// Set BCs of pcorr to fixed-value for patches at which p is fixed // Set BCs of pcorr to fixed-value for patches at which p is fixed

View File

@ -108,7 +108,7 @@ forAll(fluidRegions, i)
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
dimensionedScalar(word::null, dimLength, Zero) dimensionedScalar("hRef", dimLength, Zero) // uses name
) )
); );

View File

@ -1,5 +1,5 @@
derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C
solid/solidRegionDiffNo.C ../solid/solidRegionDiffNo.C
chtMultiRegionTwoPhaseEulerFoam.C chtMultiRegionTwoPhaseEulerFoam.C
EXE = $(FOAM_APPBIN)/chtMultiRegionTwoPhaseEulerFoam EXE = $(FOAM_APPBIN)/chtMultiRegionTwoPhaseEulerFoam

View File

@ -88,29 +88,26 @@ kappa
case mtLookup: case mtLookup:
{ {
if (mesh.foundObject<volScalarField>(kappaName_))
{ {
const auto* ptr = return patch().lookupPatchField<volScalarField, scalar>
mesh.cfindObject<volScalarField>(kappaName_); (
kappaName_
if (ptr) );
{
return patch().patchField(*ptr);
}
} }
else if (mesh.foundObject<volSymmTensorField>(kappaName_))
{ {
const auto* ptr = const symmTensorField& KWall =
mesh.cfindObject<volSymmTensorField>(kappaName_); patch().lookupPatchField<volSymmTensorField, scalar>
(
kappaName_
);
if (ptr) const vectorField n(patch().nf());
{
const symmTensorField& KWall = patch().patchField(*ptr);
const vectorField n(patch().nf()); return n & KWall & n;
return n & KWall & n;
}
} }
else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Did not find field " << kappaName_ << "Did not find field " << kappaName_
@ -120,6 +117,9 @@ kappa
<< " or volSymmTensorField." << " or volSymmTensorField."
<< exit(FatalError); << exit(FatalError);
} }
break; break;
} }
@ -131,8 +131,10 @@ kappa
mesh.lookupObject<phaseSystem>("phaseProperties") mesh.lookupObject<phaseSystem>("phaseProperties")
); );
auto tkappaEff = tmp<scalarField>::New(patch().size(), Zero); tmp<scalarField> kappaEff
auto& kappaEff = tkappaEff.ref(); (
new scalarField(patch().size(), 0.0)
);
forAll(fluid.phases(), phasei) forAll(fluid.phases(), phasei)
{ {
@ -140,10 +142,10 @@ kappa
const fvPatchScalarField& alpha = phase.boundaryField()[patchi]; const fvPatchScalarField& alpha = phase.boundaryField()[patchi];
kappaEff += alpha*phase.kappaEff(patchi)(); kappaEff.ref() += alpha*phase.kappaEff(patchi)();
} }
return tkappaEff; return kappaEff;
break; break;
} }
@ -159,11 +161,9 @@ kappa
} }
} }
// Return zero-sized (not nullptr) return scalarField(0);
return tmp<scalarField>::New();
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -243,12 +243,14 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
<< exit(FatalError); << exit(FatalError);
} }
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
this->readValueEntry(dict, IOobjectOption::MUST_READ); if (dict.found("refValue"))
if (this->readMixedEntries(dict))
{ {
// Full restart // Full restart
refValue() = scalarField("refValue", dict, p.size());
refGrad() = scalarField("refGradient", dict, p.size());
valueFraction() = scalarField("valueFraction", dict, p.size());
} }
else else
{ {
@ -292,7 +294,8 @@ updateCoeffs()
// Since we're inside initEvaluate/evaluate there might be processor // Since we're inside initEvaluate/evaluate there might be processor
// comms underway. Change the tag we use. // comms underway. Change the tag we use.
const int oldTag = UPstream::incrMsgType(); int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1;
// Get the coupling information from the mappedPatchBase // Get the coupling information from the mappedPatchBase
const label patchi = patch().index(); const label patchi = patch().index();
@ -305,11 +308,12 @@ updateCoeffs()
scalarField& Tp = *this; scalarField& Tp = *this;
const auto& nbrField = const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField&
refCast nbrField = refCast
< <const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField>
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField (
>(nbrPatch.lookupPatchField<volScalarField>(TnbrName_)); nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
);
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
scalarField TcNbr(nbrField.patchInternalField()); scalarField TcNbr(nbrField.patchInternalField());
@ -326,13 +330,13 @@ updateCoeffs()
scalarField qr(Tp.size(), 0.0); scalarField qr(Tp.size(), 0.0);
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().lookupPatchField<volScalarField>(qrName_); qr = patch().lookupPatchField<volScalarField, scalar>(qrName_);
} }
scalarField qrNbr(Tp.size(), 0.0); scalarField qrNbr(Tp.size(), 0.0);
if (qrNbrName_ != "none") if (qrNbrName_ != "none")
{ {
qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_); qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_);
mpp.distribute(qrNbr); mpp.distribute(qrNbr);
} }
@ -470,9 +474,10 @@ updateCoeffs()
<< regionTypeNames_ << nl << exit(FatalError); << regionTypeNames_ << nl << exit(FatalError);
} }
UPstream::msgType(oldTag); // Restore tag
mixedFvPatchScalarField::updateCoeffs(); mixedFvPatchScalarField::updateCoeffs();
// Restore tag
UPstream::msgType() = oldTag;
} }
@ -481,7 +486,7 @@ void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::write
Ostream& os Ostream& os
) const ) const
{ {
mixedFvPatchField<scalar>::write(os); mixedFvPatchScalarField::write(os);
os.writeEntry("kappaMethod", KMethodTypeNames_[method_]); os.writeEntry("kappaMethod", KMethodTypeNames_[method_]);
os.writeEntryIfDifferent<word>("kappa","none", kappaName_); os.writeEntryIfDifferent<word>("kappa","none", kappaName_);

View File

@ -221,7 +221,7 @@ forAll(fluidRegions, i)
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
dimensionedScalar(word::null, dimLength, Zero) dimensionedScalar("hRef", dimLength, Zero)
) )
); );

View File

@ -13,11 +13,11 @@ forAll(cumulativeContErrIO, i)
"cumulativeContErr", "cumulativeContErr",
runTime.timeName(), runTime.timeName(),
"uniform", "uniform",
mesh.thisDb(), mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
dimensionedScalar(word::null, dimless, Zero) dimensionedScalar(dimless, Zero)
) )
); );
} }

View File

@ -48,7 +48,7 @@ if (Y.size())
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
@ -56,6 +56,6 @@ if (Y.size())
if (Y.size()) if (Y.size())
{ {
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }
} }

View File

@ -112,7 +112,7 @@ forAll(fluidRegions, i)
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
dimensionedScalar(word::null, dimLength, Zero) dimensionedScalar("hRef", dimLength, Zero) // uses name
) )
); );

View File

@ -13,11 +13,11 @@ forAll(cumulativeContErrIO, i)
"cumulativeContErr", "cumulativeContErr",
runTime.timeName(), runTime.timeName(),
"uniform", "uniform",
mesh.thisDb(), mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
dimensionedScalar(word::null, dimless, Zero) dimensionedScalar(dimless, Zero)
) )
); );
} }

View File

@ -49,11 +49,11 @@ if (adjustTimeStep)
( (
min min
( (
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(), min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(),
min(runTime.deltaTValue(), maxDeltaT) min(runTime.deltaTValue(), maxDeltaT)
) )
); );
Info<< "deltaT = " << runTime.deltaTValue() << endl; Info<< "deltaT = " << runTime.deltaT().value() << endl;
} }
} }

View File

@ -59,12 +59,12 @@ if (adjustTimeStep)
( (
min min
( (
min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(), min(deltaTFluid, maxDeltaTSolid)*runTime.deltaT().value(),
maxDeltaT maxDeltaT
) )
); );
Info<< "deltaT = " << runTime.deltaTValue() << endl; Info<< "deltaT = " << runTime.deltaT().value() << endl;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -57,7 +57,7 @@
), ),
solidRegions[i], solidRegions[i],
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero), dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchSymmTensorField::typeName
) )
); );

View File

@ -34,7 +34,7 @@ if (!thermo.isotropic())
), ),
mesh, mesh,
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero), dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchSymmTensorField::typeName
) )
); );
volSymmTensorField& aniAlpha = *taniAlpha; volSymmTensorField& aniAlpha = *taniAlpha;

View File

@ -44,7 +44,7 @@ IOobject turbulencePropertiesHeader
mesh, mesh,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
); );
if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(false)) if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(false))

View File

@ -89,10 +89,17 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
return; return;
} }
const auto& phip = patch().lookupPatchField<surfaceScalarField>("phi"); const fvsPatchField<scalar>& phip =
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia"); patch().lookupPatchField<surfaceScalarField, scalar>("phi");
const auto& Up = patch().lookupPatchField<volVectorField>("U");
const auto& Uap = patch().lookupPatchField<volVectorField>("Ua"); const fvsPatchField<scalar>& phiap =
patch().lookupPatchField<surfaceScalarField, scalar>("phia");
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
const fvPatchField<vector>& Uap =
patch().lookupPatchField<volVectorField, vector>("Ua");
operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap)); operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));
@ -102,8 +109,8 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -90,8 +90,11 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia"); const fvsPatchField<scalar>& phiap =
const auto& Up = patch().lookupPatchField<volVectorField>("U"); patch().lookupPatchField<surfaceScalarField, scalar>("phia");
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField Un(mag(patch().nf() & Up)); scalarField Un(mag(patch().nf() & Up));
vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL)); vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL));
@ -107,8 +110,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
void Foam::adjointOutletVelocityFvPatchVectorField::write(Ostream& os) const void Foam::adjointOutletVelocityFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchVectorField::write(os);
fvPatchField<vector>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -24,7 +24,7 @@ if (mesh.changing())
wordList pcorrTypes wordList pcorrTypes
( (
p.boundaryField().size(), p.boundaryField().size(),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
// Set BCs of pcorr to fixed-value for patches at which p is fixed // Set BCs of pcorr to fixed-value for patches at which p is fixed
@ -94,7 +94,7 @@ if (mesh.changing())
{ {
if (refCells[zoneId] != -1) if (refCells[zoneId] != -1)
{ {
validCells.push_back(refCells[zoneId]); validCells.append(refCells[zoneId]);
} }
} }

View File

@ -130,7 +130,7 @@ int main(int argc, char *argv[])
), ),
mesh, mesh,
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero), dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchVectorField::typeName
); );
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V(); cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();

View File

@ -111,7 +111,7 @@ int main(int argc, char *argv[])
), ),
mesh, mesh,
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero), dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchVectorField::typeName
); );
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V(); cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();

View File

@ -40,11 +40,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -41,11 +41,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -9,7 +9,7 @@ IOobject io
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
); );
if (io.typeHeaderOk<IOdictionary>()) if (io.typeHeaderOk<IOdictionary>())
@ -32,4 +32,4 @@ if (io.typeHeaderOk<IOdictionary>())
); );
} }
// ************************************************************************* //

View File

@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -39,11 +39,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
fvOptions.correct(Yi); fvOptions.correct(Yi);
Yi.clamp_min(0); Yi.max(0.0);
Yt += Yi; Yt += Yi;
} }
} }
Y[inertIndex] = scalar(1) - Yt; Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].clamp_min(0); Y[inertIndex].max(0.0);
} }

View File

@ -141,7 +141,7 @@ int main(int argc, char *argv[])
), ),
mesh, mesh,
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero), dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchVectorField::typeName
); );
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V(); cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();

View File

@ -64,7 +64,8 @@ volScalarField mu
mesh, mesh,
IOobject::READ_IF_PRESENT IOobject::READ_IF_PRESENT
), ),
mixture.mu() mixture.mu(),
calculatedFvPatchScalarField::typeName
); );
@ -138,7 +139,7 @@ volScalarField alphac
), ),
mesh, mesh,
dimensionedScalar(dimless, Zero), dimensionedScalar(dimless, Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
alphac.oldTime(); alphac.oldTime();

View File

@ -1,5 +1,14 @@
{ {
alphav = clamp((rho - rholSat)/(rhovSat - rholSat), zero_one{}); alphav =
max
(
min
(
(rho - rholSat)/(rhovSat - rholSat),
scalar(1)
),
scalar(0)
);
alphal = 1.0 - alphav; alphal = 1.0 - alphav;
Info<< "max-min alphav: " << max(alphav).value() Info<< "max-min alphav: " << max(alphav).value()

View File

@ -1,7 +1,7 @@
wordList pcorrTypes wordList pcorrTypes
( (
p.boundaryField().size(), p.boundaryField().size(),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
for (label i=0; i<p.boundaryField().size(); i++) for (label i=0; i<p.boundaryField().size(); i++)

View File

@ -86,7 +86,6 @@ VoFPatchTransfer::VoFPatchTransfer
wordRes patchNames; wordRes patchNames;
if (coeffDict_.readIfPresent("patches", patchNames)) if (coeffDict_.readIfPresent("patches", patchNames))
{ {
// Can also use pbm.indices(), but no warnings...
patchIDs_ = pbm.patchSet(patchNames).sortedToc(); patchIDs_ = pbm.patchSet(patchNames).sortedToc();
Info<< " applying to " << patchIDs_.size() << " patches:" << nl; Info<< " applying to " << patchIDs_.size() << " patches:" << nl;

View File

@ -140,7 +140,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
), ),
mesh, mesh,
dimensionedScalar(dimless, Zero), dimensionedScalar(dimless, Zero),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
), ),
curTimeIndex_(-1) curTimeIndex_(-1)
{ {

View File

@ -84,7 +84,7 @@ Foam::surfaceTensionModels::liquidProperties::sigma() const
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh_, mesh_,
dimSigma dimSigma

View File

@ -126,9 +126,9 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeEntry("thetaProperties", thetaProps_); os.writeEntry("thetaProperties", thetaProps_);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -779,7 +779,7 @@ Foam::multiphaseMixtureThermo::surfaceTensionForce() const
auto sigma = sigmas_.cfind(interfacePair(alpha1, alpha2)); auto sigma = sigmas_.cfind(interfacePair(alpha1, alpha2));
if (!sigma.good()) if (!sigma.found())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find interface " << interfacePair(alpha1, alpha2) << "Cannot find interface " << interfacePair(alpha1, alpha2)
@ -907,7 +907,7 @@ void Foam::multiphaseMixtureThermo::correctContactAngle
const auto tp = const auto tp =
acap.thetaProps().cfind(interfacePair(alpha1, alpha2)); acap.thetaProps().cfind(interfacePair(alpha1, alpha2));
if (!tp.good()) if (!tp.found())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find interface " << interfacePair(alpha1, alpha2) << "Cannot find interface " << interfacePair(alpha1, alpha2)
@ -1075,7 +1075,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
MULES::limit MULES::limit
( (
1.0/mesh_.time().deltaTValue(), 1.0/mesh_.time().deltaT().value(),
geometricOneField(), geometricOneField(),
alpha, alpha,
phi_, phi_,

View File

@ -105,7 +105,8 @@ incompressibleTwoPhaseInteractingMixture
U_.db() U_.db()
), ),
U_.mesh(), U_.mesh(),
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero) dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero),
calculatedFvPatchScalarField::typeName
) )
{ {
correct(); correct();

View File

@ -48,7 +48,7 @@ Foam::wordList Foam::relativeVelocityModel::UdmPatchFieldTypes() const
wordList UdmTypes wordList UdmTypes
( (
U.boundaryField().size(), U.boundaryField().size(),
fvPatchFieldBase::calculatedType() calculatedFvPatchScalarField::typeName
); );
forAll(U.boundaryField(), i) forAll(U.boundaryField(), i)

View File

@ -699,7 +699,7 @@ void Foam::radiation::laserDTRM::calculate()
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V()); scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
Info << "Total energy absorbed [W]: " << totalQ << endl; Info << "Total energy absorbed [W]: " << totalQ << endl;
if (mesh_.time().writeTime()) if (mesh_.time().outputTime())
{ {
reflectingCellsVol.write(); reflectingCellsVol.write();
nHat.write(); nHat.write();
@ -724,7 +724,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::laserDTRM::Rp() const
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh_, mesh_,
dimensionedScalar(dimPower/dimVolume/pow4(dimTemperature), Zero) dimensionedScalar(dimPower/dimVolume/pow4(dimTemperature), Zero)

View File

@ -52,9 +52,7 @@ namespace Foam
const Foam::volScalarField& const Foam::volScalarField&
Foam::radiation::localDensityAbsorptionEmission::alpha(word alphaName) const Foam::radiation::localDensityAbsorptionEmission::alpha(word alphaName) const
{ {
const volScalarField* ptr = mesh_.cfindObject<volScalarField>(alphaName); if (!mesh_.foundObject<volScalarField>(alphaName))
if (!ptr)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unable to retrieve density field " << alphaName << " from " << "Unable to retrieve density field " << alphaName << " from "
@ -62,7 +60,7 @@ Foam::radiation::localDensityAbsorptionEmission::alpha(word alphaName) const
<< exit(FatalError); << exit(FatalError);
} }
return *ptr; return mesh_.lookupObject<volScalarField>(alphaName);
} }
@ -99,7 +97,7 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh_, mesh_,
dimensionedScalar(inv(dimLength), Zero) dimensionedScalar(inv(dimLength), Zero)
@ -132,7 +130,7 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh_, mesh_,
dimensionedScalar(inv(dimLength), Zero) dimensionedScalar(inv(dimLength), Zero)
@ -165,7 +163,7 @@ Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh_, mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero) dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)

View File

@ -99,6 +99,17 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
Foam::Pair<Foam::tmp<Foam::volScalarField>> Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
{ {
volScalarField limitedAlpha1
(
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
);
volScalarField limitedAlpha2
(
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
);
const volScalarField& T = mesh_.lookupObject<volScalarField>("T"); const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
const twoPhaseMixtureEThermo& thermo = const twoPhaseMixtureEThermo& thermo =
@ -113,18 +124,14 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
volScalarField mDotE volScalarField mDotE
( (
"mDotE", "mDotE", coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0)
coeffE_*mixture_.rho1()*clamp(mixture_.alpha1(), zero_one{})
* max(T - TSat, T0)
); );
volScalarField mDotC volScalarField mDotC
( (
"mDotC", "mDotC", coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0)
coeffC_*mixture_.rho2()*clamp(mixture_.alpha2(), zero_one{})
* max(TSat - T, T0)
); );
if (mesh_.time().writeTime()) if (mesh_.time().outputTime())
{ {
mDotC.write(); mDotC.write();
mDotE.write(); mDotE.write();
@ -141,6 +148,16 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
Foam::Pair<Foam::tmp<Foam::volScalarField>> Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
{ {
volScalarField limitedAlpha1
(
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
);
volScalarField limitedAlpha2
(
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
);
const volScalarField& T = mesh_.lookupObject<volScalarField>("T"); const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
const twoPhaseMixtureEThermo& thermo = const twoPhaseMixtureEThermo& thermo =
@ -153,14 +170,8 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
( coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T),
coeffC_*mixture_.rho2()*clamp(mixture_.alpha2(), zero_one{}) coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat)
* pos(TSat - T)
),
(
coeffE_*mixture_.rho1()*clamp(mixture_.alpha1(), zero_one{})
* pos(T - TSat)
)
); );
} }
@ -190,17 +201,25 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::TSource() const
const dimensionedScalar& TSat = thermo.TSat(); const dimensionedScalar& TSat = thermo.TSat();
const dimensionedScalar L = mixture_.Hf2() - mixture_.Hf1(); dimensionedScalar L = mixture_.Hf2() - mixture_.Hf1();
volScalarField limitedAlpha1
(
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
);
volScalarField limitedAlpha2
(
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
);
const volScalarField Vcoeff const volScalarField Vcoeff
( (
coeffE_*mixture_.rho1()*clamp(mixture_.alpha1(), zero_one{}) coeffE_*mixture_.rho1()*limitedAlpha1*L*pos(T - TSat)
* L*pos(T - TSat)
); );
const volScalarField Ccoeff const volScalarField Ccoeff
( (
coeffC_*mixture_.rho2()*clamp(mixture_.alpha2(), zero_one{}) coeffC_*mixture_.rho2()*limitedAlpha2*L*pos(TSat - T)
* L*pos(TSat - T)
); );
TSource = TSource =

View File

@ -167,10 +167,20 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::temperaturePhaseChangeTwoPhaseMixtures::interfaceHeatResistance:: Foam::temperaturePhaseChangeTwoPhaseMixtures::interfaceHeatResistance::
mDotAlphal() const mDotAlphal() const
{ {
volScalarField limitedAlpha1
(
min(max(mixture_.alpha1(), scalar(0)), scalar(1))
);
volScalarField limitedAlpha2
(
min(max(mixture_.alpha2(), scalar(0)), scalar(1))
);
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
(mDotc_/clamp(mixture_.alpha2(), scalarMinMax(SMALL, 1))), (mDotc_/(limitedAlpha2 + SMALL)),
-(mDote_/clamp(mixture_.alpha1(), scalarMinMax(SMALL, 1))) -(mDote_/(limitedAlpha1 + SMALL))
); );
} }

View File

@ -46,7 +46,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false // Do not register
) )
); );

View File

@ -155,7 +155,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cp() const
{ {
const volScalarField limitedAlpha1 const volScalarField limitedAlpha1
( (
clamp(alpha1_, zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
return tmp<volScalarField> return tmp<volScalarField>
@ -176,11 +176,13 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cp
const label patchi const label patchi
) const ) const
{ {
const scalarField alpha1p const volScalarField limitedAlpha1
( (
clamp(alpha1_.boundaryField()[patchi], zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return return
( (
alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value() alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value()
@ -192,7 +194,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::rho() const
{ {
const volScalarField limitedAlpha1 const volScalarField limitedAlpha1
( (
clamp(alpha1_, zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
return tmp<volScalarField> return tmp<volScalarField>
@ -212,11 +214,13 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::rho
const label patchi const label patchi
) const ) const
{ {
const scalarField alpha1p const volScalarField limitedAlpha1
( (
clamp(alpha1_.boundaryField()[patchi], zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return return
( (
alpha1p*rho1().value() + (scalar(1) - alpha1p)*rho2().value() alpha1p*rho1().value() + (scalar(1) - alpha1p)*rho2().value()
@ -228,7 +232,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cv() const
{ {
const volScalarField limitedAlpha1 const volScalarField limitedAlpha1
( (
clamp(alpha1_, zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
return tmp<volScalarField> return tmp<volScalarField>
@ -249,11 +253,13 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cv
const label patchi const label patchi
) const ) const
{ {
const scalarField alpha1p const volScalarField limitedAlpha1
( (
clamp(alpha1_.boundaryField()[patchi], zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return return
( (
alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value() alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value()
@ -333,7 +339,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappa() const
{ {
const volScalarField limitedAlpha1 const volScalarField limitedAlpha1
( (
clamp(alpha1_, zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
return tmp<volScalarField> return tmp<volScalarField>
@ -352,11 +358,13 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::kappa
const label patchi const label patchi
) const ) const
{ {
const scalarField alpha1p const volScalarField limitedAlpha1
( (
clamp(alpha1_.boundaryField()[patchi], zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()); return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value());
} }
@ -394,11 +402,13 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::kappaEff
const label patchi const label patchi
) const ) const
{ {
const scalarField alpha1p const volScalarField limitedAlpha1
( (
clamp(alpha1_.boundaryField()[patchi], zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
return return
(alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat; (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat;
@ -425,11 +435,13 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::alphaEff
const label patchi const label patchi
) const ) const
{ {
const scalarField alpha1p const volScalarField limitedAlpha1
( (
clamp(alpha1_.boundaryField()[patchi], zero_one{}) min(max(alpha1_, scalar(0)), scalar(1))
); );
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
const scalarField rho const scalarField rho
( (
alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value() alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value()

View File

@ -30,7 +30,7 @@
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
mesh, mesh,
dimless, dimless,
@ -96,7 +96,7 @@
MULES::limiter MULES::limiter
( (
allLambda, allLambda,
1.0/runTime.deltaTValue(), 1.0/runTime.deltaT().value(),
geometricOneField(), geometricOneField(),
alpha1, alpha1,
alphaPhi1BD, alphaPhi1BD,
@ -164,7 +164,7 @@
MULES::limiter MULES::limiter
( (
allLambda, allLambda,
1.0/runTime.deltaTValue(), 1.0/runTime.deltaT().value(),
geometricOneField(), geometricOneField(),
alpha2, alpha2,
alphaPhi2BD, alphaPhi2BD,

View File

@ -119,7 +119,8 @@ Foam::incompressibleThreePhaseMixture::incompressibleThreePhaseMixture
U.db() U.db()
), ),
U.mesh(), U.mesh(),
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero) dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero),
calculatedFvPatchScalarField::typeName
), ),
nuModel1_ nuModel1_

View File

@ -27,7 +27,7 @@
wordList pcorrTypes wordList pcorrTypes
( (
p_rgh.boundaryField().size(), p_rgh.boundaryField().size(),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
for (label i=0; i<p_rgh.boundaryField().size(); i++) for (label i=0; i<p_rgh.boundaryField().size(); i++)
@ -103,7 +103,7 @@
{ {
if (refCells[zoneId] != -1) if (refCells[zoneId] != -1)
{ {
validCells.push_back(refCells[zoneId]); validCells.append(refCells[zoneId]);
} }
} }

View File

@ -70,7 +70,7 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
{ {
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{})); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
@ -85,7 +85,7 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
{ {
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{})); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (

View File

@ -82,7 +82,7 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
{ {
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{})); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (

View File

@ -99,7 +99,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
const volScalarField& p const volScalarField& p
) const ) const
{ {
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{})); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField rho volScalarField rho
( (
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2() limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
@ -117,7 +117,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField pCoeff(this->pCoeff(p)); volScalarField pCoeff(this->pCoeff(p));
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{})); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>
( (
@ -134,7 +134,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
volScalarField pCoeff(this->pCoeff(p)); volScalarField pCoeff(this->pCoeff(p));
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{})); volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField apCoeff(limitedAlpha1*pCoeff); volScalarField apCoeff(limitedAlpha1*pCoeff);
return Pair<tmp<volScalarField>> return Pair<tmp<volScalarField>>

View File

@ -48,7 +48,7 @@ Foam::phaseChangeTwoPhaseMixture::New
U.db(), U.db(),
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false // Do not register
) )
); );

View File

@ -37,7 +37,7 @@ surfaceScalarField phi
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar(dimVelocity*dimArea, Zero) dimensionedScalar(dimArea*dimVelocity, Zero)
); );
multiphaseSystem fluid(U, phi); multiphaseSystem fluid(U, phi);

View File

@ -53,7 +53,7 @@
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar(dimVelocity*dimArea, Zero) dimensionedScalar(dimArea*dimVelocity, Zero)
); );
volScalarField rho("rho", fluid.rho()); volScalarField rho("rho", fluid.rho());
@ -76,7 +76,7 @@
mesh mesh
), ),
fluid.dragCoeff(phase, dragCoeffs())/phase.rho(), fluid.dragCoeff(phase, dragCoeffs())/phase.rho(),
fvPatchFieldBase::zeroGradientType() zeroGradientFvPatchScalarField::typeName
); );
dragCoeffi.correctBoundaryConditions(); dragCoeffi.correctBoundaryConditions();

View File

@ -126,9 +126,9 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchScalarField::write(os);
os.writeEntry("thetaProperties", thetaProps_); os.writeEntry("thetaProperties", thetaProps_);
fvPatchField<scalar>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -287,7 +287,7 @@ Foam::multiphaseMixture::surfaceTensionForce() const
auto sigma = sigmas_.cfind(interfacePair(alpha1, alpha2)); auto sigma = sigmas_.cfind(interfacePair(alpha1, alpha2));
if (!sigma.good()) if (!sigma.found())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find interface " << interfacePair(alpha1, alpha2) << "Cannot find interface " << interfacePair(alpha1, alpha2)
@ -463,7 +463,7 @@ void Foam::multiphaseMixture::correctBoundaryContactAngle
const auto tp = acap.thetaProps().cfind(interfacePair(alpha1, alpha2)); const auto tp = acap.thetaProps().cfind(interfacePair(alpha1, alpha2));
if (!tp.good()) if (!tp.found())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Cannot find interface " << interfacePair(alpha1, alpha2) << "Cannot find interface " << interfacePair(alpha1, alpha2)
@ -628,7 +628,7 @@ void Foam::multiphaseMixture::solveAlphas
MULES::limit MULES::limit
( (
1.0/mesh_.time().deltaTValue(), 1.0/mesh_.time().deltaT().value(),
geometricOneField(), geometricOneField(),
alpha, alpha,
phi_, phi_,

View File

@ -180,7 +180,7 @@ while (pimple.correct())
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar(dimVelocity*dimArea, Zero) dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0)
); );
forAll(phases, phasei) forAll(phases, phasei)

View File

@ -165,7 +165,7 @@ while (pimple.correct())
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
dimensionedScalar(dimVelocity*dimArea, Zero) dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0)
); );
forAll(phases, phasei) forAll(phases, phasei)

View File

@ -20,7 +20,7 @@
IOobject rhoIO IOobject rhoIO
( (
"rho", "rho",
Time::timeName(0), runTime.timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -75,7 +75,7 @@
IOobject EHeader IOobject EHeader
( (
"E", "E",
Time::timeName(0), runTime.timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -127,7 +127,7 @@
IOobject nuIO IOobject nuIO
( (
"nu", "nu",
Time::timeName(0), runTime.timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -51,7 +51,7 @@ if (thermalStress)
IOobject CIO IOobject CIO
( (
"C", "C",
Time::timeName(0), runTime.timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -106,7 +106,7 @@ if (thermalStress)
IOobject rhoKIO IOobject rhoKIO
( (
"k", "k",
Time::timeName(0), runTime.timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -161,7 +161,7 @@ if (thermalStress)
IOobject alphaIO IOobject alphaIO
( (
"alpha", "alpha",
Time::timeName(0), runTime.timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -47,7 +47,7 @@ tractionDisplacementFvPatchVectorField
traction_(p.size(), Zero), traction_(p.size(), Zero),
pressure_(p.size(), Zero) pressure_(p.size(), Zero)
{ {
extrapolateInternal(); fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero; gradient() = Zero;
} }
@ -79,7 +79,7 @@ tractionDisplacementFvPatchVectorField
traction_("traction", dict, p.size()), traction_("traction", dict, p.size()),
pressure_("pressure", dict, p.size()) pressure_("pressure", dict, p.size())
{ {
extrapolateInternal(); fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero; gradient() = Zero;
} }
@ -152,9 +152,14 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
db().lookupObject<IOdictionary>("thermalProperties"); db().lookupObject<IOdictionary>("thermalProperties");
const auto& rho = patch().lookupPatchField<volScalarField>("rho"); const fvPatchField<scalar>& rho =
const auto& rhoE = patch().lookupPatchField<volScalarField>("E"); patch().lookupPatchField<volScalarField, scalar>("rho");
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
const fvPatchField<scalar>& rhoE =
patch().lookupPatchField<volScalarField, scalar>("E");
const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E(rhoE/rho); scalarField E(rhoE/rho);
scalarField mu(E/(2.0*(1.0 + nu))); scalarField mu(E/(2.0*(1.0 + nu)));
@ -171,7 +176,8 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
vectorField n(patch().nf()); vectorField n(patch().nf());
const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD"); const fvPatchField<symmTensor>& sigmaD =
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
gradient() = gradient() =
( (
@ -181,10 +187,11 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
if (thermalProperties.get<bool>("thermalStress")) if (thermalProperties.get<bool>("thermalStress"))
{ {
const auto& threeKalpha = const fvPatchField<scalar>& threeKalpha=
patch().lookupPatchField<volScalarField>("threeKalpha"); patch().lookupPatchField<volScalarField, scalar>("threeKalpha");
const auto& T = patch().lookupPatchField<volScalarField>("T"); const fvPatchField<scalar>& T =
patch().lookupPatchField<volScalarField, scalar>("T");
gradient() += n*threeKalpha*T/twoMuLambda; gradient() += n*threeKalpha*T/twoMuLambda;
} }
@ -195,10 +202,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
void tractionDisplacementFvPatchVectorField::write(Ostream& os) const void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchVectorField::write(os);
traction_.writeEntry("traction", os); traction_.writeEntry("traction", os);
pressure_.writeEntry("pressure", os); pressure_.writeEntry("pressure", os);
fvPatchField<vector>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -47,7 +47,7 @@ tractionDisplacementCorrectionFvPatchVectorField
traction_(p.size(), Zero), traction_(p.size(), Zero),
pressure_(p.size(), Zero) pressure_(p.size(), Zero)
{ {
extrapolateInternal(); fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero; gradient() = Zero;
} }
@ -79,7 +79,7 @@ tractionDisplacementCorrectionFvPatchVectorField
traction_("traction", dict, p.size()), traction_("traction", dict, p.size()),
pressure_("pressure", dict, p.size()) pressure_("pressure", dict, p.size())
{ {
extrapolateInternal(); fvPatchVectorField::operator=(patchInternalField());
gradient() = Zero; gradient() = Zero;
} }
@ -152,9 +152,14 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
"mechanicalProperties" "mechanicalProperties"
); );
const auto& rho = patch().lookupPatchField<volScalarField>("rho"); const fvPatchField<scalar>& rho =
const auto& rhoE = patch().lookupPatchField<volScalarField>("E"); patch().lookupPatchField<volScalarField, scalar>("rho");
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
const fvPatchField<scalar>& rhoE =
patch().lookupPatchField<volScalarField, scalar>("E");
const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E(rhoE/rho); scalarField E(rhoE/rho);
scalarField mu(E/(2.0*(1.0 + nu))); scalarField mu(E/(2.0*(1.0 + nu)));
@ -167,8 +172,11 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
vectorField n(patch().nf()); vectorField n(patch().nf());
const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD"); const fvPatchField<symmTensor>& sigmaD =
const auto& sigmaExp = patch().lookupPatchField<volTensorField>("sigmaExp"); patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
const fvPatchField<tensor>& sigmaExp =
patch().lookupPatchField<volTensorField, tensor>("sigmaExp");
gradient() = gradient() =
( (
@ -182,10 +190,10 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
// Write // Write
void tractionDisplacementCorrectionFvPatchVectorField::write(Ostream& os) const void tractionDisplacementCorrectionFvPatchVectorField::write(Ostream& os) const
{ {
fvPatchField<vector>::write(os); fvPatchVectorField::write(os);
traction_.writeEntry("traction", os); traction_.writeEntry("traction", os);
pressure_.writeEntry("pressure", os); pressure_.writeEntry("pressure", os);
fvPatchField<vector>::writeValueEntry(os); writeEntry("value", os);
} }

View File

@ -27,14 +27,6 @@ License
#include "dummyLib.H" #include "dummyLib.H"
#include <iostream> #include <iostream>
// Include MPI without any C++ bindings
#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX
#endif
#ifndef OMPI_SKIP_MPICXX
#define OMPI_SKIP_MPICXX
#endif
#include <mpi.h> #include <mpi.h>
// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //

View File

@ -92,10 +92,7 @@ int main(int argc, char *argv[])
} }
report(buf1); report(buf1);
buf1.push_back(identity(5)); buf1.push_back(identity(5)); report(buf1);
buf1.emplace_front(-1000);
buf1.emplace_back(1000);
report(buf1);
buf1.info(Info); buf1.info(Info);
Info<< buf1 << nl; Info<< buf1 << nl;

View File

@ -69,7 +69,7 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
size size
); );
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
) )
); );
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
), ),
size size
); );
@ -157,7 +157,7 @@ int main(int argc, char *argv[])
runTime, runTime,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
IOobject::NO_REGISTER false
) )
); );

View File

@ -55,7 +55,10 @@ public:
i_(i) i_(i)
{} {}
const word& keyword() const noexcept { return keyword_; } const word& keyword() const
{
return keyword_;
}
friend Ostream& operator<<(Ostream& os, const ent& e) friend Ostream& operator<<(Ostream& os, const ent& e)
{ {
@ -71,27 +74,28 @@ class Scalar
public: public:
static bool verbose; Scalar()
:
data_(0)
{}
constexpr Scalar() noexcept : data_(0) {} Scalar(scalar val)
Scalar(scalar val) noexcept : data_(val) {} :
data_(val)
{}
~Scalar() ~Scalar()
{ {
if (verbose) Info<< "delete Scalar: " << data_ << endl; Info<<"delete Scalar: " << data_ << endl;
} }
scalar value() const noexcept { return data_; } friend Ostream& operator<<(Ostream& os, const Scalar& val)
scalar& value() noexcept { return data_; }
friend Ostream& operator<<(Ostream& os, const Scalar& item)
{ {
os << item.value(); os << val.data_;
return os; return os;
} }
}; };
bool Scalar::verbose = true;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -113,7 +117,7 @@ int main(int argc, char *argv[])
dict.swapDown(dict.first()); dict.swapDown(dict.first());
forAllConstIters(dict, iter) forAllConstIter(Dictionary<ent>, dict, iter)
{ {
Info<< "element : " << *iter; Info<< "element : " << *iter;
} }
@ -153,9 +157,9 @@ int main(int argc, char *argv[])
} }
Info<< nl << "scalarDict1: " << endl; Info<< nl << "scalarDict1: " << endl;
forAllConstIters(scalarDict, iter) forAllConstIter(PtrDictionary<Scalar>, scalarDict, iter)
{ {
Info<< " = " << *iter << endl; Info<< " = " << iter() << endl;
} }
PtrDictionary<Scalar> scalarDict2; PtrDictionary<Scalar> scalarDict2;
@ -165,7 +169,7 @@ int main(int argc, char *argv[])
scalarDict2.insert(key, new Scalar(1.3*i)); scalarDict2.insert(key, new Scalar(1.3*i));
} }
Info<< nl << "scalarDict2: " << endl; Info<< nl << "scalarDict2: " << endl;
forAllConstIters(scalarDict2, iter) forAllConstIter(PtrDictionary<Scalar>, scalarDict2, iter)
{ {
std::cout<< "iter: " << typeid(*iter).name() << '\n'; std::cout<< "iter: " << typeid(*iter).name() << '\n';

View File

@ -85,7 +85,7 @@ Description
fileNameList procDirs fileNameList procDirs
( (
DirLister::dirs(".").csorted<fileName>(matchProcs) DirLister::dirs(".").sorted<fileName>(matchProcs)
); );
} }
\endcode \endcode
@ -206,11 +206,11 @@ public:
//- Return a complete list of names, sorted in natural order //- Return a complete list of names, sorted in natural order
template<class StringType=Foam::word> template<class StringType=Foam::word>
List<StringType> csorted() const; List<StringType> sorted() const;
//- Return complete list of names, sorted in natural order //- Return complete list of names, sorted in natural order
template<class StringType=Foam::word, class UnaryPredicate> template<class StringType=Foam::word, class UnaryPredicate>
List<StringType> csorted List<StringType> sorted
( (
const UnaryPredicate& pred, const UnaryPredicate& pred,
const bool prune = false const bool prune = false

View File

@ -70,23 +70,23 @@ Foam::List<StringType> Foam::DirLister::list() const
template<class StringType, class UnaryPredicate> template<class StringType, class UnaryPredicate>
Foam::List<StringType> Foam::DirLister::csorted Foam::List<StringType> Foam::DirLister::sorted
( (
const UnaryPredicate& pred, const UnaryPredicate& pred,
const bool prune const bool prune
) const ) const
{ {
List<StringType> list(list<StringType>(pred, prune)); List<StringType> lst(list<StringType>(pred, prune));
Foam::sort(list, stringOps::natural_sort()); sort(lst, stringOps::natural_sort());
return list; return lst;
} }
template<class StringType> template<class StringType>
Foam::List<StringType> Foam::DirLister::csorted() const Foam::List<StringType> Foam::DirLister::sorted() const
{ {
return csorted<StringType>(predicates::always()); return sorted<StringType>(predicates::always());
} }

View File

@ -162,7 +162,7 @@ int main(int argc, char *argv[])
Info<< "dirList: " Info<< "dirList: "
<< flatOutput << flatOutput
( (
DirLister::dirs(".").csorted<fileName>(relist) DirLister::dirs(".").sorted<fileName>(relist)
) << nl; ) << nl;
} }

View File

@ -6,7 +6,6 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,29 +52,28 @@ int main(int argc, char *argv[])
Info << "testField:" << testField << endl; Info << "testField:" << testField << endl;
testField.emplace_back(0.5, 4.8, 6.2); testField.append(vector(0.5, 4.8, 6.2));
Info << "testField after appending:" << testField << endl; Info << "testField after appending:" << testField << endl;
testField.emplace_back(2.7, 2.3, 6.1); testField.append(vector(2.7, 2.3, 6.1));
Info << "testField after appending:" << testField << endl; Info << "testField after appending:" << testField << endl;
vector elem = testField.back(); vector elem = testField.remove();
testField.pop_back();
Info << "removed element:" << elem << endl; Info << "removed element:" << elem << endl;
Info << "testField:" << testField << endl; Info << "testField:" << testField << endl;
testField.emplace_back(3.0, 1.3, 9.2); testField.append(vector(3.0, 1.3, 9.2));
Info << "testField:" << testField << endl; Info << "testField:" << testField << endl;
testField.resize(10, vector(1.5, 0.6, -1.0)); testField.setSize(10, vector(1.5, 0.6, -1.0));
Info << "testField after setSize:" << testField << endl; Info << "testField after setSize:" << testField << endl;
testField.push_back(testField2); testField.append(testField2);
Info << "testField after appending testField2:" << testField << endl; Info << "testField after appending testField2:" << testField << endl;
@ -89,7 +87,7 @@ int main(int argc, char *argv[])
testField.clear(); testField.clear();
testField.emplace_back(3.0, 1.3, 9.2); testField.append(vector(3.0, 1.3, 9.2));
Info << "testField after clear and append:" << testField << endl; Info << "testField after clear and append:" << testField << endl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd. Copyright (C) 2017-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
{ {
0, 1, 2, 3, 4 0, 1, 2, 3, 4
}; };
dlA.push_back({ 5, 6 }); dlA.append({ 5, 6 });
dlA = { 1, 2, 4 }; dlA = { 1, 2, 4 };
DynamicList<label> dlB; DynamicList<label> dlB;
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
// Copy back and append a few time // Copy back and append a few time
for (label i=0; i < 3; i++) for (label i=0; i < 3; i++)
{ {
dlB.push_back(lstA); dlB.append(lstA);
} }
Info<< "appended list a few times" << endl; Info<< "appended list a few times" << endl;
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
// Copy back and append a few time // Copy back and append a few time
for (label i=0; i < 3; i++) for (label i=0; i < 3; i++)
{ {
dlB.push_back(lstA); dlB.append(lstA);
} }
@ -220,8 +220,8 @@ int main(int argc, char *argv[])
for (label elemI=0; elemI < 5; ++elemI) for (label elemI=0; elemI < 5; ++elemI)
{ {
dlE1.push_back(4 - elemI); dlE1.append(4 - elemI);
dlE2.push_back(elemI); dlE2.append(elemI);
} }
printInfo("dlE2", dlE2, true); printInfo("dlE2", dlE2, true);
@ -243,12 +243,9 @@ int main(int argc, char *argv[])
{ {
DynamicList<label> addr(10); DynamicList<label> addr(10);
addr.emplace_back(3); addr.append(3);
addr.emplace_back(1); addr.append(1);
addr.emplace_back(2); addr.append(2);
// Can also use the return value
Info<< "adding " << addr.emplace_back(4) << endl;
forAll(dlE2, i) forAll(dlE2, i)
{ {
@ -300,9 +297,9 @@ int main(int argc, char *argv[])
Info<< "test move-append with " Info<< "test move-append with "
<< flatOutput(input1) << " and " << flatOutput(input2) << endl; << flatOutput(input1) << " and " << flatOutput(input2) << endl;
list2.push_back(std::move(list1)); list2.append(std::move(list1));
list2.push_back(std::move(input1)); list2.append(std::move(input1));
list2.push_back(std::move(input2)); list2.append(std::move(input2));
Info<< "result: " << flatOutput(list2) << nl Info<< "result: " << flatOutput(list2) << nl
<< "inputs: " << flatOutput(list1) << " / " << "inputs: " << flatOutput(list1) << " / "

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2023 OpenCFD Ltd. Copyright (C) 2019-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -112,20 +112,13 @@ int main(int argc, char *argv[])
argList::addBoolOption("iter"); argList::addBoolOption("iter");
argList::addBoolOption("swap"); argList::addBoolOption("swap");
argList::addBoolOption("default", "reinstate default tests"); argList::addBoolOption("default", "reinstate default tests");
argList::addBoolOption("no-wait", "test with skipping request waits");
argList::addNote("runs default tests or specified ones only"); argList::addNote("runs default tests or specified ones only");
#include "setRootCase.H" #include "setRootCase.H"
const bool optNowaiting = args.found("no-wait");
// Run default tests, unless only specific tests are requested // Run default tests, unless only specific tests are requested
const bool defaultTests = const bool defaultTests =
( args.found("default") || args.options().empty();
args.found("default")
|| args.options().empty()
|| (optNowaiting && args.options().size())
);
typedef FixedList<scalar,2> scalar2Type; typedef FixedList<scalar,2> scalar2Type;
@ -202,31 +195,14 @@ int main(int argc, char *argv[])
Info<< "get<3>: " << list1.get<3>() << nl; Info<< "get<3>: " << list1.get<3>() << nl;
// Will not compile: Info<< "get<4>: " << list1.get<4>() << nl; // Will not compile: Info<< "get<4>: " << list1.get<4>() << nl;
// Test deprecated form label a[4] = {0, 1, 2, 3};
label array2[4] = {0, 1, 2, 3}; FixedList<label, 4> list2(a);
FixedList<label, 4> list2(array2);
Info<< "list2:" << list2 Info<< "list2:" << list2
<< " hash:" << FixedList<label, 4>::hasher()(list2) << nl << " hash:" << FixedList<label, 4>::hasher()(list2) << nl
<< " hash:" << Hash<FixedList<label, 4>>()(list2) << nl; << " hash:" << Hash<FixedList<label, 4>>()(list2) << nl;
// Test deprecated form
SLList<label> sllist3;
{
sllist3.push_back(0);
sllist3.push_back(1);
sllist3.push_back(2);
sllist3.push_back(3);
}
FixedList<label, 4> list3(sllist3);
Info<< "list3:" << list3 << nl;
// Test deprecated forms
list3 = array2;
list2 = sllist3;
// Using FixedList for content too // Using FixedList for content too
{ {
List<FixedList<label, 4>> twolists{list1, list2}; List<FixedList<label, 4>> twolists{list1, list2};
@ -254,8 +230,8 @@ int main(int argc, char *argv[])
Info<< "mem: " Info<< "mem: "
<< name(list1.data()) << " " << name(list2.data()) << nl; << name(list1.data()) << " " << name(list2.data()) << nl;
Foam::Swap(list1, list2); Swap(list1, list2);
Info<< "Foam::Swap() function" << nl; Info<< "The Swap() function" << nl;
Info<< "list1: " << list1 << nl Info<< "list1: " << list1 << nl
<< "list2: " << list2 << nl; << "list2: " << list2 << nl;
@ -331,91 +307,34 @@ int main(int argc, char *argv[])
List<FixedList<label, 2>> list6{{0, 1}, {2, 3}}; List<FixedList<label, 2>> list6{{0, 1}, {2, 3}};
Info<< "list6: " << list6 << nl; Info<< "list6: " << list6 << nl;
if (UPstream::parRun()) if (Pstream::parRun())
{ {
// Fixed buffer would also work, but want to test using UList if (Pstream::master())
List<labelPair> buffer;
DynamicList<UPstream::Request> requests;
const label numProcs = UPstream::nProcs();
const label startOfRequests = UPstream::nRequests();
// NOTE: also test a mix of local and global requests...
UPstream::Request singleRequest;
if (UPstream::master())
{ {
// Use local requests here for (const int proci : Pstream::subProcs())
requests.reserve(numProcs);
buffer.resize(numProcs);
buffer[0] = labelPair(0, UPstream::myProcNo());
for (const int proci : UPstream::subProcs())
{ {
UIPstream::read IPstream fromSlave(Pstream::commsTypes::blocking, proci);
( FixedList<label, 2> list3(fromSlave);
requests.emplace_back(),
proci,
buffer.slice(proci, 1)
);
}
if (requests.size() > 1) Serr<< "Receiving from " << proci
{ << " : " << list3 << endl;
// Or just wait for as a single request...
singleRequest = requests.back();
requests.pop_back();
}
if (requests.size() > 2)
{
// Peel off a few from local -> global
// the order will not matter (is MPI_Waitall)
UPstream::addRequest(requests.back()); requests.pop_back();
UPstream::addRequest(requests.back()); requests.pop_back();
} }
} }
else else
{ {
buffer.resize(1); Perr<< "Sending to master" << endl;
buffer[0] = labelPair(0, UPstream::myProcNo());
Perr<< "Sending to master: " << buffer << endl; OPstream toMaster
// Capture the request and transfer to the global list
// (for testing)
UOPstream::write
( (
singleRequest, Pstream::commsTypes::blocking,
UPstream::masterNo(), Pstream::masterNo()
buffer.slice(0, 1) // OK
/// buffer // Also OK
); );
// if (singleRequest.good()) FixedList<label, 2> list3;
{ list3[0] = 0;
UPstream::addRequest(singleRequest); list3[1] = Pstream::myProcNo();
} toMaster << list3;
} }
Pout<< "Pending requests [" << numProcs << " procs] global="
<< (UPstream::nRequests() - startOfRequests)
<< " local=" << requests.size()
<< " single=" << singleRequest.good() << nl;
if (!optNowaiting)
{
UPstream::waitRequests(startOfRequests);
}
UPstream::waitRequests(requests);
UPstream::waitRequest(singleRequest);
Info<< "Gathered: " << buffer << endl;
} }
return 0; return 0;

View File

@ -68,7 +68,7 @@ void runSwapTest
for (label iLoop = 0; iLoop < nLoops; ++iLoop) for (label iLoop = 0; iLoop < nLoops; ++iLoop)
{ {
Foam::Swap(list1, list2); Swap(list1, list2);
} }
Info<< "output 1: " << list1.first() << nl; Info<< "output 1: " << list1.first() << nl;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2023 OpenCFD Ltd. Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -109,11 +109,7 @@ int main(int argc, char *argv[])
{ {
#include "setConstantRunTimeDictionaryIO.H" #include "setConstantRunTimeDictionaryIO.H"
#if (OPENFOAM > 2212) IOdictionary propsDict(dictIO);
dictionary propsDict(IOdictionary::readContents(dictIO));
#else
dictionary propsDict(static_cast<dictionary&&>(IOdictionary(dictIO)));
#endif
const scalarField xvals(propsDict.lookup("x")); const scalarField xvals(propsDict.lookup("x"));
@ -136,7 +132,7 @@ int main(int argc, char *argv[])
{ {
if (nameFilter(f)) if (nameFilter(f))
{ {
functionNames.push_back(f); functionNames.append(f);
} }
} }
} }
@ -144,7 +140,7 @@ int main(int argc, char *argv[])
{ {
for (label argi=1; argi < args.size(); ++argi) for (label argi=1; argi < args.size(); ++argi)
{ {
functionNames.push_back(args[argi]); functionNames.append(args[argi]);
} }
} }

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 | | \\ / O peration | Version: v2212 |
| \\ / A nd | Website: www.openfoam.com | | \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2306 | | \\ / O peration | Version: v2212 |
| \\ / A nd | Website: www.openfoam.com | | \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/

View File

@ -44,28 +44,38 @@ class Scalar
public: public:
static bool verbose; Scalar()
:
data_(0)
{}
constexpr Scalar() noexcept : data_(0) {} Scalar(scalar val)
Scalar(scalar val) noexcept : data_(val) {} :
data_(val)
{}
~Scalar() ~Scalar()
{ {
if (verbose) Info<< "delete Scalar: " << data_ << endl; Info<<"delete Scalar: " << data_ << endl;
} }
const scalar& value() const noexcept { return data_; } const scalar& value() const
scalar& value() noexcept { return data_; }
friend Ostream& operator<<(Ostream& os, const Scalar& item)
{ {
os << item.value(); return data_;
}
scalar& value()
{
return data_;
}
friend Ostream& operator<<(Ostream& os, const Scalar& val)
{
os << val.data_;
return os; return os;
} }
}; };
bool Scalar::verbose = true;
template<class T> template<class T>
void printTable(const HashPtrTable<T>& table) void printTable(const HashPtrTable<T>& table)
@ -119,9 +129,6 @@ int main()
myTable.set("natlog", new double(2.718282)); myTable.set("natlog", new double(2.718282));
myTable.insert("sqrt2", autoPtr<double>::New(1.414214)); myTable.insert("sqrt2", autoPtr<double>::New(1.414214));
myTable.insert("euler", autoPtr<double>::New(0.577216)); myTable.insert("euler", autoPtr<double>::New(0.577216));
myTable.set("def_0", nullptr);
myTable.emplace_set("def_1", 123);
myTable.emplace_set("def_2", 456);
HashTable<std::unique_ptr<double>> myTable1; HashTable<std::unique_ptr<double>> myTable1;
@ -139,14 +146,6 @@ int main()
Info<< "Initial table" << nl; Info<< "Initial table" << nl;
printTable(myTable); printTable(myTable);
myTable.try_emplace("def_0", 1000); // was nullptr, now value
myTable.try_emplace("def_1", 1001); // no-op
myTable.try_emplace("def_2", 1002); // no-op;
myTable.try_emplace("def_3", 1003); // was non-existent, now value
Info<< "after try_emplace" << nl;
printTable(myTable);
Info<< "print" << nl; Info<< "print" << nl;
Info<< myTable2 << nl; Info<< myTable2 << nl;

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