Compare commits

..

12 Commits

Author SHA1 Message Date
5aadc3a03d CONFIG: bump patch level (240625) 2024-06-26 12:19:02 +02:00
956fb4ca3a BUG: Nastran reading of free format truncates last field (fixes #3189)
- the old logic relied on the presence/absence of a comma to decide
  whether to parse as fixed or free format. This logic is faulty when
  handling the final (trailing) entry and will generally lead to the
  last field being truncated when read in.
  Now the caller decides on fixed vs free.

FIX: inconsistent Nastran surface output format

- use FREE format by default. Previously had an odd mix of SHORT
  format when created without options and LONG format (as default)
  when created with format options.
2024-06-26 12:19:02 +02:00
905d63357c BUG: STL: cannot handle files > 2Gb. Fixes #3171 2024-05-22 13:21:02 +01:00
0177b762c0 BUG: SlicedGeometricField, slices into field instead of shallow copy (#3080)
- regression introduced by e98acdc4fc

  Affected versions: (v2206, v2212, v2306, v2312)
2024-01-19 18:22:37 +01:00
308615e63a COMP: g++11: suppress optimisation. See #3024 2024-01-19 18:20:07 +01:00
2999c15f77 BUG: ThermoSurfaceFilm: reintroduce energy to film sources (fixes #2996) 2023-10-11 11:27:48 +01:00
3d8a1c7f63 BUG: snappyHexMesh: correct oppositeness checking. Fixes #2971 2023-09-07 15:08:39 +01:00
bf14272826 BUG: mapFields: incorrect patches. Fixes #2944. 2023-08-30 16:35:51 +02:00
095c9bc45b BUG: expressions rand() ignores objectRegistry timeIndex (fixes #2923) 2023-06-26 17:53:31 +02:00
20c7f0970d BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)
- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
2023-06-20 09:16:12 +02:00
fd1661ae15 TUT: scalarTransport: avoid excessive number of output directories (fixes #2806) 2023-06-19 09:08:27 +01:00
70874860b9 CONFIG: bump patch level for maintenance-v2212 2023-06-14 14:57:29 +02:00
11775 changed files with 54224 additions and 86294 deletions

View File

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

View File

@ -96,12 +96,10 @@ echo " ${WM_PROJECT_DIR##*/}"
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo
# 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 " 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"
echo
echo ========================================

View File

@ -5,22 +5,17 @@ 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
@ -55,11 +50,8 @@ 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

View File

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

View File

@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
If OpenFOAM has already been compiled on your system, simply source
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
For example, for the OpenFOAM-v2306 version:
For example, for the OpenFOAM-v2212 version:
```
source /installation/path/OpenFOAM-v2306/etc/bashrc
source /installation/path/OpenFOAM-v2212/etc/bashrc
```
## Compiling OpenFOAM
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
to the OpenFOAM directory. For example,
```
/path/parent
|-- OpenFOAM-v2306
\-- ThirdParty-v2306
|-- OpenFOAM-v2212
\-- ThirdParty-v2212
```
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-sandbox2306, etc..
directory name, e.g. openfoam-sandbox2212, 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*, `v2306-myCustom`,
* allows for an updated value of VERSION, *eg*, `v2212-myCustom`,
without requiring a renamed ThirdParty. The API value would still
be `2306` and the original `ThirdParty-v2306/` would be found.
be `2212` and the original `ThirdParty-v2212/` would be found.
4. PREFIX/ThirdParty-API
* same as the previous example, but using an unadorned API value.
5. PREFIX/ThirdParty-common

View File

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

View File

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

View File

@ -83,7 +83,6 @@ 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
@ -118,12 +117,6 @@ int main(int argc, char *argv[])
"Initialise U boundary conditions"
);
argList::addBoolOption
(
"writephi",
"Write the final volumetric flux field"
);
argList::addBoolOption
(
"writePhi",
@ -142,8 +135,6 @@ int main(int argc, char *argv[])
"Execute functionObjects"
);
#include "addRegionOption.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createNamedDynamicFvMesh.H"
@ -203,16 +194,11 @@ int main(int argc, char *argv[])
<< endl;
}
// Write U
// Write U and phi
U.write();
phi.write();
// Optionally write the volumetric flux, phi
if (args.found("writephi"))
{
phi.write();
}
// Optionally write velocity potential, Phi
// Optionally write Phi
if (args.found("writePhi"))
{
Phi.write();

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2019-2020,2023 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -132,11 +132,6 @@ 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

View File

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

View File

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

View File

@ -12,7 +12,7 @@ Info<< "Creating base fields for time " << runTime.timeName() << endl;
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
false
),
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,
IOobject::NO_REGISTER
false
),
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,
IOobject::NO_REGISTER
false
),
mesh,
dimensionedScalar("T", dimTemperature, T0)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,6 @@ 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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,10 +89,17 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
return;
}
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");
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");
operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));
@ -102,8 +109,8 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
void Foam::adjointOutletPressureFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
fvPatchField<scalar>::writeValueEntry(os);
fvPatchScalarField::write(os);
writeEntry("value", os);
}

View File

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

View File

@ -24,7 +24,7 @@ if (mesh.changing())
wordList pcorrTypes
(
p.boundaryField().size(),
fvPatchFieldBase::zeroGradientType()
zeroGradientFvPatchScalarField::typeName
);
// 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.push_back(refCells[zoneId]);
validCells.append(refCells[zoneId]);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -167,10 +167,20 @@ 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_/clamp(mixture_.alpha2(), scalarMinMax(SMALL, 1))),
-(mDote_/clamp(mixture_.alpha1(), scalarMinMax(SMALL, 1)))
(mDotc_/(limitedAlpha2 + SMALL)),
-(mDote_/(limitedAlpha1 + SMALL))
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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(clamp(alpha1_, zero_one{}));
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
return Pair<tmp<volScalarField>>
(

View File

@ -99,7 +99,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff
const volScalarField& p
) const
{
volScalarField limitedAlpha1(clamp(alpha1_, zero_one{}));
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
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(clamp(alpha1_, zero_one{}));
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
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(clamp(alpha1_, zero_one{}));
volScalarField limitedAlpha1(min(max(alpha1_, scalar(0)), scalar(1)));
volScalarField apCoeff(limitedAlpha1*pCoeff);
return Pair<tmp<volScalarField>>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,14 +27,6 @@ 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 * * * * * * * * * * * * * * //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2023 OpenCFD Ltd.
Copyright (C) 2017-2020 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.push_back({ 5, 6 });
dlA.append({ 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.push_back(lstA);
dlB.append(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.push_back(lstA);
dlB.append(lstA);
}
@ -220,8 +220,8 @@ int main(int argc, char *argv[])
for (label elemI=0; elemI < 5; ++elemI)
{
dlE1.push_back(4 - elemI);
dlE2.push_back(elemI);
dlE1.append(4 - elemI);
dlE2.append(elemI);
}
printInfo("dlE2", dlE2, true);
@ -243,12 +243,9 @@ int main(int argc, char *argv[])
{
DynamicList<label> addr(10);
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;
addr.append(3);
addr.append(1);
addr.append(2);
forAll(dlE2, i)
{
@ -300,9 +297,9 @@ int main(int argc, char *argv[])
Info<< "test move-append with "
<< flatOutput(input1) << " and " << flatOutput(input2) << endl;
list2.push_back(std::move(list1));
list2.push_back(std::move(input1));
list2.push_back(std::move(input2));
list2.append(std::move(list1));
list2.append(std::move(input1));
list2.append(std::move(input2));
Info<< "result: " << flatOutput(list2) << nl
<< "inputs: " << flatOutput(list1) << " / "

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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