mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'OpenFOAM-v2306-rc1'
This commit is contained in:
@ -49,7 +49,7 @@
|
||||
|
||||
<!--
|
||||
Providing details of your set-up can help us identify any issues, e.g.
|
||||
OpenFOAM version : v2212|v2206|v2112|v2106|v2012 etc
|
||||
OpenFOAM version : v2306|v2212|v2206|v2112|v2106 etc
|
||||
Operating system : ubuntu|openSUSE|centos etc
|
||||
Hardware info : any info that may help?
|
||||
Compiler : gcc|intel|clang etc
|
||||
|
||||
10
Allwmake
10
Allwmake
@ -96,10 +96,12 @@ echo " ${WM_PROJECT_DIR##*/}"
|
||||
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
|
||||
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
|
||||
echo
|
||||
echo " api = $(etc/openfoam -show-api 2>/dev/null)"
|
||||
echo " patch = $(etc/openfoam -show-patch 2>/dev/null)"
|
||||
echo " bin = $(_foamCountDirEntries "$FOAM_APPBIN") entries"
|
||||
echo " lib = $(_foamCountDirEntries "$FOAM_LIBBIN") entries"
|
||||
|
||||
# The api/patch information
|
||||
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
|
||||
echo ========================================
|
||||
|
||||
|
||||
@ -5,17 +5,22 @@ It is likely incomplete...
|
||||
|
||||
## Contributors (alphabetical by surname)
|
||||
|
||||
- Horacio Aguerre
|
||||
- Yu Ankun
|
||||
- Tetsuo Aoyagi
|
||||
- Akira Azami
|
||||
- William Bainbridge
|
||||
- Gabriel Barajas
|
||||
- Kutalmis Bercin
|
||||
- Julius Bergmann
|
||||
- Ivor Clifford
|
||||
- Greg Collecutt
|
||||
- Jonathan Cranford
|
||||
- Santiago Marquez Damian
|
||||
- Sergio Ferraris
|
||||
- Matej Forman
|
||||
- Marian Fuchs
|
||||
- Gabriel Gerlero
|
||||
- Pawan Ghildiyal
|
||||
- Chris Greenshields
|
||||
- Bernhard Gschaider
|
||||
@ -50,8 +55,11 @@ It is likely incomplete...
|
||||
- Gavin Tabor
|
||||
- Zeljko Tukovic
|
||||
- Eugene De Villiers
|
||||
- Louis Vittoz
|
||||
- Vuko Vukcevic
|
||||
- Yi Wang
|
||||
- Norbert Weber
|
||||
- Volker Weissmann
|
||||
- Henry Weller
|
||||
- Niklas Wikstrom
|
||||
- Guanyang Xue
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=2212
|
||||
patch=230612
|
||||
api=2306
|
||||
patch=0
|
||||
|
||||
14
README.md
14
README.md
@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
|
||||
|
||||
If OpenFOAM has already been compiled on your system, simply source
|
||||
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
|
||||
For example, for the OpenFOAM-v2212 version:
|
||||
For example, for the OpenFOAM-v2306 version:
|
||||
```
|
||||
source /installation/path/OpenFOAM-v2212/etc/bashrc
|
||||
source /installation/path/OpenFOAM-v2306/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-v2212
|
||||
\-- ThirdParty-v2212
|
||||
|-- OpenFOAM-v2306
|
||||
\-- ThirdParty-v2306
|
||||
```
|
||||
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-sandbox2212, etc..
|
||||
directory name, e.g. openfoam-sandbox2306, 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*, `v2212-myCustom`,
|
||||
* allows for an updated value of VERSION, *eg*, `v2306-myCustom`,
|
||||
without requiring a renamed ThirdParty. The API value would still
|
||||
be `2212` and the original `ThirdParty-v2212/` would be found.
|
||||
be `2306` and the original `ThirdParty-v2306/` would be found.
|
||||
4. PREFIX/ThirdParty-API
|
||||
* same as the previous example, but using an unadorned API value.
|
||||
5. PREFIX/ThirdParty-common
|
||||
|
||||
@ -1,125 +1,4 @@
|
||||
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"
|
||||
#include "../createFields.H"
|
||||
|
||||
// Add solver-specific interpolations
|
||||
{
|
||||
|
||||
@ -83,6 +83,7 @@ Description
|
||||
\heading Options
|
||||
\plaintable
|
||||
-writep | write the Euler pressure
|
||||
-writephi | Write the final volumetric flux
|
||||
-writePhi | Write the final velocity potential
|
||||
-initialiseUBCs | Update the velocity boundaries before solving for Phi
|
||||
\endplaintable
|
||||
@ -117,6 +118,12 @@ int main(int argc, char *argv[])
|
||||
"Initialise U boundary conditions"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"writephi",
|
||||
"Write the final volumetric flux field"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"writePhi",
|
||||
@ -135,6 +142,8 @@ int main(int argc, char *argv[])
|
||||
"Execute functionObjects"
|
||||
);
|
||||
|
||||
#include "addRegionOption.H"
|
||||
#include "addCheckCaseOptions.H"
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createNamedDynamicFvMesh.H"
|
||||
@ -194,11 +203,16 @@ int main(int argc, char *argv[])
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Write U and phi
|
||||
// Write U
|
||||
U.write();
|
||||
phi.write();
|
||||
|
||||
// Optionally write Phi
|
||||
// Optionally write the volumetric flux, phi
|
||||
if (args.found("writephi"))
|
||||
{
|
||||
phi.write();
|
||||
}
|
||||
|
||||
// Optionally write velocity potential, Phi
|
||||
if (args.found("writePhi"))
|
||||
{
|
||||
Phi.write();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -132,6 +132,11 @@ void PDRkEpsilon::correct()
|
||||
|
||||
// Update epsilon and G at the wall
|
||||
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
|
||||
// in both the k and epsilon equations
|
||||
|
||||
@ -109,7 +109,7 @@ Foam::XiEqModel::calculateSchelkinEffect(const scalar uPrimeCoef) const
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(Nv.dimensions(), Zero)
|
||||
|
||||
@ -171,10 +171,7 @@ if (ign.ignited())
|
||||
|
||||
fvOptions.correct(Su);
|
||||
|
||||
// Limit the maximum Su
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
Su.min(SuMax);
|
||||
Su.max(SuMin);
|
||||
Su.clamp_range(SuMin, SuMax);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -218,7 +215,7 @@ if (ign.ignited())
|
||||
+ (
|
||||
scalar(1)
|
||||
+ (2*XiShapeCoef)
|
||||
*(scalar(0.5) - min(max(b, scalar(0)), scalar(1)))
|
||||
*(scalar(0.5) - clamp(b, zero_one{}))
|
||||
)*(XiEqStar - scalar(1.001))
|
||||
);
|
||||
|
||||
@ -226,7 +223,7 @@ if (ign.ignited())
|
||||
volScalarField R(Gstar*XiEqStar/(XiEqStar - scalar(1)));
|
||||
volScalarField G(R*(XiEq - scalar(1.001))/XiEq);
|
||||
|
||||
//R *= (Gstar + 2*mag(dev(symm(fvc::grad(U)))))/Gstar;
|
||||
//R *= (Gstar + 2*mag(devSymm(fvc::grad(U))))/Gstar;
|
||||
|
||||
// Solve for the flame wrinkling
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -12,7 +12,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("Ydefault", dimless, 1)
|
||||
@ -29,7 +29,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("p", dimPressure, p0)
|
||||
@ -46,7 +46,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("T", dimTemperature, T0)
|
||||
|
||||
@ -39,13 +39,13 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
|
||||
radiation->correct();
|
||||
|
||||
|
||||
@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
|
||||
@ -103,16 +103,10 @@ Foam::smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
if (!this->readValueEntry(dict))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
// Fallback: set to the internal field
|
||||
fvPatchField<scalar>::patchInternalField(*this);
|
||||
}
|
||||
|
||||
refValue() = *this;
|
||||
@ -165,14 +159,10 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchScalarField& pmu =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
const fvPatchScalarField& prho =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
const fvPatchField<scalar>& ppsi =
|
||||
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
const fvPatchVectorField& pU =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_);
|
||||
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_);
|
||||
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
|
||||
const auto& pU = patch().lookupPatchField<volVectorField>(UName_);
|
||||
|
||||
// Prandtl number reading consistent with rhoCentralFoam
|
||||
const dictionary& thermophysicalProperties =
|
||||
@ -207,7 +197,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
|
||||
// Write
|
||||
void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
fvPatchField<scalar>::write(os);
|
||||
|
||||
os.writeEntryIfDifferent<word>("U", "U", UName_);
|
||||
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
|
||||
@ -217,7 +207,7 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::write(Ostream& os) const
|
||||
os.writeEntry("accommodationCoeff", accommodationCoeff_);
|
||||
Twall_.writeEntry("Twall", os);
|
||||
os.writeEntry("gamma", gamma_);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<scalar>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -105,18 +105,15 @@ Foam::maxwellSlipUFvPatchVectorField::maxwellSlipUFvPatchVectorField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
if (this->readValueEntry(dict))
|
||||
{
|
||||
fvPatchField<vector>::operator=
|
||||
(
|
||||
vectorField("value", dict, p.size())
|
||||
);
|
||||
const auto* hasRefValue = dict.findEntry("refValue", keyType::LITERAL);
|
||||
const auto* hasFrac = dict.findEntry("valueFraction", keyType::LITERAL);
|
||||
|
||||
if (dict.found("refValue") && dict.found("valueFraction"))
|
||||
if (hasRefValue && hasFrac)
|
||||
{
|
||||
this->refValue() = vectorField("refValue", dict, p.size());
|
||||
this->valueFraction() =
|
||||
scalarField("valueFraction", dict, p.size());
|
||||
this->refValue().assign(*hasRefValue, p.size());
|
||||
this->valueFraction().assign(*hasFrac, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -155,12 +152,9 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchScalarField& pmu =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
const fvPatchScalarField& prho =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
const fvPatchField<scalar>& ppsi =
|
||||
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_);
|
||||
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_);
|
||||
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
|
||||
|
||||
Field<scalar> C1
|
||||
(
|
||||
@ -187,8 +181,8 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
|
||||
|
||||
if (curvature_)
|
||||
{
|
||||
const fvPatchTensorField& ptauMC =
|
||||
patch().lookupPatchField<volTensorField, tensor>(tauMCName_);
|
||||
const auto& ptauMC =
|
||||
patch().lookupPatchField<volTensorField>(tauMCName_);
|
||||
vectorField n(patch().nf());
|
||||
|
||||
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
|
||||
@ -200,7 +194,7 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
|
||||
|
||||
void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
fvPatchField<vector>::write(os);
|
||||
os.writeEntryIfDifferent<word>("T", "T", TName_);
|
||||
os.writeEntryIfDifferent<word>("rho", "rho", rhoName_);
|
||||
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
|
||||
@ -215,7 +209,7 @@ void Foam::maxwellSlipUFvPatchVectorField::write(Ostream& os) const
|
||||
refValue().writeEntry("refValue", os);
|
||||
valueFraction().writeEntry("valueFraction", os);
|
||||
|
||||
writeEntry("value", os);
|
||||
fvPatchField<vector>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -104,11 +104,8 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& psip =
|
||||
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>(pName_);
|
||||
const auto& psip = patch().lookupPatchField<volScalarField>(psiName_);
|
||||
const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
|
||||
|
||||
operator==(psip*pp);
|
||||
|
||||
@ -118,11 +115,10 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
|
||||
|
||||
void Foam::fixedRhoFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
|
||||
fvPatchField<scalar>::write(os);
|
||||
os.writeEntryIfDifferent<word>("p", "p", pName_);
|
||||
os.writeEntryIfDifferent<word>("psi", "thermo:psi", psiName_);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<scalar>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -29,7 +29,7 @@ if (mesh.changing())
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
// Set BCs of pcorr to fixed-value for patches at which p is fixed
|
||||
|
||||
@ -87,7 +87,13 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
fam::ddt(h, Us)
|
||||
+ fam::div(phi2s, Us)
|
||||
+ fam::Sp(0.0125*frictionFactor*mag(Us), Us)
|
||||
+ fam::Sp
|
||||
(
|
||||
0.0125
|
||||
*frictionFactor.internalField()
|
||||
*mag(Us.internalField()),
|
||||
Us
|
||||
)
|
||||
==
|
||||
Gs*h
|
||||
- fam::Sp(Sd, Us)
|
||||
|
||||
@ -47,6 +47,7 @@ forAll(Us, faceI)
|
||||
Us[faceI].z() =
|
||||
Uinf.value()*0.25*R[faceI].x()*R[faceI].z()/sqr(mag(R[faceI]));
|
||||
}
|
||||
Us.boundaryFieldRef().evaluateCoupled<coupledFaPatch>();
|
||||
|
||||
Us -= aMesh.faceAreaNormals()*(aMesh.faceAreaNormals() & Us);
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ if (mesh.changing())
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
// Set BCs of pcorr to fixed-value for patches at which p is fixed
|
||||
|
||||
@ -108,7 +108,7 @@ forAll(fluidRegions, i)
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dimensionedScalar("hRef", dimLength, Zero) // uses name
|
||||
dimensionedScalar(word::null, dimLength, Zero)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
derivedFvPatchFields/turbulentTemperatureTwoPhaseRadCoupledMixed/turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField.C
|
||||
../solid/solidRegionDiffNo.C
|
||||
solid/solidRegionDiffNo.C
|
||||
chtMultiRegionTwoPhaseEulerFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/chtMultiRegionTwoPhaseEulerFoam
|
||||
|
||||
@ -88,26 +88,29 @@ kappa
|
||||
|
||||
case mtLookup:
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(kappaName_))
|
||||
{
|
||||
return patch().lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
kappaName_
|
||||
);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<volScalarField>(kappaName_);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return patch().patchField(*ptr);
|
||||
}
|
||||
}
|
||||
else if (mesh.foundObject<volSymmTensorField>(kappaName_))
|
||||
{
|
||||
const symmTensorField& KWall =
|
||||
patch().lookupPatchField<volSymmTensorField, scalar>
|
||||
(
|
||||
kappaName_
|
||||
);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<volSymmTensorField>(kappaName_);
|
||||
|
||||
const vectorField n(patch().nf());
|
||||
if (ptr)
|
||||
{
|
||||
const symmTensorField& KWall = patch().patchField(*ptr);
|
||||
|
||||
return n & KWall & n;
|
||||
const vectorField n(patch().nf());
|
||||
|
||||
return n & KWall & n;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Did not find field " << kappaName_
|
||||
@ -117,9 +120,6 @@ kappa
|
||||
<< " or volSymmTensorField."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -131,10 +131,8 @@ kappa
|
||||
mesh.lookupObject<phaseSystem>("phaseProperties")
|
||||
);
|
||||
|
||||
tmp<scalarField> kappaEff
|
||||
(
|
||||
new scalarField(patch().size(), 0.0)
|
||||
);
|
||||
auto tkappaEff = tmp<scalarField>::New(patch().size(), Zero);
|
||||
auto& kappaEff = tkappaEff.ref();
|
||||
|
||||
forAll(fluid.phases(), phasei)
|
||||
{
|
||||
@ -142,10 +140,10 @@ kappa
|
||||
|
||||
const fvPatchScalarField& alpha = phase.boundaryField()[patchi];
|
||||
|
||||
kappaEff.ref() += alpha*phase.kappaEff(patchi)();
|
||||
kappaEff += alpha*phase.kappaEff(patchi)();
|
||||
}
|
||||
|
||||
return kappaEff;
|
||||
return tkappaEff;
|
||||
|
||||
break;
|
||||
}
|
||||
@ -161,9 +159,11 @@ kappa
|
||||
}
|
||||
}
|
||||
|
||||
return scalarField(0);
|
||||
// Return zero-sized (not nullptr)
|
||||
return tmp<scalarField>::New();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -243,14 +243,12 @@ turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue"))
|
||||
this->readValueEntry(dict, IOobjectOption::MUST_READ);
|
||||
|
||||
if (this->readMixedEntries(dict))
|
||||
{
|
||||
// Full restart
|
||||
refValue() = scalarField("refValue", dict, p.size());
|
||||
refGrad() = scalarField("refGradient", dict, p.size());
|
||||
valueFraction() = scalarField("valueFraction", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -308,12 +306,11 @@ updateCoeffs()
|
||||
|
||||
scalarField& Tp = *this;
|
||||
|
||||
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField&
|
||||
nbrField = refCast
|
||||
<const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField>
|
||||
(
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
|
||||
);
|
||||
const auto& nbrField =
|
||||
refCast
|
||||
<
|
||||
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
>(nbrPatch.lookupPatchField<volScalarField>(TnbrName_));
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField TcNbr(nbrField.patchInternalField());
|
||||
@ -330,13 +327,13 @@ updateCoeffs()
|
||||
scalarField qr(Tp.size(), 0.0);
|
||||
if (qrName_ != "none")
|
||||
{
|
||||
qr = patch().lookupPatchField<volScalarField, scalar>(qrName_);
|
||||
qr = patch().lookupPatchField<volScalarField>(qrName_);
|
||||
}
|
||||
|
||||
scalarField qrNbr(Tp.size(), 0.0);
|
||||
if (qrNbrName_ != "none")
|
||||
{
|
||||
qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_);
|
||||
qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_);
|
||||
mpp.distribute(qrNbr);
|
||||
}
|
||||
|
||||
@ -486,7 +483,7 @@ void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::write
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
mixedFvPatchField<scalar>::write(os);
|
||||
os.writeEntry("kappaMethod", KMethodTypeNames_[method_]);
|
||||
os.writeEntryIfDifferent<word>("kappa","none", kappaName_);
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ forAll(fluidRegions, i)
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dimensionedScalar("hRef", dimLength, Zero)
|
||||
dimensionedScalar(word::null, dimLength, Zero)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -13,11 +13,11 @@ forAll(cumulativeContErrIO, i)
|
||||
"cumulativeContErr",
|
||||
runTime.timeName(),
|
||||
"uniform",
|
||||
mesh,
|
||||
mesh.thisDb(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
dimensionedScalar(dimless, Zero)
|
||||
dimensionedScalar(word::null, dimless, Zero)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -0,0 +1 @@
|
||||
../../solid/solidRegionDiffNo.C
|
||||
@ -48,7 +48,7 @@ if (Y.size())
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
@ -56,6 +56,6 @@ if (Y.size())
|
||||
if (Y.size())
|
||||
{
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ forAll(fluidRegions, i)
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
dimensionedScalar("hRef", dimLength, Zero) // uses name
|
||||
dimensionedScalar(word::null, dimLength, Zero)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -13,11 +13,11 @@ forAll(cumulativeContErrIO, i)
|
||||
"cumulativeContErr",
|
||||
runTime.timeName(),
|
||||
"uniform",
|
||||
mesh,
|
||||
mesh.thisDb(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
dimensionedScalar(dimless, Zero)
|
||||
dimensionedScalar(word::null, dimless, Zero)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
),
|
||||
solidRegions[i],
|
||||
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
|
||||
zeroGradientFvPatchSymmTensorField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ if (!thermo.isotropic())
|
||||
),
|
||||
mesh,
|
||||
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
|
||||
zeroGradientFvPatchSymmTensorField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
)
|
||||
);
|
||||
volSymmTensorField& aniAlpha = *taniAlpha;
|
||||
|
||||
@ -44,7 +44,7 @@ IOobject turbulencePropertiesHeader
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
if (turbulencePropertiesHeader.typeHeaderOk<IOdictionary>(false))
|
||||
|
||||
@ -89,17 +89,10 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("phi");
|
||||
|
||||
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");
|
||||
const auto& phip = patch().lookupPatchField<surfaceScalarField>("phi");
|
||||
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
|
||||
const auto& Up = patch().lookupPatchField<volVectorField>("U");
|
||||
const auto& Uap = patch().lookupPatchField<volVectorField>("Ua");
|
||||
|
||||
operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));
|
||||
|
||||
@ -109,8 +102,8 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
|
||||
|
||||
void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<scalar>::write(os);
|
||||
fvPatchField<scalar>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -90,11 +90,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvsPatchField<scalar>& phiap =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("phia");
|
||||
|
||||
const fvPatchField<vector>& Up =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
|
||||
const auto& Up = patch().lookupPatchField<volVectorField>("U");
|
||||
|
||||
scalarField Un(mag(patch().nf() & Up));
|
||||
vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL));
|
||||
@ -110,8 +107,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||
|
||||
void Foam::adjointOutletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<vector>::write(os);
|
||||
fvPatchField<vector>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ if (mesh.changing())
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
// 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)
|
||||
{
|
||||
validCells.append(refCells[zoneId]);
|
||||
validCells.push_back(refCells[zoneId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();
|
||||
|
||||
@ -111,7 +111,7 @@ int main(int argc, char *argv[])
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();
|
||||
|
||||
@ -40,11 +40,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
|
||||
@ -41,11 +41,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ IOobject io
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<IOdictionary>())
|
||||
@ -32,4 +32,4 @@ if (io.typeHeaderOk<IOdictionary>())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
|
||||
@ -38,11 +38,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
|
||||
@ -39,11 +39,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
||||
|
||||
fvOptions.correct(Yi);
|
||||
|
||||
Yi.max(0.0);
|
||||
Yi.clamp_min(0);
|
||||
Yt += Yi;
|
||||
}
|
||||
}
|
||||
|
||||
Y[inertIndex] = scalar(1) - Yt;
|
||||
Y[inertIndex].max(0.0);
|
||||
Y[inertIndex].clamp_min(0);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ int main(int argc, char *argv[])
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
|
||||
zeroGradientFvPatchVectorField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();
|
||||
|
||||
@ -64,8 +64,7 @@ volScalarField mu
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT
|
||||
),
|
||||
mixture.mu(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
mixture.mu()
|
||||
);
|
||||
|
||||
|
||||
@ -139,7 +138,7 @@ volScalarField alphac
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimless, Zero),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
alphac.oldTime();
|
||||
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
{
|
||||
alphav =
|
||||
max
|
||||
(
|
||||
min
|
||||
(
|
||||
(rho - rholSat)/(rhovSat - rholSat),
|
||||
scalar(1)
|
||||
),
|
||||
scalar(0)
|
||||
);
|
||||
alphav = clamp((rho - rholSat)/(rhovSat - rholSat), zero_one{});
|
||||
alphal = 1.0 - alphav;
|
||||
|
||||
Info<< "max-min alphav: " << max(alphav).value()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
for (label i=0; i<p.boundaryField().size(); i++)
|
||||
|
||||
@ -140,7 +140,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimless, Zero),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
),
|
||||
curTimeIndex_(-1)
|
||||
{
|
||||
|
||||
@ -84,7 +84,7 @@ Foam::surfaceTensionModels::liquidProperties::sigma() const
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimSigma
|
||||
|
||||
@ -126,9 +126,9 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
|
||||
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
fvPatchField<scalar>::write(os);
|
||||
os.writeEntry("thetaProperties", thetaProps_);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<scalar>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -779,7 +779,7 @@ Foam::multiphaseMixtureThermo::surfaceTensionForce() const
|
||||
|
||||
auto sigma = sigmas_.cfind(interfacePair(alpha1, alpha2));
|
||||
|
||||
if (!sigma.found())
|
||||
if (!sigma.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find interface " << interfacePair(alpha1, alpha2)
|
||||
@ -907,7 +907,7 @@ void Foam::multiphaseMixtureThermo::correctContactAngle
|
||||
const auto tp =
|
||||
acap.thetaProps().cfind(interfacePair(alpha1, alpha2));
|
||||
|
||||
if (!tp.found())
|
||||
if (!tp.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find interface " << interfacePair(alpha1, alpha2)
|
||||
|
||||
@ -105,8 +105,7 @@ incompressibleTwoPhaseInteractingMixture
|
||||
U_.db()
|
||||
),
|
||||
U_.mesh(),
|
||||
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero)
|
||||
)
|
||||
{
|
||||
correct();
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::wordList Foam::relativeVelocityModel::UdmPatchFieldTypes() const
|
||||
wordList UdmTypes
|
||||
(
|
||||
U.boundaryField().size(),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::calculatedType()
|
||||
);
|
||||
|
||||
forAll(U.boundaryField(), i)
|
||||
|
||||
@ -724,7 +724,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::laserDTRM::Rp() const
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimPower/dimVolume/pow4(dimTemperature), Zero)
|
||||
|
||||
@ -97,7 +97,7 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(inv(dimLength), Zero)
|
||||
@ -130,7 +130,7 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(inv(dimLength), Zero)
|
||||
@ -163,7 +163,7 @@ Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
|
||||
|
||||
@ -99,17 +99,6 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotAlphal() const
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||
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 twoPhaseMixtureEThermo& thermo =
|
||||
@ -124,11 +113,15 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
|
||||
|
||||
volScalarField mDotE
|
||||
(
|
||||
"mDotE", coeffE_*mixture_.rho1()*limitedAlpha1*max(T - TSat, T0)
|
||||
"mDotE",
|
||||
coeffE_*mixture_.rho1()*clamp(mixture_.alpha1(), zero_one{})
|
||||
* max(T - TSat, T0)
|
||||
);
|
||||
volScalarField mDotC
|
||||
(
|
||||
"mDotC", coeffC_*mixture_.rho2()*limitedAlpha2*max(TSat - T, T0)
|
||||
"mDotC",
|
||||
coeffC_*mixture_.rho2()*clamp(mixture_.alpha2(), zero_one{})
|
||||
* max(TSat - T, T0)
|
||||
);
|
||||
|
||||
if (mesh_.time().outputTime())
|
||||
@ -148,16 +141,6 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
|
||||
Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||
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 twoPhaseMixtureEThermo& thermo =
|
||||
@ -170,8 +153,14 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDotDeltaT() const
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*pos(TSat - T),
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*pos(T - TSat)
|
||||
(
|
||||
coeffC_*mixture_.rho2()*clamp(mixture_.alpha2(), zero_one{})
|
||||
* pos(TSat - T)
|
||||
),
|
||||
(
|
||||
coeffE_*mixture_.rho1()*clamp(mixture_.alpha1(), zero_one{})
|
||||
* pos(T - TSat)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -201,25 +190,17 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::TSource() const
|
||||
|
||||
const dimensionedScalar& TSat = thermo.TSat();
|
||||
|
||||
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 dimensionedScalar L = mixture_.Hf2() - mixture_.Hf1();
|
||||
|
||||
const volScalarField Vcoeff
|
||||
(
|
||||
coeffE_*mixture_.rho1()*limitedAlpha1*L*pos(T - TSat)
|
||||
coeffE_*mixture_.rho1()*clamp(mixture_.alpha1(), zero_one{})
|
||||
* L*pos(T - TSat)
|
||||
);
|
||||
const volScalarField Ccoeff
|
||||
(
|
||||
coeffC_*mixture_.rho2()*limitedAlpha2*L*pos(TSat - T)
|
||||
coeffC_*mixture_.rho2()*clamp(mixture_.alpha2(), zero_one{})
|
||||
* L*pos(TSat - T)
|
||||
);
|
||||
|
||||
TSource =
|
||||
|
||||
@ -167,20 +167,10 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||
Foam::temperaturePhaseChangeTwoPhaseMixtures::interfaceHeatResistance::
|
||||
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>>
|
||||
(
|
||||
(mDotc_/(limitedAlpha2 + SMALL)),
|
||||
-(mDote_/(limitedAlpha1 + SMALL))
|
||||
(mDotc_/clamp(mixture_.alpha2(), scalarMinMax(SMALL, 1))),
|
||||
-(mDote_/clamp(mixture_.alpha1(), scalarMinMax(SMALL, 1)))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // Do not register
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cp() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_, zero_one{})
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
@ -176,13 +176,11 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cp
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
const scalarField alpha1p
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_.boundaryField()[patchi], zero_one{})
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(
|
||||
alpha1p*Cp1().value() + (scalar(1) - alpha1p)*Cp2().value()
|
||||
@ -194,7 +192,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::rho() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_, zero_one{})
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
@ -214,13 +212,11 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::rho
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
const scalarField alpha1p
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_.boundaryField()[patchi], zero_one{})
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(
|
||||
alpha1p*rho1().value() + (scalar(1) - alpha1p)*rho2().value()
|
||||
@ -232,7 +228,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::Cv() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_, zero_one{})
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
@ -253,13 +249,11 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::Cv
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
const scalarField alpha1p
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_.boundaryField()[patchi], zero_one{})
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(
|
||||
alpha1p*Cv1().value() + (scalar(1) - alpha1p)*Cv2().value()
|
||||
@ -339,7 +333,7 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureEThermo::kappa() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_, zero_one{})
|
||||
);
|
||||
|
||||
return tmp<volScalarField>
|
||||
@ -358,13 +352,11 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::kappa
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
const scalarField alpha1p
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_.boundaryField()[patchi], zero_one{})
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return (alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value());
|
||||
}
|
||||
|
||||
@ -402,13 +394,11 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::kappaEff
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
const scalarField alpha1p
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_.boundaryField()[patchi], zero_one{})
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
return
|
||||
(alpha1p*kappa1().value() + (1 - alpha1p)*kappa2().value()) + kappat;
|
||||
|
||||
@ -435,13 +425,11 @@ Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureEThermo::alphaEff
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
const scalarField alpha1p
|
||||
(
|
||||
min(max(alpha1_, scalar(0)), scalar(1))
|
||||
clamp(alpha1_.boundaryField()[patchi], zero_one{})
|
||||
);
|
||||
|
||||
const scalarField& alpha1p = limitedAlpha1.boundaryField()[patchi];
|
||||
|
||||
const scalarField rho
|
||||
(
|
||||
alpha1p*rho1().value() + (1.0 - alpha1p)*rho2().value()
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimless,
|
||||
|
||||
@ -119,8 +119,7 @@ Foam::incompressibleThreePhaseMixture::incompressibleThreePhaseMixture
|
||||
U.db()
|
||||
),
|
||||
U.mesh(),
|
||||
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero),
|
||||
calculatedFvPatchScalarField::typeName
|
||||
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero)
|
||||
),
|
||||
|
||||
nuModel1_
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p_rgh.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
|
||||
for (label i=0; i<p_rgh.boundaryField().size(); i++)
|
||||
@ -103,7 +103,7 @@
|
||||
{
|
||||
if (refCells[zoneId] != -1)
|
||||
{
|
||||
validCells.append(refCells[zoneId]);
|
||||
validCells.push_back(refCells[zoneId]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const
|
||||
{
|
||||
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
|
||||
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
@ -85,7 +85,7 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||
Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const
|
||||
{
|
||||
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
|
||||
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
|
||||
@ -82,7 +82,7 @@ Foam::Pair<Foam::tmp<Foam::volScalarField>>
|
||||
Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const
|
||||
{
|
||||
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
|
||||
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
|
||||
@ -99,7 +99,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
|
||||
const volScalarField& p
|
||||
) const
|
||||
{
|
||||
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
|
||||
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
|
||||
volScalarField rho
|
||||
(
|
||||
limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()
|
||||
@ -117,7 +117,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const
|
||||
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||
volScalarField pCoeff(this->pCoeff(p));
|
||||
|
||||
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
|
||||
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
(
|
||||
@ -134,7 +134,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const
|
||||
const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p");
|
||||
volScalarField pCoeff(this->pCoeff(p));
|
||||
|
||||
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
|
||||
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
|
||||
volScalarField apCoeff(limitedAlpha1*pCoeff);
|
||||
|
||||
return Pair<tmp<volScalarField>>
|
||||
|
||||
@ -48,7 +48,7 @@ Foam::phaseChangeTwoPhaseMixture::New
|
||||
U.db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false // Do not register
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ surfaceScalarField phi
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimArea*dimVelocity, Zero)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
multiphaseSystem fluid(U, phi);
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimArea*dimVelocity, Zero)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
volScalarField rho("rho", fluid.rho());
|
||||
@ -76,7 +76,7 @@
|
||||
mesh
|
||||
),
|
||||
fluid.dragCoeff(phase, dragCoeffs())/phase.rho(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
dragCoeffi.correctBoundaryConditions();
|
||||
|
||||
|
||||
@ -126,9 +126,9 @@ alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
|
||||
|
||||
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
fvPatchField<scalar>::write(os);
|
||||
os.writeEntry("thetaProperties", thetaProps_);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<scalar>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -287,7 +287,7 @@ Foam::multiphaseMixture::surfaceTensionForce() const
|
||||
|
||||
auto sigma = sigmas_.cfind(interfacePair(alpha1, alpha2));
|
||||
|
||||
if (!sigma.found())
|
||||
if (!sigma.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find interface " << interfacePair(alpha1, alpha2)
|
||||
@ -463,7 +463,7 @@ void Foam::multiphaseMixture::correctBoundaryContactAngle
|
||||
|
||||
const auto tp = acap.thetaProps().cfind(interfacePair(alpha1, alpha2));
|
||||
|
||||
if (!tp.found())
|
||||
if (!tp.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find interface " << interfacePair(alpha1, alpha2)
|
||||
|
||||
@ -180,7 +180,7 @@ while (pimple.correct())
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
forAll(phases, phasei)
|
||||
|
||||
@ -165,7 +165,7 @@ while (pimple.correct())
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("phiHbyA", dimArea*dimVelocity, 0)
|
||||
dimensionedScalar(dimVelocity*dimArea, Zero)
|
||||
);
|
||||
|
||||
forAll(phases, phasei)
|
||||
|
||||
@ -47,7 +47,7 @@ tractionDisplacementFvPatchVectorField
|
||||
traction_(p.size(), Zero),
|
||||
pressure_(p.size(), Zero)
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
extrapolateInternal();
|
||||
gradient() = Zero;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ tractionDisplacementFvPatchVectorField
|
||||
traction_("traction", dict, p.size()),
|
||||
pressure_("pressure", dict, p.size())
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
extrapolateInternal();
|
||||
gradient() = Zero;
|
||||
}
|
||||
|
||||
@ -152,14 +152,9 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
db().lookupObject<IOdictionary>("thermalProperties");
|
||||
|
||||
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const fvPatchField<scalar>& rhoE =
|
||||
patch().lookupPatchField<volScalarField, scalar>("E");
|
||||
|
||||
const fvPatchField<scalar>& nu =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
const auto& rho = patch().lookupPatchField<volScalarField>("rho");
|
||||
const auto& rhoE = patch().lookupPatchField<volScalarField>("E");
|
||||
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
|
||||
|
||||
scalarField E(rhoE/rho);
|
||||
scalarField mu(E/(2.0*(1.0 + nu)));
|
||||
@ -176,8 +171,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
const fvPatchField<symmTensor>& sigmaD =
|
||||
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
||||
const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD");
|
||||
|
||||
gradient() =
|
||||
(
|
||||
@ -187,11 +181,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
if (thermalProperties.get<bool>("thermalStress"))
|
||||
{
|
||||
const fvPatchField<scalar>& threeKalpha=
|
||||
patch().lookupPatchField<volScalarField, scalar>("threeKalpha");
|
||||
const auto& threeKalpha =
|
||||
patch().lookupPatchField<volScalarField>("threeKalpha");
|
||||
|
||||
const fvPatchField<scalar>& T =
|
||||
patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
const auto& T = patch().lookupPatchField<volScalarField>("T");
|
||||
|
||||
gradient() += n*threeKalpha*T/twoMuLambda;
|
||||
}
|
||||
@ -202,10 +195,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
void tractionDisplacementFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
fvPatchField<vector>::write(os);
|
||||
traction_.writeEntry("traction", os);
|
||||
pressure_.writeEntry("pressure", os);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<vector>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ tractionDisplacementCorrectionFvPatchVectorField
|
||||
traction_(p.size(), Zero),
|
||||
pressure_(p.size(), Zero)
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
extrapolateInternal();
|
||||
gradient() = Zero;
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ tractionDisplacementCorrectionFvPatchVectorField
|
||||
traction_("traction", dict, p.size()),
|
||||
pressure_("pressure", dict, p.size())
|
||||
{
|
||||
fvPatchVectorField::operator=(patchInternalField());
|
||||
extrapolateInternal();
|
||||
gradient() = Zero;
|
||||
}
|
||||
|
||||
@ -152,14 +152,9 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
"mechanicalProperties"
|
||||
);
|
||||
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const fvPatchField<scalar>& rhoE =
|
||||
patch().lookupPatchField<volScalarField, scalar>("E");
|
||||
|
||||
const fvPatchField<scalar>& nu =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
const auto& rho = patch().lookupPatchField<volScalarField>("rho");
|
||||
const auto& rhoE = patch().lookupPatchField<volScalarField>("E");
|
||||
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
|
||||
|
||||
scalarField E(rhoE/rho);
|
||||
scalarField mu(E/(2.0*(1.0 + nu)));
|
||||
@ -172,11 +167,8 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
const fvPatchField<symmTensor>& sigmaD =
|
||||
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
||||
|
||||
const fvPatchField<tensor>& sigmaExp =
|
||||
patch().lookupPatchField<volTensorField, tensor>("sigmaExp");
|
||||
const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD");
|
||||
const auto& sigmaExp = patch().lookupPatchField<volTensorField>("sigmaExp");
|
||||
|
||||
gradient() =
|
||||
(
|
||||
@ -190,10 +182,10 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
// Write
|
||||
void tractionDisplacementCorrectionFvPatchVectorField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
fvPatchField<vector>::write(os);
|
||||
traction_.writeEntry("traction", os);
|
||||
pressure_.writeEntry("pressure", os);
|
||||
writeEntry("value", os);
|
||||
fvPatchField<vector>::writeValueEntry(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,14 @@ License
|
||||
|
||||
#include "dummyLib.H"
|
||||
#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>
|
||||
|
||||
// * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * * //
|
||||
|
||||
@ -69,7 +69,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
size
|
||||
);
|
||||
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
@ -125,7 +125,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
size
|
||||
);
|
||||
@ -157,7 +157,7 @@ int main(int argc, char *argv[])
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -52,28 +53,29 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info << "testField:" << testField << endl;
|
||||
|
||||
testField.append(vector(0.5, 4.8, 6.2));
|
||||
testField.emplace_back(0.5, 4.8, 6.2);
|
||||
|
||||
Info << "testField after appending:" << testField << endl;
|
||||
|
||||
testField.append(vector(2.7, 2.3, 6.1));
|
||||
testField.emplace_back(2.7, 2.3, 6.1);
|
||||
|
||||
Info << "testField after appending:" << testField << endl;
|
||||
|
||||
vector elem = testField.remove();
|
||||
vector elem = testField.back();
|
||||
testField.pop_back();
|
||||
|
||||
Info << "removed element:" << elem << endl;
|
||||
Info << "testField:" << testField << endl;
|
||||
|
||||
testField.append(vector(3.0, 1.3, 9.2));
|
||||
testField.emplace_back(3.0, 1.3, 9.2);
|
||||
|
||||
Info << "testField:" << testField << endl;
|
||||
|
||||
testField.setSize(10, vector(1.5, 0.6, -1.0));
|
||||
testField.resize(10, vector(1.5, 0.6, -1.0));
|
||||
|
||||
Info << "testField after setSize:" << testField << endl;
|
||||
|
||||
testField.append(testField2);
|
||||
testField.push_back(testField2);
|
||||
|
||||
Info << "testField after appending testField2:" << testField << endl;
|
||||
|
||||
@ -87,7 +89,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
testField.clear();
|
||||
|
||||
testField.append(vector(3.0, 1.3, 9.2));
|
||||
testField.emplace_back(3.0, 1.3, 9.2);
|
||||
|
||||
Info << "testField after clear and append:" << testField << endl;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -140,7 +140,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
0, 1, 2, 3, 4
|
||||
};
|
||||
dlA.append({ 5, 6 });
|
||||
dlA.push_back({ 5, 6 });
|
||||
dlA = { 1, 2, 4 };
|
||||
|
||||
DynamicList<label> dlB;
|
||||
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
|
||||
// Copy back and append a few time
|
||||
for (label i=0; i < 3; i++)
|
||||
{
|
||||
dlB.append(lstA);
|
||||
dlB.push_back(lstA);
|
||||
}
|
||||
|
||||
Info<< "appended list a few times" << endl;
|
||||
@ -186,7 +186,7 @@ int main(int argc, char *argv[])
|
||||
// Copy back and append a few time
|
||||
for (label i=0; i < 3; i++)
|
||||
{
|
||||
dlB.append(lstA);
|
||||
dlB.push_back(lstA);
|
||||
}
|
||||
|
||||
|
||||
@ -220,8 +220,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (label elemI=0; elemI < 5; ++elemI)
|
||||
{
|
||||
dlE1.append(4 - elemI);
|
||||
dlE2.append(elemI);
|
||||
dlE1.push_back(4 - elemI);
|
||||
dlE2.push_back(elemI);
|
||||
}
|
||||
|
||||
printInfo("dlE2", dlE2, true);
|
||||
@ -243,9 +243,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
{
|
||||
DynamicList<label> addr(10);
|
||||
addr.append(3);
|
||||
addr.append(1);
|
||||
addr.append(2);
|
||||
addr.emplace_back(3);
|
||||
addr.emplace_back(1);
|
||||
addr.emplace_back(2);
|
||||
|
||||
// Can also use the return value
|
||||
Info<< "adding " << addr.emplace_back(4) << endl;
|
||||
|
||||
forAll(dlE2, i)
|
||||
{
|
||||
@ -297,9 +300,9 @@ int main(int argc, char *argv[])
|
||||
Info<< "test move-append with "
|
||||
<< flatOutput(input1) << " and " << flatOutput(input2) << endl;
|
||||
|
||||
list2.append(std::move(list1));
|
||||
list2.append(std::move(input1));
|
||||
list2.append(std::move(input2));
|
||||
list2.push_back(std::move(list1));
|
||||
list2.push_back(std::move(input1));
|
||||
list2.push_back(std::move(input2));
|
||||
|
||||
Info<< "result: " << flatOutput(list2) << nl
|
||||
<< "inputs: " << flatOutput(list1) << " / "
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -112,13 +112,20 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption("iter");
|
||||
argList::addBoolOption("swap");
|
||||
argList::addBoolOption("default", "reinstate default tests");
|
||||
argList::addBoolOption("no-wait", "test with skipping request waits");
|
||||
argList::addNote("runs default tests or specified ones only");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const bool optNowaiting = args.found("no-wait");
|
||||
|
||||
// Run default tests, unless only specific tests are requested
|
||||
const bool defaultTests =
|
||||
args.found("default") || args.options().empty();
|
||||
(
|
||||
args.found("default")
|
||||
|| args.options().empty()
|
||||
|| (optNowaiting && args.options().size())
|
||||
);
|
||||
|
||||
|
||||
typedef FixedList<scalar,2> scalar2Type;
|
||||
@ -307,34 +314,91 @@ int main(int argc, char *argv[])
|
||||
List<FixedList<label, 2>> list6{{0, 1}, {2, 3}};
|
||||
Info<< "list6: " << list6 << nl;
|
||||
|
||||
if (Pstream::parRun())
|
||||
if (UPstream::parRun())
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
for (const int proci : Pstream::subProcs())
|
||||
{
|
||||
IPstream fromSlave(Pstream::commsTypes::blocking, proci);
|
||||
FixedList<label, 2> list3(fromSlave);
|
||||
// Fixed buffer would also work, but want to test using UList
|
||||
List<labelPair> buffer;
|
||||
|
||||
Serr<< "Receiving from " << proci
|
||||
<< " : " << list3 << endl;
|
||||
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
|
||||
requests.reserve(numProcs);
|
||||
|
||||
buffer.resize(numProcs);
|
||||
buffer[0] = labelPair(0, UPstream::myProcNo());
|
||||
|
||||
for (const int proci : UPstream::subProcs())
|
||||
{
|
||||
UIPstream::read
|
||||
(
|
||||
requests.emplace_back(),
|
||||
proci,
|
||||
buffer.slice(proci, 1)
|
||||
);
|
||||
}
|
||||
|
||||
if (requests.size() > 1)
|
||||
{
|
||||
// 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
|
||||
{
|
||||
Perr<< "Sending to master" << endl;
|
||||
buffer.resize(1);
|
||||
buffer[0] = labelPair(0, UPstream::myProcNo());
|
||||
|
||||
OPstream toMaster
|
||||
Perr<< "Sending to master: " << buffer << endl;
|
||||
|
||||
// Capture the request and transfer to the global list
|
||||
// (for testing)
|
||||
|
||||
UOPstream::write
|
||||
(
|
||||
Pstream::commsTypes::blocking,
|
||||
Pstream::masterNo()
|
||||
singleRequest,
|
||||
UPstream::masterNo(),
|
||||
buffer.slice(0, 1) // OK
|
||||
/// buffer // Also OK
|
||||
);
|
||||
|
||||
FixedList<label, 2> list3;
|
||||
list3[0] = 0;
|
||||
list3[1] = Pstream::myProcNo();
|
||||
toMaster << list3;
|
||||
// if (singleRequest.good())
|
||||
{
|
||||
UPstream::addRequest(singleRequest);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2020 OpenCFD Ltd.
|
||||
Copyright (C) 2020-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -109,7 +109,11 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setConstantRunTimeDictionaryIO.H"
|
||||
|
||||
IOdictionary propsDict(dictIO);
|
||||
#if (OPENFOAM > 2212)
|
||||
dictionary propsDict(IOdictionary::readContents(dictIO));
|
||||
#else
|
||||
dictionary propsDict(static_cast<dictionary&&>(IOdictionary(dictIO)));
|
||||
#endif
|
||||
|
||||
const scalarField xvals(propsDict.lookup("x"));
|
||||
|
||||
@ -132,7 +136,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (nameFilter(f))
|
||||
{
|
||||
functionNames.append(f);
|
||||
functionNames.push_back(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -140,7 +144,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
for (label argi=1; argi < args.size(); ++argi)
|
||||
{
|
||||
functionNames.append(args[argi]);
|
||||
functionNames.push_back(args[argi]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -25,11 +25,11 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Some simple HashSet tests
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "hashedWordList.H"
|
||||
#include "nil.H"
|
||||
#include "HashOps.H"
|
||||
#include "HashSet.H"
|
||||
#include "Map.H"
|
||||
@ -73,6 +73,22 @@ void printMinMax(const HashSet<Key, Hash>& set)
|
||||
}
|
||||
|
||||
|
||||
template<class Key, class Hash>
|
||||
void printHashSet(const HashSet<Key, Hash>& table)
|
||||
{
|
||||
Info<< table.size() << '(' << nl;
|
||||
|
||||
for (const auto& key : table.sortedToc())
|
||||
{
|
||||
const auto iter = table.find(key);
|
||||
|
||||
Info<< " " << key << " : " << Foam::name(&(iter.key())) << nl;
|
||||
}
|
||||
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
@ -84,33 +100,33 @@ int main(int argc, char *argv[])
|
||||
<< typeid(HashSet<label>::hasher).name() << nl << nl;
|
||||
|
||||
hashedWordList words
|
||||
{
|
||||
({
|
||||
"abc",
|
||||
"def",
|
||||
"ghi"
|
||||
};
|
||||
});
|
||||
words = { "def", "ghi", "xy", "all", "end", "all" };
|
||||
|
||||
wordHashSet setA
|
||||
{
|
||||
({
|
||||
"xx",
|
||||
"yy",
|
||||
"zz"
|
||||
};
|
||||
});
|
||||
|
||||
setA = { "kjhk", "kjhk2", "abced" };
|
||||
|
||||
HashTable<label> tableA
|
||||
{
|
||||
({
|
||||
{ "value1", 1 },
|
||||
{ "value2", 2 },
|
||||
{ "value3", 3 }
|
||||
};
|
||||
});
|
||||
|
||||
HashTable<nil> tableB;
|
||||
tableB.insert("value4", nil());
|
||||
tableB.insert("value5", nil());
|
||||
tableB.insert("value6", nil());
|
||||
HashTable<Foam::zero> tableB;
|
||||
tableB.emplace("value4");
|
||||
tableB.emplace("value5");
|
||||
tableB.emplace("value6");
|
||||
|
||||
Info<< "tableA keys: "; tableA.writeKeys(Info) << endl;
|
||||
|
||||
@ -123,11 +139,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Map<label> mapA
|
||||
{
|
||||
({
|
||||
{ 1, 1 },
|
||||
{ 2, 2 },
|
||||
{ 3, 3 }
|
||||
};
|
||||
});
|
||||
mapA.set(4, 4);
|
||||
|
||||
Info<< "hashedWordList: " << words << nl
|
||||
@ -169,7 +185,7 @@ int main(int argc, char *argv[])
|
||||
Info<< wordHashSet(setA) << endl;
|
||||
Info<< "create from HashTable<T>: ";
|
||||
Info<< wordHashSet(tableA) << endl;
|
||||
Info<< "create from HashTable<nil>: ";
|
||||
Info<< "create from HashTable<zero>: ";
|
||||
Info<< wordHashSet(tableB) << endl;
|
||||
|
||||
Info<< "create from Map<label>: ";
|
||||
@ -185,9 +201,9 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
labelHashSet setB
|
||||
{
|
||||
({
|
||||
1, 11, 42
|
||||
};
|
||||
});
|
||||
|
||||
Info<<"Set with min/max:" << minMax(setB)
|
||||
<< " min:" << min(setB) << " max:" << max(setB) << nl;
|
||||
@ -309,6 +325,26 @@ int main(int argc, char *argv[])
|
||||
Info<< "setA1: " << setA1 << nl
|
||||
<< "setB1: " << setB1 << nl;
|
||||
|
||||
|
||||
// Merging
|
||||
{
|
||||
wordHashSet set0({ "abc", "kjhk", "kjhk2" });
|
||||
wordHashSet set1({ "abc", "def", "ghi", "jkl" });
|
||||
|
||||
Info<< nl
|
||||
<< "Set0" << nl;
|
||||
printHashSet(set0);
|
||||
Info<< "Set1" << nl;
|
||||
printHashSet(set1);
|
||||
|
||||
set1.merge(set0);
|
||||
|
||||
Info<< "merged 0" << nl;
|
||||
printHashSet(set0);
|
||||
Info<< "merged 1" << nl;
|
||||
printHashSet(set1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -79,26 +79,56 @@ public:
|
||||
};
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void printTable(const HashPtrTable<T, Key, Hash>& table)
|
||||
{
|
||||
Info<< table.size() << '(' << nl;
|
||||
|
||||
for (const auto& key : table.sortedToc())
|
||||
{
|
||||
const auto iter = table.find(key);
|
||||
|
||||
Info
|
||||
<< " " << iter.key() << " (" << Foam::name(&(iter.key()))
|
||||
<< ") : ";
|
||||
|
||||
if (iter.val())
|
||||
{
|
||||
Info<< *(iter.val());
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "nullptr";
|
||||
}
|
||||
|
||||
Info<< " (" << Foam::name(iter.val()) << ")" << nl;;
|
||||
}
|
||||
|
||||
Info<< ')' << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HashTable<label, Foam::string> table1
|
||||
{
|
||||
HashTable<Label, Foam::string> table0
|
||||
({
|
||||
{"abc", 123},
|
||||
{"kjhk", 10},
|
||||
{"kjhk2", 12}
|
||||
};
|
||||
});
|
||||
|
||||
Info<< "table1: " << table1 << nl
|
||||
<< "toc: " << flatOutput(table1.toc()) << nl;
|
||||
Info<< "table0: " << table0 << nl
|
||||
<< "toc: " << flatOutput(table0.toc()) << nl;
|
||||
|
||||
HashTable<label, label, Hash<label>> table2
|
||||
{
|
||||
({
|
||||
{3, 10},
|
||||
{5, 12},
|
||||
{7, 16}
|
||||
};
|
||||
});
|
||||
|
||||
Info<< "table2: " << table2 << nl
|
||||
<< "toc: " << flatOutput(table2.toc()) << nl;
|
||||
@ -127,7 +157,7 @@ int main(int argc, char *argv[])
|
||||
table1.insert("ghi", 15);
|
||||
table1.insert("jkl", 20);
|
||||
|
||||
Info<< nl << "Table toc: " << flatOutput(table1.toc()) << nl;
|
||||
Info<< nl << "Table toc: " << flatOutput(table1.sortedToc()) << nl;
|
||||
|
||||
for (const word k : { "abc" })
|
||||
{
|
||||
@ -153,16 +183,30 @@ int main(int argc, char *argv[])
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Table0: " << flatOutput(table0.sortedToc()) << nl
|
||||
<< "Table1: " << flatOutput(table1.sortedToc()) << nl;
|
||||
|
||||
table1.merge(table0);
|
||||
|
||||
Info<< "merged 0: " << flatOutput(table0.sortedToc()) << nl
|
||||
<< "merged 1: " << flatOutput(table1.sortedToc()) << nl;
|
||||
}
|
||||
|
||||
{
|
||||
HashPtrTable<Label> ptable0(0);
|
||||
ptable0.emplace("abc", 123),
|
||||
ptable0.emplace("kjhk", 10);
|
||||
ptable0.emplace("kjhk2", 12);
|
||||
|
||||
HashPtrTable<Label> ptable1(0);
|
||||
ptable1.insert("abc", autoPtr<Label>::New(5));
|
||||
ptable1.insert("def", autoPtr<Label>::New(10));
|
||||
ptable1.insert("ghi", autoPtr<Label>::New(15));
|
||||
ptable1.insert("jkl", autoPtr<Label>::New(20));
|
||||
ptable1.emplace("def", 10);
|
||||
ptable1.emplace("ghi", 15);
|
||||
ptable1.emplace("jkl", 20);
|
||||
|
||||
Info<< nl << "PtrTable toc: " << flatOutput(ptable1.toc()) << nl;
|
||||
Info<< nl << "PtrTable toc: " << flatOutput(ptable1.sortedToc()) << nl;
|
||||
|
||||
for (const word k : { "abc" })
|
||||
{
|
||||
@ -242,6 +286,20 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Table0" << nl;
|
||||
printTable(ptable0);
|
||||
|
||||
Info<< "Table1" << nl;
|
||||
printTable(ptable1);
|
||||
|
||||
ptable1.merge(ptable0);
|
||||
|
||||
Info<< "merged 0" << nl;
|
||||
printTable(ptable0);
|
||||
Info<< "merged 1" << nl;
|
||||
printTable(ptable1);
|
||||
|
||||
Info<< nl << "Ending scope" << nl;
|
||||
}
|
||||
|
||||
@ -277,6 +335,28 @@ int main(int argc, char *argv[])
|
||||
Info<< "got with " << (*iter).size() << nl;
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "Test (DIY) insert_or_assign" << nl;
|
||||
|
||||
label nKeys = 0;
|
||||
|
||||
for (const auto& key : { "abc", "foo", "mno", "xyz" })
|
||||
{
|
||||
Info<< key;
|
||||
if (ltable1.contains(key))
|
||||
{
|
||||
Info<< " : " << ltable1[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " : n/a";
|
||||
}
|
||||
|
||||
/// ltable1.insert_or_assign(key, identity(++nKeys));
|
||||
ltable1(key) = identity(++nKeys);
|
||||
|
||||
Info<< " --> " << ltable1[key] << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -46,35 +46,39 @@ using namespace Foam;
|
||||
template<class Type>
|
||||
void doWrite(const IOobject& io, const label sz)
|
||||
{
|
||||
const bool writeOnProc = (sz > 0);
|
||||
|
||||
IOField<Type> fld(io, sz);
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = i + 1000.25 + (0.25 * i);
|
||||
}
|
||||
Pout<< "writing:" << fld << endl;
|
||||
fld.write(sz > 0);
|
||||
fld.write(writeOnProc);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void doWrite<bool>(const IOobject& io, const label sz)
|
||||
{
|
||||
const bool writeOnProc = (sz > 0);
|
||||
|
||||
IOField<bool> fld(io, sz);
|
||||
forAll(fld, i)
|
||||
{
|
||||
fld[i] = i % 2;
|
||||
}
|
||||
Pout<< "writing:" << fld << endl;
|
||||
fld.write(sz > 0);
|
||||
fld.write(writeOnProc);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void doRead(const IOobject& io, const label sz)
|
||||
{
|
||||
bool valid = (sz > 0);
|
||||
Pout<< " valid:" << valid << endl;
|
||||
IOField<Type> fld(io, valid);
|
||||
const bool readOnProc = (sz > 0);
|
||||
Pout<< " readOnProc:" << readOnProc << endl;
|
||||
IOField<Type> fld(io, readOnProc);
|
||||
Pout<< " wanted:" << sz << " actually read:" << fld.size() << endl;
|
||||
|
||||
if (fld.size() != sz)
|
||||
|
||||
@ -334,7 +334,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "==target==" << nl; reportDetail(objects);
|
||||
Info<< "==source==" << nl; reportDetail(other);
|
||||
|
||||
objects.merge(std::move(other));
|
||||
objects.merge(other);
|
||||
Info<< nl << "After merge" << nl;
|
||||
|
||||
Info<< "==target==" << nl; reportDetail(objects);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -81,7 +81,7 @@ namespace ListPolicy
|
||||
{
|
||||
|
||||
// Override on a per-type basis
|
||||
template<> struct short_length<short> : std::integral_constant<short,20> {};
|
||||
template<> struct short_length<short> : std::integral_constant<int,20> {};
|
||||
|
||||
} // End namespace ListPolicy
|
||||
} // End namespace Detail
|
||||
@ -365,6 +365,12 @@ int main(int argc, char *argv[])
|
||||
Info<<"assigned identity in range:" << subset
|
||||
<< "=> " << flatOutput(longLabelList) << nl;
|
||||
|
||||
// Assign values in iterator range
|
||||
std::iota(longLabelList.begin(15), longLabelList.begin(50), 115);
|
||||
|
||||
Info<<"assigned values in iterator range "
|
||||
<< "=> " << flatOutput(longLabelList) << nl;
|
||||
|
||||
labelList someList(identity(24));
|
||||
|
||||
longLabelList.slice(subset) =
|
||||
@ -410,8 +416,20 @@ int main(int argc, char *argv[])
|
||||
longLabelList.slice({5,-5}) = 42;
|
||||
longLabelList.slice({21,100}) = 42;
|
||||
|
||||
//Good: does not compile
|
||||
longLabelList.slice(labelRange(20,50)) = constLabelList;
|
||||
#if 0
|
||||
// Compiles, but is runtime abort!
|
||||
const bool oldThrowingError = FatalError.throwing(true);
|
||||
try
|
||||
{
|
||||
longLabelList.slice(labelRange(20,50)) = constLabelList;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
{
|
||||
Info<< "Caught FatalError "
|
||||
<< err << nl << endl;
|
||||
}
|
||||
FatalError.throwing(oldThrowingError);
|
||||
#endif
|
||||
|
||||
//Good: does not compile
|
||||
// longLabelList[labelRange(20,50)] = fixedLabelList;
|
||||
|
||||
@ -155,7 +155,7 @@ int main(int argc, char *argv[])
|
||||
<< IndirectList<label>::subset_if(test6, evenNonZero) << nl
|
||||
<< endl;
|
||||
|
||||
test6.append(identity(13, 12));
|
||||
test6.push_back(identity(13, 12));
|
||||
|
||||
Info<< "Randomized: " << flatOutput(test6) << endl;
|
||||
inplaceUniqueSort(test6);
|
||||
|
||||
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< nl << "list: " << flatOutput(list) << nl << endl;
|
||||
|
||||
list.remove();
|
||||
list.pop_back();
|
||||
Info<<"remove = " << flatOutput(list) << nl;
|
||||
|
||||
{
|
||||
|
||||
@ -52,13 +52,13 @@ int main(int argc, char *argv[])
|
||||
// Same, but with non-const access
|
||||
// Map<bool>::iterator map1Iter = map1.find(5);
|
||||
|
||||
if (!map1Iter.found()) // same as (map1Iter == map1.end())
|
||||
if (!map1Iter.good())
|
||||
{
|
||||
Info<< "not found" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "5 is " << *map1Iter << endl;
|
||||
Info<< "5 is " << map1Iter.val() << endl;
|
||||
}
|
||||
|
||||
// Repeat with std::map
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -71,16 +72,9 @@ int main(int argc, char *argv[])
|
||||
label edgeI = 0;
|
||||
Info<< "Starting walk on edge " << edgeI << endl;
|
||||
|
||||
initialEdges.append(edgeI);
|
||||
initialEdges.push_back(edgeI);
|
||||
const edge& e = patch.edges()[edgeI];
|
||||
initialEdgesInfo.append
|
||||
(
|
||||
patchEdgeFaceInfo
|
||||
(
|
||||
e.centre(patch.localPoints()),
|
||||
0.0
|
||||
)
|
||||
);
|
||||
initialEdgesInfo.emplace_back(e.centre(patch.localPoints()), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -92,8 +92,8 @@ int main(int argc, char *argv[])
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE,
|
||||
false
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::NO_REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimensionedVector(Zero)
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / O peration | Version: v2306 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -268,10 +268,7 @@ Ostream& report
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
PtrList<Scalar> list1(10);
|
||||
PtrList<Scalar> list2(15);
|
||||
PtrList<Scalar> listApp;
|
||||
|
||||
#if 0
|
||||
{
|
||||
DLPtrList<Scalar> llist1;
|
||||
llist1.push_front(new Scalar(100));
|
||||
@ -301,8 +298,10 @@ int main(int argc, char *argv[])
|
||||
<< "for-: " << it << endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Same but as SLPtrList
|
||||
#if 0
|
||||
{
|
||||
SLPtrList<Scalar> llist1;
|
||||
llist1.push_front(new Scalar(100));
|
||||
@ -318,24 +317,43 @@ int main(int argc, char *argv[])
|
||||
PtrList<Scalar> list1b(llist1);
|
||||
Info<< list1b << endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
PtrList<Scalar> list1(10);
|
||||
|
||||
forAll(list1, i)
|
||||
{
|
||||
list1.set(i, new Scalar(1.3*i));
|
||||
}
|
||||
{
|
||||
auto ptr = autoPtr<Scalar>::New(10);
|
||||
|
||||
Info<< "add: " << Foam::name(ptr.get());
|
||||
list1.set(0, ptr);
|
||||
|
||||
Info<< "ptrlist: " << Foam::name(list1.get(0)) << nl;
|
||||
Info<< "now: " << Foam::name(ptr.get()) << nl;
|
||||
|
||||
ptr = autoPtr<Scalar>::New(20);
|
||||
|
||||
list1.append(ptr);
|
||||
// Delete method: list1.push_back(ptr);
|
||||
// list1.push_back(std::move(ptr));
|
||||
}
|
||||
|
||||
|
||||
PtrList<Scalar> list2(15);
|
||||
Info<< "Emplace set " << list2.size() << " values" << nl;
|
||||
forAll(list2, i)
|
||||
{
|
||||
list2.emplace(i, (10 + 1.3*i));
|
||||
}
|
||||
|
||||
PtrList<Scalar> listApp;
|
||||
for (label i = 0; i < 5; ++i)
|
||||
{
|
||||
listApp.append(new Scalar(1.3*i));
|
||||
listApp.emplace_back(1.3*i);
|
||||
}
|
||||
listApp.emplace_back(100);
|
||||
|
||||
|
||||
Info<< nl
|
||||
<< "list1: " << list1 << nl
|
||||
@ -353,7 +371,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (old)
|
||||
{
|
||||
ptrs.append(old.release());
|
||||
ptrs.push_back(old.release());
|
||||
}
|
||||
}
|
||||
|
||||
@ -377,6 +395,24 @@ int main(int argc, char *argv[])
|
||||
list1.set(i, nullptr);
|
||||
}
|
||||
|
||||
{
|
||||
Info<< "range-for of list (" << list1.count() << '/'
|
||||
<< list1.size() << ") non-null entries" << nl
|
||||
<< "(" << nl;
|
||||
for (const auto& item : list1)
|
||||
{
|
||||
Info<< " " << item << nl;
|
||||
}
|
||||
Info<< ")" << nl;
|
||||
}
|
||||
{
|
||||
Info<< "iterate on non-null:" << endl;
|
||||
forAllConstIters(list1, iter)
|
||||
{
|
||||
Info<< " " << iter.key() << " : " << iter.val() << nl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "release some items:" << endl;
|
||||
|
||||
for (label i = -2; i < 5; i++)
|
||||
@ -459,8 +495,8 @@ int main(int argc, char *argv[])
|
||||
printAddr(Info, dynlist1b);
|
||||
printAddr(Info, dynlist1c);
|
||||
|
||||
dynlist1d.append(std::move(dynlist1b));
|
||||
dynlist1d.append(std::move(dynlist1c));
|
||||
dynlist1d.push_back(std::move(dynlist1b));
|
||||
dynlist1d.push_back(std::move(dynlist1c));
|
||||
|
||||
Info<< "result:" << nl;
|
||||
print(Info, dynlist1d);
|
||||
@ -477,8 +513,8 @@ int main(int argc, char *argv[])
|
||||
printAddr(Info, list1b);
|
||||
printAddr(Info, list1c);
|
||||
|
||||
list1d.append(std::move(list1b));
|
||||
list1d.append(std::move(list1c));
|
||||
list1d.push_back(std::move(list1b));
|
||||
list1d.push_back(std::move(list1c));
|
||||
|
||||
Info<< "result:" << nl;
|
||||
print(Info, list1d);
|
||||
@ -523,7 +559,7 @@ int main(int argc, char *argv[])
|
||||
printAddr(Info, ulist1);
|
||||
Info<< nl;
|
||||
|
||||
ulist1c.append(std::move(ulist1b));
|
||||
ulist1c.push_back(std::move(ulist1b));
|
||||
|
||||
Info<< "UPtrList append/append:";
|
||||
printAddr(Info, ulist1c);
|
||||
@ -564,6 +600,7 @@ int main(int argc, char *argv[])
|
||||
<< "ulist2: " << ulist2 << nl;
|
||||
|
||||
// Test iterator random access
|
||||
#if (OPENFOAM <= 2212)
|
||||
{
|
||||
auto iter1 = ulist1.begin();
|
||||
auto iter2 = iter1 + 3;
|
||||
@ -578,6 +615,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "*" << (*iter1).value() << nl;
|
||||
Info<< "()" << iter1().value() << nl;
|
||||
}
|
||||
#endif
|
||||
|
||||
PtrList<plane> planes;
|
||||
planes.emplace_back(vector::one, vector::one);
|
||||
@ -596,12 +634,14 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
dynPlanes.emplace_back(vector::one, vector::one);
|
||||
dynPlanes.emplace_back(vector(1,2,3), vector::one);
|
||||
dynPlanes.append(nullptr);
|
||||
dynPlanes.push_back(nullptr);
|
||||
|
||||
dynPlanes.set(6, new plane(vector(2,2,1), vector::one));
|
||||
dynPlanes.set(10, new plane(vector(4,5,6), vector::one));
|
||||
|
||||
dynPlanes.emplace(12, vector(3,2,1), vector::one);
|
||||
Info<< "emplaced :"
|
||||
<< dynPlanes.emplace(12, vector(3,2,1), vector::one) << endl;
|
||||
|
||||
dynPlanes.emplace_back(Zero, vector::one);
|
||||
}
|
||||
|
||||
@ -619,10 +659,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "now append again" << endl;
|
||||
{
|
||||
dynPlanes.append(new plane(vector::one, vector::one));
|
||||
dynPlanes.append(new plane(vector(1,2,3), vector::one));
|
||||
dynPlanes.emplace_back(vector::one, vector::one);
|
||||
dynPlanes.emplace_back(vector(1,2,3), vector::one);
|
||||
|
||||
dynPlanes.set(5, new plane(vector(2,2,1), vector::one));
|
||||
dynPlanes.emplace(5, vector(2,2,1), vector::one);
|
||||
}
|
||||
|
||||
report(Info, dynPlanes, true);
|
||||
@ -658,12 +698,12 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
PtrDynList<plane> dynPlanes2;
|
||||
|
||||
dynPlanes2.append(new plane(vector::one, vector::one));
|
||||
dynPlanes2.append(new plane(vector(1,2,3), vector::one));
|
||||
dynPlanes2.append(nullptr);
|
||||
dynPlanes2.emplace_back(vector::one, vector::one);
|
||||
dynPlanes2.emplace_back(vector(1,2,3), vector::one);
|
||||
dynPlanes2.push_back(nullptr);
|
||||
|
||||
dynPlanes2.set(6, new plane(vector(2,2,1), vector::one));
|
||||
dynPlanes2.set(10, new plane(Zero, vector::one));
|
||||
dynPlanes2.emplace(6, vector(2,2,1), vector::one);
|
||||
dynPlanes2.emplace(10, Zero, vector::one);
|
||||
|
||||
labelList order;
|
||||
sortedOrder(dynPlanes2, order);
|
||||
@ -701,7 +741,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "Append" << endl;
|
||||
report(Info, dynPlanes2, false);
|
||||
|
||||
dynPlanes.append(std::move(dynPlanes2));
|
||||
dynPlanes.push_back(std::move(dynPlanes2));
|
||||
|
||||
Info<< "Result" << endl;
|
||||
report(Info, dynPlanes, false);
|
||||
|
||||
@ -370,7 +370,7 @@ void test_global_funcs(Type)
|
||||
Type(126)
|
||||
)
|
||||
);
|
||||
cmp(" Square of Frobenius norm = ", magSqr(sT), Type(205));
|
||||
cmp(" Square of Frobenius norm = ", magSqr(sT), scalar(205));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user