Compare commits
42 Commits
feature-ne
...
fix-2640-z
| Author | SHA1 | Date | |
|---|---|---|---|
| 3fe6ae6961 | |||
| d69ac516e8 | |||
| 9114e01de9 | |||
| a8f369fd2b | |||
| b5e6a42ded | |||
| b18a6675cb | |||
| 354767c694 | |||
| 88e1932145 | |||
| 945405c32d | |||
| 013f3cccc4 | |||
| 21e7ce8f42 | |||
| 94c7e180fb | |||
| 67b58c28c0 | |||
| db57c456f6 | |||
| 1b11e4b3ac | |||
| 5e0a23edd5 | |||
| d7bf2d400d | |||
| d9ab5d54ef | |||
| ec1d66d640 | |||
| 3b0af86448 | |||
| d009cb8bc1 | |||
| 1dafe5d393 | |||
| 225f548d2d | |||
| 6cb8337345 | |||
| 3d81dd6277 | |||
| 90c4ee7e12 | |||
| 5714a3606e | |||
| 0fabbcb404 | |||
| 5338e56c73 | |||
| 9f7cfa9419 | |||
| e15b103003 | |||
| c2af76337e | |||
| edc12c9ad9 | |||
| 25e874a4f0 | |||
| beea22b2f0 | |||
| 0624fb0181 | |||
| 941cd7fef4 | |||
| fd75d38757 | |||
| d5a973419a | |||
| ab6615c060 | |||
| b48fd4f38a | |||
| 2a406bbb25 |
@ -1,2 +1,2 @@
|
||||
api=2206
|
||||
api=2208
|
||||
patch=220907
|
||||
|
||||
@ -3,6 +3,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/overset/lnInclude \
|
||||
-I$(LIB_SRC)/overset/include/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
|
||||
@ -31,3 +31,25 @@
|
||||
Info<< "Reading diffusivity DT\n" << endl;
|
||||
|
||||
dimensionedScalar DT("DT", dimViscosity, transportProperties);
|
||||
|
||||
bool oversetPatchErrOutput =
|
||||
simple.dict().getOrDefault("oversetPatchErrOutput", false);
|
||||
|
||||
// Dummy phi for oversetPatchErrOutput
|
||||
tmp<surfaceScalarField> tdummyPhi;
|
||||
if (oversetPatchErrOutput)
|
||||
{
|
||||
tdummyPhi = tmp<surfaceScalarField>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dummyPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -58,6 +58,7 @@ Description
|
||||
#include "fvOptions.H"
|
||||
#include "simpleControl.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "oversetPatchPhiErr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -99,6 +100,11 @@ int main(int argc, char *argv[])
|
||||
fvOptions.constrain(TEqn);
|
||||
TEqn.solve();
|
||||
fvOptions.correct(T);
|
||||
|
||||
if (oversetPatchErrOutput)
|
||||
{
|
||||
oversetPatchPhiErr(TEqn, tdummyPhi.ref());
|
||||
}
|
||||
}
|
||||
|
||||
#include "write.H"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017 OpenCFD Ltd
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -149,7 +149,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
mesh.update();
|
||||
|
||||
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
|
||||
|
||||
// Since solver contains no time loop it would never execute
|
||||
// function objects so do it ourselves
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
bool ddtCorr
|
||||
(
|
||||
pimple.dict().getOrDefault("ddtCorr", true)
|
||||
);
|
||||
@ -69,6 +69,8 @@ mesh.setFluxRequired(p.name());
|
||||
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,7 +43,6 @@ Description
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "fluidThermo.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "bound.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "pressureControl.H"
|
||||
#include "CorrectPhi.H"
|
||||
@ -89,10 +88,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
|
||||
// Store divrhoU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
@ -128,7 +125,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
@ -137,52 +133,22 @@ int main(int argc, char *argv[])
|
||||
MRF.update();
|
||||
|
||||
#include "setCellMask.H"
|
||||
|
||||
const surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
rhoUf() *= faceMaskOld;
|
||||
|
||||
surfaceVectorField rhoUfint(fvc::interpolate(rho*U));
|
||||
|
||||
// Update Uf and phi on new C-I faces
|
||||
rhoUf() += (1-faceMaskOld)*rhoUfint;
|
||||
|
||||
// Update Uf boundary
|
||||
forAll(rhoUf().boundaryField(), patchI)
|
||||
{
|
||||
rhoUf().boundaryFieldRef()[patchI] =
|
||||
rhoUfint.boundaryField()[patchI];
|
||||
}
|
||||
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf();
|
||||
#include "setInterpolatedCells.H"
|
||||
#include "correctRhoPhiFaceMask.H"
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Corrects flux on separated regions
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Zero phi on current H-I
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
phi *= faceMask;
|
||||
U *= cellMask;
|
||||
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
|
||||
}
|
||||
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,17 +25,6 @@ surfaceScalarField phiHbyA
|
||||
fvc::interpolate(rho)*fvc::flux(HbyA)
|
||||
);
|
||||
|
||||
if (ddtCorr)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
|
||||
phiHbyA +=
|
||||
faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf));
|
||||
}
|
||||
|
||||
fvc::makeRelative(phiHbyA, rho, U);
|
||||
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
|
||||
|
||||
@ -134,8 +123,4 @@ if (thermo.dpdt())
|
||||
}
|
||||
}
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
phi *= faceMask;
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo =
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
@ -124,3 +124,6 @@ dimensionedScalar initialMass("initialMass", fvc::domainIntegrate(rho));
|
||||
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -50,6 +50,7 @@ Description
|
||||
#include "CorrectPhi.H"
|
||||
#include "cellCellStencilObject.H"
|
||||
#include "localMin.H"
|
||||
#include "oversetAdjustPhi.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -86,9 +87,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
#include "compressibleCourantNo.H"
|
||||
@ -128,45 +126,14 @@ int main(int argc, char *argv[])
|
||||
MRF.update();
|
||||
|
||||
#include "setCellMask.H"
|
||||
|
||||
const surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
rhoUf() *= faceMaskOld;
|
||||
|
||||
//fvc::correctRhoUf(rhoUfint, rho, U, phi);
|
||||
surfaceVectorField rhoUfint(fvc::interpolate(rho*U));
|
||||
|
||||
// Update Uf and phi on new C-I faces
|
||||
rhoUf() += (1-faceMaskOld)*rhoUfint;
|
||||
|
||||
// Update Uf boundary
|
||||
forAll(rhoUf().boundaryField(), patchI)
|
||||
{
|
||||
rhoUf().boundaryFieldRef()[patchI] =
|
||||
rhoUfint.boundaryField()[patchI];
|
||||
}
|
||||
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf();
|
||||
#include "setInterpolatedCells.H"
|
||||
#include "correctRhoPhiFaceMask.H"
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Zero phi on current H-I
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
phi *= faceMask;
|
||||
U *= cellMask;
|
||||
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
}
|
||||
|
||||
@ -21,17 +21,14 @@ surfaceScalarField phiHbyA
|
||||
fvc::flux(rho*HbyA) + phig
|
||||
);
|
||||
|
||||
if (ddtCorr)
|
||||
if (adjustFringe)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
|
||||
phiHbyA +=
|
||||
faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi));
|
||||
fvc::makeRelative(phiHbyA,rho, U);
|
||||
oversetAdjustPhi(phiHbyA, U);
|
||||
fvc::makeAbsolute(phiHbyA,rho, U);
|
||||
}
|
||||
|
||||
|
||||
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
@ -122,8 +119,4 @@ if (thermo.dpdt())
|
||||
}
|
||||
}
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
phi *= faceMask;
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo =
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,7 +37,10 @@ scalar meanCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask));
|
||||
surfaceScalarField phiMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask + interpolatedCells)
|
||||
);
|
||||
|
||||
scalarField sumPhi(fvc::surfaceSum(mag(phiMask*phi))().internalField());
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
MRF.correctBoundaryVelocity(U);
|
||||
|
||||
tmp<fvVectorMatrix> tUEqn
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
#include "createTimeControls.H"
|
||||
|
||||
bool correctPhi
|
||||
(
|
||||
pimple.dict().getOrDefault("correctPhi", false)
|
||||
);
|
||||
|
||||
bool checkMeshCourantNo
|
||||
(
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false)
|
||||
);
|
||||
|
||||
bool massFluxInterpolation
|
||||
(
|
||||
pimple.dict().getOrDefault("massFluxInterpolation", false)
|
||||
);
|
||||
|
||||
bool adjustFringe
|
||||
(
|
||||
pimple.dict().getOrDefault("oversetAdjustPhi", false)
|
||||
);
|
||||
|
||||
bool ddtCorr
|
||||
(
|
||||
pimple.dict().getOrDefault("ddtCorr", true)
|
||||
);
|
||||
@ -1,273 +0,0 @@
|
||||
// Interpolation used
|
||||
interpolationCellPoint<vector> UInterpolator(HbyA);
|
||||
|
||||
// Determine faces on outside of interpolated cells
|
||||
bitSet isOwnerInterpolatedFace(mesh.nInternalFaces());
|
||||
bitSet isNeiInterpolatedFace(mesh.nInternalFaces());
|
||||
|
||||
// Determine donor cells
|
||||
labelListList donorCell(mesh.nInternalFaces());
|
||||
|
||||
scalarListList weightCellCells(mesh.nInternalFaces());
|
||||
|
||||
// Interpolated HbyA faces
|
||||
vectorField UIntFaces(mesh.nInternalFaces(), Zero);
|
||||
|
||||
// Determine receptor neighbour cells
|
||||
labelList receptorNeigCell(mesh.nInternalFaces(), -1);
|
||||
|
||||
{
|
||||
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
||||
const labelList& cellTypes = overlap.cellTypes();
|
||||
const labelIOList& zoneID = overlap.zoneID();
|
||||
|
||||
label nZones = gMax(zoneID)+1;
|
||||
PtrList<fvMeshSubset> meshParts(nZones);
|
||||
labelList nCellsPerZone(nZones, Zero);
|
||||
|
||||
// A mesh subset for each zone
|
||||
forAll(meshParts, zonei)
|
||||
{
|
||||
meshParts.set
|
||||
(
|
||||
zonei,
|
||||
// Select cells where the zoneID == zonei
|
||||
new fvMeshSubset(mesh, zonei, zoneID)
|
||||
);
|
||||
}
|
||||
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
label ownType = cellTypes[mesh.faceOwner()[faceI]];
|
||||
label neiType = cellTypes[mesh.faceNeighbour()[faceI]];
|
||||
if
|
||||
(
|
||||
ownType == cellCellStencil::INTERPOLATED
|
||||
&& neiType == cellCellStencil::CALCULATED
|
||||
)
|
||||
{
|
||||
isOwnerInterpolatedFace.set(faceI);
|
||||
|
||||
const vector& fc = mesh.faceCentres()[faceI];
|
||||
|
||||
for (label zoneI = 0; zoneI < nZones; zoneI++)
|
||||
{
|
||||
if (zoneI != zoneID[mesh.faceOwner()[faceI]])
|
||||
{
|
||||
const fvMesh& partMesh = meshParts[zoneI].subMesh();
|
||||
const labelList& cellMap = meshParts[zoneI].cellMap();
|
||||
label cellI = partMesh.findCell(fc);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
// Determine weights
|
||||
labelList stencil(partMesh.cellCells()[cellI]);
|
||||
|
||||
stencil.append(cellI);
|
||||
|
||||
label st = stencil.size();
|
||||
|
||||
donorCell[faceI].setSize(st);
|
||||
|
||||
weightCellCells[faceI].setSize(st);
|
||||
|
||||
scalarField weights(st);
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
scalar d = mag
|
||||
(
|
||||
partMesh.cellCentres()[stencil[i]]
|
||||
- fc
|
||||
);
|
||||
weights[i] = 1.0/d;
|
||||
donorCell[faceI][i] = cellMap[stencil[i]];
|
||||
}
|
||||
weights /= sum(weights);
|
||||
|
||||
weightCellCells[faceI] = weights;
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
UIntFaces[faceI] +=
|
||||
weightCellCells[faceI][i]
|
||||
*UInterpolator.interpolate
|
||||
(
|
||||
fc,
|
||||
donorCell[faceI][i]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
receptorNeigCell[faceI] = mesh.faceNeighbour()[faceI];
|
||||
}
|
||||
else if
|
||||
(
|
||||
ownType == cellCellStencil::CALCULATED
|
||||
&& neiType == cellCellStencil::INTERPOLATED
|
||||
)
|
||||
{
|
||||
isNeiInterpolatedFace.set(faceI);
|
||||
|
||||
const vector& fc = mesh.faceCentres()[faceI];
|
||||
for (label zoneI = 0; zoneI < nZones; zoneI++)
|
||||
{
|
||||
if (zoneI != zoneID[mesh.faceNeighbour()[faceI]])
|
||||
{
|
||||
const fvMesh& partMesh = meshParts[zoneI].subMesh();
|
||||
const labelList& cellMap = meshParts[zoneI].cellMap();
|
||||
label cellI = partMesh.findCell(fc);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
// Determine weights
|
||||
labelList stencil(partMesh.cellCells()[cellI]);
|
||||
|
||||
stencil.append(cellI);
|
||||
|
||||
label st = stencil.size();
|
||||
|
||||
donorCell[faceI].setSize(st);
|
||||
|
||||
weightCellCells[faceI].setSize(st);
|
||||
|
||||
scalarField weights(st);
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
scalar d = mag
|
||||
(
|
||||
partMesh.cellCentres()[stencil[i]]
|
||||
- fc
|
||||
);
|
||||
weights[i] = 1.0/d;
|
||||
donorCell[faceI][i] = cellMap[stencil[i]];
|
||||
}
|
||||
weights /= sum(weights);
|
||||
|
||||
weightCellCells[faceI] = weights;
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
UIntFaces[faceI] +=
|
||||
weightCellCells[faceI][i]
|
||||
*UInterpolator.interpolate
|
||||
(
|
||||
fc,
|
||||
donorCell[faceI][i]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
receptorNeigCell[faceI] = mesh.faceOwner()[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// contravariant U
|
||||
vectorField U1Contrav(mesh.nInternalFaces(), Zero);
|
||||
|
||||
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf());
|
||||
|
||||
forAll(isNeiInterpolatedFace, faceI)
|
||||
{
|
||||
label cellId = -1;
|
||||
if (isNeiInterpolatedFace.test(faceI))
|
||||
{
|
||||
cellId = mesh.faceNeighbour()[faceI];
|
||||
}
|
||||
else if (isOwnerInterpolatedFace.test(faceI))
|
||||
{
|
||||
cellId = mesh.faceOwner()[faceI];
|
||||
}
|
||||
|
||||
if (cellId != -1)
|
||||
{
|
||||
const vector& n = faceNormals[faceI];
|
||||
vector n1(Zero);
|
||||
|
||||
// 2-D cases
|
||||
if (mesh.nSolutionD() == 2)
|
||||
{
|
||||
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
|
||||
{
|
||||
if (mesh.geometricD()[cmpt] == -1)
|
||||
{
|
||||
switch (cmpt)
|
||||
{
|
||||
case vector::X:
|
||||
{
|
||||
n1 = vector(0, n.z(), -n.y());
|
||||
break;
|
||||
}
|
||||
|
||||
case vector::Y:
|
||||
{
|
||||
n1 = vector(n.z(), 0, -n.x());
|
||||
break;
|
||||
}
|
||||
|
||||
case vector::Z:
|
||||
{
|
||||
n1 = vector(n.y(), -n.x(), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mesh.nSolutionD() == 3)
|
||||
{
|
||||
//Determine which is the primary direction
|
||||
if (mag(n.x()) > mag(n.y()) && mag(n.x()) > mag(n.z()))
|
||||
{
|
||||
n1 = vector(n.y(), -n.x(), 0);
|
||||
}
|
||||
else if (mag(n.y()) > mag(n.z()))
|
||||
{
|
||||
n1 = vector(0, n.z(), -n.y());
|
||||
}
|
||||
else
|
||||
{
|
||||
n1 = vector(-n.z(), 0, n.x());
|
||||
}
|
||||
}
|
||||
n1.normalise();
|
||||
|
||||
const vector n2 = normalised(n ^ n1);
|
||||
|
||||
tensor rot =
|
||||
tensor
|
||||
(
|
||||
n.x() ,n.y(), n.z(),
|
||||
n1.x() ,n1.y(), n1.z(),
|
||||
n2.x() ,n2.y(), n2.z()
|
||||
);
|
||||
|
||||
// tensor rot =
|
||||
// tensor
|
||||
// (
|
||||
// n & x ,n & y, n & z,
|
||||
// n1 & x ,n1 & y, n1 & z,
|
||||
// n2 & x ,n2 & y, n2 & z
|
||||
// );
|
||||
|
||||
U1Contrav[faceI].x() =
|
||||
2*transform(rot, UIntFaces[faceI]).x()
|
||||
- transform(rot, HbyA[receptorNeigCell[faceI]]).x();
|
||||
|
||||
U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y();
|
||||
|
||||
U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z();
|
||||
|
||||
HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]);
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,12 +46,9 @@ Description
|
||||
#include "fvOptions.H"
|
||||
|
||||
#include "cellCellStencilObject.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "localMin.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "transform.H"
|
||||
#include "fvMeshSubset.H"
|
||||
#include "oversetAdjustPhi.H"
|
||||
#include "oversetPatchPhiErr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -68,10 +65,9 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "createUf.H"
|
||||
#include "createMRF.H"
|
||||
@ -88,7 +84,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
#include "readOversetDyMControls.H"
|
||||
|
||||
#include "CourantNo.H"
|
||||
|
||||
#include "setDeltaT.H"
|
||||
@ -97,45 +95,20 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
bool changed = mesh.update();
|
||||
mesh.update();
|
||||
|
||||
if (changed)
|
||||
if (mesh.changing())
|
||||
{
|
||||
#include "setCellMask.H"
|
||||
#include "setInterpolatedCells.H"
|
||||
#include "correctPhiFaceMask.H"
|
||||
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
Uf *= faceMaskOld;
|
||||
// Update Uf and phi on new C-I faces
|
||||
Uf += (1-faceMaskOld)*fvc::interpolate(U);
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
// Zero phi on current H-I
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
phi *= faceMask;
|
||||
}
|
||||
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
|
||||
@ -1,36 +1,11 @@
|
||||
// Option 1: interpolate rAU, do not block out rAU on blocked cells
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
mesh.interpolate(rAU);
|
||||
|
||||
// Option 2: do not interpolate rAU but block out rAU
|
||||
//surfaceScalarField rAUf("rAUf", fvc::interpolate(blockedCells*rAU));
|
||||
|
||||
|
||||
// Option 3: do not interpolate rAU but zero out rAUf on faces on holes
|
||||
// But what about:
|
||||
//
|
||||
// H
|
||||
// H I C C C C
|
||||
// H
|
||||
//
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
volVectorField H("H", UEqn.H());
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = constrainHbyA(rAU*H, U, p);
|
||||
|
||||
if (massFluxInterpolation)
|
||||
{
|
||||
#include "interpolatedFaces.H"
|
||||
}
|
||||
|
||||
if (runTime.outputTime())
|
||||
{
|
||||
H.write();
|
||||
rAU.write();
|
||||
HbyA.write();
|
||||
}
|
||||
|
||||
if (pimple.nCorrPISO() <= 1)
|
||||
{
|
||||
tUEqn.clear();
|
||||
@ -38,33 +13,16 @@ if (pimple.nCorrPISO() <= 1)
|
||||
|
||||
phiHbyA = fvc::flux(HbyA);
|
||||
|
||||
if (ddtCorr)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
phiHbyA += rAUf*faceMaskOld*fvc::ddtCorr(U, Uf);
|
||||
}
|
||||
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
// WIP
|
||||
if (p.needReference())
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
adjustPhi(phiHbyA, U, p);
|
||||
fvc::makeAbsolute(phiHbyA, U);
|
||||
}
|
||||
|
||||
|
||||
if (adjustFringe)
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
oversetAdjustPhi(phiHbyA, U);
|
||||
oversetAdjustPhi(phiHbyA, U, zoneIdMass);
|
||||
fvc::makeAbsolute(phiHbyA, U);
|
||||
}
|
||||
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
@ -79,27 +37,26 @@ while (pimple.correctNonOrthogonal())
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA - pEqn.flux();
|
||||
// option 2:
|
||||
// rAUf*fvc::snGrad(p)*mesh.magSf();
|
||||
pEqn.relax();
|
||||
U =
|
||||
cellMask*
|
||||
(
|
||||
HbyA
|
||||
- rAU*fvc::reconstruct((pEqn.flux())/rAUf)
|
||||
);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
|
||||
if (oversetPatchErrOutput)
|
||||
{
|
||||
oversetPatchPhiErr(pEqn, phiHbyA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Excludes error in interpolated/hole cells
|
||||
#include "continuityErrs.H"
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
volVectorField gradP(fvc::grad(p));
|
||||
|
||||
// Option 2: zero out velocity on blocked out cells
|
||||
//U = HbyA - rAU*cellMask*gradP;
|
||||
// Option 3: zero out velocity on blocked out cells
|
||||
// This is needed for the scalar Eq (k,epsilon, etc)
|
||||
// which can use U as source term
|
||||
U = cellMask*(HbyA - rAU*gradP);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
fvOptions.correct(U);
|
||||
|
||||
{
|
||||
Uf = fvc::interpolate(U);
|
||||
@ -109,9 +66,4 @@ fvOptions.correct(U);
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
phi *= faceMask;
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo = pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
massFluxInterpolation =
|
||||
pimple.dict().getOrDefault("massFluxInterpolation", false);
|
||||
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
@ -24,7 +24,3 @@ bool adjustFringe
|
||||
(
|
||||
simple.dict().getOrDefault("oversetAdjustPhi", false)
|
||||
);
|
||||
bool massFluxInterpolation
|
||||
(
|
||||
simple.dict().getOrDefault("massFluxInterpolation", false)
|
||||
);
|
||||
|
||||
@ -1,18 +1,10 @@
|
||||
{
|
||||
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = constrainHbyA(cellMask*rAU*UEqn.H(), U, p);
|
||||
|
||||
//mesh.interpolate(HbyA);
|
||||
if (massFluxInterpolation)
|
||||
{
|
||||
#include "interpolatedFaces.H"
|
||||
}
|
||||
|
||||
tUEqn.clear();
|
||||
|
||||
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
|
||||
|
||||
@ -129,10 +129,5 @@ compressibleInterPhaseTransportModel turbulence
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
@ -80,9 +80,6 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createTimeControls.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
|
||||
@ -109,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
@ -154,40 +151,10 @@ int main(int argc, char *argv[])
|
||||
// Update cellMask field for blocking out hole cells
|
||||
#include "setCellMask.H"
|
||||
#include "setInterpolatedCells.H"
|
||||
|
||||
faceMask =
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime());
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
Uf *= faceMask;
|
||||
|
||||
const surfaceVectorField Uint(fvc::interpolate(U));
|
||||
// Update Uf and phi on new C-I faces
|
||||
Uf += (1-faceMask)*Uint;
|
||||
|
||||
// Update Uf boundary
|
||||
forAll(Uf.boundaryField(), patchI)
|
||||
{
|
||||
Uf.boundaryFieldRef()[patchI] =
|
||||
Uint.boundaryField()[patchI];
|
||||
}
|
||||
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
// Correct phi on individual regions
|
||||
if (correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
#include "correctPhiFaceMask.H"
|
||||
|
||||
mixture.correct();
|
||||
|
||||
// Zero phi on current H-I
|
||||
faceMask = localMin<scalar>(mesh).interpolate(cellMask);
|
||||
|
||||
phi *= faceMask;
|
||||
U *= cellMask;
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
@ -202,10 +169,6 @@ int main(int argc, char *argv[])
|
||||
#include "alphaControls.H"
|
||||
#include "compressibleAlphaEqnSubCycle.H"
|
||||
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
rhoPhi *= faceMask;
|
||||
|
||||
turbulence.correctPhasePhi();
|
||||
|
||||
@ -10,19 +10,6 @@
|
||||
fvc::flux(HbyA)
|
||||
);
|
||||
|
||||
if (ddtCorr)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
phiHbyA +=
|
||||
MRF.zeroFilter
|
||||
(
|
||||
fvc::interpolate(rho*rAU)*faceMaskOld*fvc::ddtCorr(U, Uf)
|
||||
);
|
||||
}
|
||||
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
surfaceScalarField phig
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,7 +36,10 @@ scalar meanCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask));
|
||||
surfaceScalarField phiMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask + interpolatedCells)
|
||||
);
|
||||
|
||||
scalarField sumPhi
|
||||
(
|
||||
|
||||
@ -7,3 +7,5 @@ volScalarField::Internal divU
|
||||
? fvc::div(phiCN() + mesh.phi())
|
||||
: fvc::div(phiCN())
|
||||
);
|
||||
|
||||
divU *= interpolatedCells*cellMask;
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
bool correctPhi
|
||||
(
|
||||
pimple.dict().getOrDefault("correctPhi", true)
|
||||
);
|
||||
|
||||
bool checkMeshCourantNo
|
||||
(
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false)
|
||||
);
|
||||
|
||||
bool moveMeshOuterCorrectors
|
||||
(
|
||||
pimple.dict().getOrDefault("moveMeshOuterCorrectors", false)
|
||||
);
|
||||
|
||||
|
||||
bool massFluxInterpolation
|
||||
(
|
||||
pimple.dict().getOrDefault("massFluxInterpolation", false)
|
||||
);
|
||||
|
||||
bool adjustFringe
|
||||
(
|
||||
pimple.dict().getOrDefault("oversetAdjustPhi", false)
|
||||
);
|
||||
|
||||
bool ddtCorr
|
||||
(
|
||||
pimple.dict().getOrDefault("ddtCorr", true)
|
||||
);
|
||||
@ -40,8 +40,12 @@ volVectorField U
|
||||
nonInt.insert("HbyA");
|
||||
nonInt.insert("grad(p_rgh)");
|
||||
nonInt.insert("nHat");
|
||||
nonInt.insert("surfaceIntegrate(nHatf)");
|
||||
nonInt.insert("surfaceIntegrate(phi+meshPhi)");
|
||||
nonInt.insert("surfaceIntegrate(phi)");
|
||||
nonInt.insert("surfaceIntegrate(phiHbyA)");
|
||||
nonInt.insert("surfaceSum(((S|magSf)*S)");
|
||||
nonInt.insert("surfaceIntegrate(((rAUf*magSf)*snGradCorr(p_rgh)))");
|
||||
nonInt.insert("cellMask");
|
||||
nonInt.insert("cellDisplacement");
|
||||
nonInt.insert("interpolatedCells");
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,14 +49,11 @@ Description
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvOptions.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "fvcSmooth.H"
|
||||
#include "cellCellStencilObject.H"
|
||||
#include "localMin.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
#include "transform.H"
|
||||
#include "fvMeshSubset.H"
|
||||
#include "oversetAdjustPhi.H"
|
||||
#include "oversetPatchPhiErr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -76,8 +73,7 @@ int main(int argc, char *argv[])
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "initContinuityErrs.H"
|
||||
pimpleControl pimple(mesh);
|
||||
#include "createTimeControls.H"
|
||||
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
#include "createAlphaFluxes.H"
|
||||
@ -97,11 +93,8 @@ int main(int argc, char *argv[])
|
||||
dimensionedScalar("rAUf", dimTime/rho.dimensions(), 1.0)
|
||||
);
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
#include "createUf.H"
|
||||
#include "createControls.H"
|
||||
|
||||
#include "setCellMask.H"
|
||||
#include "setInterpolatedCells.H"
|
||||
@ -119,7 +112,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
#include "readOversetDyMControls.H"
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
@ -158,50 +152,17 @@ int main(int argc, char *argv[])
|
||||
talphaPhi1Corr0.clear();
|
||||
}
|
||||
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
|
||||
// Update cellMask field for blocking out hole cells
|
||||
#include "setCellMask.H"
|
||||
#include "setInterpolatedCells.H"
|
||||
#include "correctPhiFaceMask.H"
|
||||
|
||||
const surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
gh = (g & mesh.C()) - ghRef;
|
||||
ghf = (g & mesh.Cf()) - ghRef;
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
Uf *= faceMaskOld;
|
||||
|
||||
const surfaceVectorField Uint(fvc::interpolate(U));
|
||||
// Update Uf and phi on new C-I faces
|
||||
Uf += (1-faceMaskOld)*Uint;
|
||||
|
||||
// Update Uf boundary
|
||||
forAll(Uf.boundaryField(), patchI)
|
||||
{
|
||||
Uf.boundaryFieldRef()[patchI] =
|
||||
Uint.boundaryField()[patchI];
|
||||
}
|
||||
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
// Correct phi on individual regions
|
||||
if (correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
mixture.correct();
|
||||
|
||||
// Zero phi on current H-I
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
phi *= faceMask;
|
||||
U *= cellMask;
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
@ -213,14 +174,14 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (adjustFringe)
|
||||
{
|
||||
oversetAdjustPhi(phi, U, zoneIdMass);
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
rhoPhi *= faceMask;
|
||||
|
||||
mixture.correct();
|
||||
|
||||
@ -1,64 +1,31 @@
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
//mesh.interpolate(rAU);
|
||||
|
||||
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
|
||||
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField H("H", UEqn.H());
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
//HbyA = rAU*UEqn.H();
|
||||
HbyA = constrainHbyA(rAU*H, U, p_rgh);
|
||||
|
||||
if (massFluxInterpolation)
|
||||
{
|
||||
#include "interpolatedFaces.H"
|
||||
}
|
||||
HbyA = constrainHbyA(rAU*H, U, p_rgh);
|
||||
|
||||
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA));
|
||||
|
||||
if (ddtCorr)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
phiHbyA +=
|
||||
fvc::interpolate(rho*rAU)*faceMaskOld*fvc::ddtCorr(U, Uf);
|
||||
}
|
||||
MRF.makeRelative(phiHbyA);
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
fvc::makeAbsolute(phiHbyA, U);
|
||||
}
|
||||
|
||||
if (adjustFringe)
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
oversetAdjustPhi(phiHbyA, U);
|
||||
fvc::makeAbsolute(phiHbyA, U);
|
||||
}
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
(
|
||||
mixture.surfaceTensionForce()
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*faceMask*rAUf*mesh.magSf()
|
||||
- ghf*fvc::snGrad(cellMask*rho)
|
||||
)*rAUf*faceMask*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
|
||||
if (adjustFringe)
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
oversetAdjustPhi(phiHbyA, U);
|
||||
fvc::makeAbsolute(phiHbyA, U);
|
||||
oversetAdjustPhi(phiHbyA, U, zoneIdMass);
|
||||
}
|
||||
|
||||
// Update the pressure BCs to ensure flux consistency
|
||||
@ -90,6 +57,10 @@
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
if (oversetPatchErrOutput)
|
||||
{
|
||||
oversetPatchPhiErr(p_rghEqn, phiHbyA);
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo =
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
moveMeshOuterCorrectors =
|
||||
pimple.dict().getOrDefault("moveMeshOuterCorrectors", false);
|
||||
|
||||
massFluxInterpolation =
|
||||
pimple.dict().getOrDefault("massFluxInterpolation", false);
|
||||
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
|
||||
adjustFringe = pimple.dict().getOrDefault("oversetAdjustPhi", false);
|
||||
@ -1,11 +0,0 @@
|
||||
CorrectPhi
|
||||
(
|
||||
U,
|
||||
phi,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU)),
|
||||
divU,
|
||||
pimple
|
||||
);
|
||||
|
||||
#include "continuityErrs.H"
|
||||
@ -149,10 +149,5 @@ surfaceScalarField alphaPhi10
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
@ -82,9 +82,7 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createTimeControls.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
@ -118,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
// Store divU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
@ -153,40 +151,10 @@ int main(int argc, char *argv[])
|
||||
// Update cellMask field for blocking out hole cells
|
||||
#include "setCellMask.H"
|
||||
#include "setInterpolatedCells.H"
|
||||
|
||||
faceMask =
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime());
|
||||
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
Uf *= faceMask;
|
||||
|
||||
const surfaceVectorField Uint(fvc::interpolate(U));
|
||||
// Update Uf and phi on new C-I faces
|
||||
Uf += (1-faceMask)*Uint;
|
||||
|
||||
// Update Uf boundary
|
||||
forAll(Uf.boundaryField(), patchI)
|
||||
{
|
||||
Uf.boundaryFieldRef()[patchI] =
|
||||
Uint.boundaryField()[patchI];
|
||||
}
|
||||
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
#include "correctPhiFaceMask.H"
|
||||
|
||||
mixture->correct();
|
||||
|
||||
// Zero phi on current H-I
|
||||
faceMask = localMin<scalar>(mesh).interpolate(cellMask);
|
||||
|
||||
phi *= faceMask;
|
||||
U *= cellMask;
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
@ -214,10 +182,6 @@ int main(int argc, char *argv[])
|
||||
mixture->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
rhoPhi *= faceMask;
|
||||
|
||||
interface.correct();
|
||||
|
||||
@ -8,16 +8,6 @@
|
||||
fvc::flux(HbyA)
|
||||
);
|
||||
|
||||
|
||||
if (ddtCorr)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
phiHbyA += faceMaskOld*fvc::ddtCorr(U, Uf);
|
||||
}
|
||||
|
||||
if (p_rgh.needReference())
|
||||
{
|
||||
fvc::makeRelative(phiHbyA, U);
|
||||
|
||||
@ -7,6 +7,7 @@ cd "${0%/*}" || exit # Run from this directory
|
||||
|
||||
library/Allwmake
|
||||
|
||||
wmake
|
||||
# Does not use libOpenFOAM or libPstream...
|
||||
wmake -no-openfoam
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* Install into FOAM_APPBIN to support 'fake' builds (to test packaging) */
|
||||
Test-dummyLib.C
|
||||
Test-dummyLib.cpp
|
||||
|
||||
EXE = $(FOAM_APPBIN)/Test-dummyLib
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* Install into central FOAM_LIBBIN for 'fake' builds (test packaging) */
|
||||
dummyLib.C
|
||||
dummyLib.cpp
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libTestDummy-OpenFOAM
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* Install into central FOAM_LIBBIN/dummy for 'fake' builds (test packaging) */
|
||||
dummyMpiLib.C
|
||||
dummyMpiLib.cpp
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/dummy/libTestDummyMpi
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/* Install into central FOAM_MPI_LIBBIN for 'fake' builds (test packaging) */
|
||||
dummyMpiLib.C
|
||||
dummyMpiLib.cpp
|
||||
|
||||
LIB = $(FOAM_MPI_LIBBIN)/libTestDummyMpi
|
||||
|
||||
8
wmake/rules/General/mplib-ia64-HPMPI → applications/test/00-machine-sizes/Allwmake
Normal file → Executable file
8
wmake/rules/General/mplib-ia64-HPMPI → applications/test/00-machine-sizes/Allwmake
Normal file → Executable file
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
# HPMPI rules (ia64)
|
||||
|
||||
PFLAGS =
|
||||
PINC = -isystem $(MPI_ARCH_PATH)/include -D_MPICC_H
|
||||
PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_ia64 -lmpi
|
||||
# Does not use libOpenFOAM or libPstream...
|
||||
wmake -no-openfoam
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -59,7 +59,8 @@ void print(const char* name, bool showLimits = true)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout<<"machine sizes\n---\n\n";
|
||||
std::cout<< "c++ = " << __cplusplus << '\n';
|
||||
std::cout<< "machine sizes\n---\n\n";
|
||||
|
||||
print<short>("short");
|
||||
print<int>("int");
|
||||
|
||||
8
applications/test/00-openmp/Allwmake
Executable file
8
applications/test/00-openmp/Allwmake
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd "${0%/*}" || exit # Run from this directory
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# Does not use libOpenFOAM or libPstream...
|
||||
wmake -no-openfoam
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -1,3 +1,3 @@
|
||||
Test-openmp.C
|
||||
Test-openmp.cpp
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-openmp
|
||||
@ -41,8 +41,13 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
std::cout
|
||||
<< "c++ = " << __cplusplus << '\n';
|
||||
|
||||
#if _OPENMP
|
||||
std::cout << "_OPENMP = " << _OPENMP << "\n\n";
|
||||
std::cout
|
||||
<< "openmp = " << _OPENMP << '\n'
|
||||
<< "Initial threads = " << omp_get_num_threads() << "\n\n";
|
||||
|
||||
// Fork threads with their own copies of variables
|
||||
int nThreads, threadId;
|
||||
@ -52,15 +57,15 @@ int main(int argc, char *argv[])
|
||||
threadId = omp_get_thread_num();
|
||||
nThreads = omp_get_num_threads();
|
||||
|
||||
// Printf rather than cout to ensure that it emits in one go
|
||||
printf("Called from thread = %d\n", threadId);
|
||||
|
||||
// Master thread
|
||||
if (threadId == 0)
|
||||
{
|
||||
// Printf rather than cout to ensure that it emits in one go
|
||||
printf("Number of threads = %d\n", nThreads);
|
||||
}
|
||||
|
||||
// Printf rather than cout to ensure that it emits in one go
|
||||
printf("Called from thread = %d\n", threadId);
|
||||
}
|
||||
#else
|
||||
std::cout << "Compiled without openmp!\n";
|
||||
@ -240,13 +240,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"copy-append",
|
||||
"test move append lists (requires -filter)"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"move-append",
|
||||
"test move append lists (requires -filter)"
|
||||
"merge",
|
||||
"test merging lists (requires -filter)"
|
||||
);
|
||||
|
||||
// timeSelector::addOptions();
|
||||
@ -261,16 +256,10 @@ int main(int argc, char *argv[])
|
||||
Info<<"limit names: " << matcher << nl;
|
||||
}
|
||||
|
||||
if (args.found("copy-append") && matcher.empty())
|
||||
if (args.found("merge") && matcher.empty())
|
||||
{
|
||||
FatalError
|
||||
<< nl << "The -copy-append test also requires -filter" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
if (args.found("move-append") && matcher.empty())
|
||||
{
|
||||
FatalError
|
||||
<< nl << "The -move-append test also requires -filter" << nl
|
||||
<< nl << "The -merge test also requires -filter" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
@ -327,13 +316,9 @@ int main(int argc, char *argv[])
|
||||
// On last time
|
||||
if (timeI == timeDirs.size()-1)
|
||||
{
|
||||
if (args.found("copy-append"))
|
||||
if (args.found("merge"))
|
||||
{
|
||||
Info<< nl << "Test move append" << nl;
|
||||
}
|
||||
else if (args.found("move-append"))
|
||||
{
|
||||
Info<< nl << "Test move append" << nl;
|
||||
Info<< nl << "Test merge" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -349,18 +334,8 @@ int main(int argc, char *argv[])
|
||||
Info<< "==target==" << nl; reportDetail(objects);
|
||||
Info<< "==source==" << nl; reportDetail(other);
|
||||
|
||||
if (args.found("copy-append"))
|
||||
{
|
||||
objects.append(other);
|
||||
|
||||
Info<< nl << "After copy-append" << nl;
|
||||
}
|
||||
else
|
||||
{
|
||||
objects.append(std::move(other));
|
||||
|
||||
Info<< nl << "After move-append" << nl;
|
||||
}
|
||||
objects.merge(std::move(other));
|
||||
Info<< nl << "After merge" << nl;
|
||||
|
||||
Info<< "==target==" << nl; reportDetail(objects);
|
||||
Info<< "==source==" << nl; reportDetail(other);
|
||||
|
||||
3
applications/test/OFstream/Make/files
Normal file
3
applications/test/OFstream/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-OFstream.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-OFstream
|
||||
2
applications/test/OFstream/Make/options
Normal file
2
applications/test/OFstream/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
228
applications/test/OFstream/Test-OFstream.C
Normal file
228
applications/test/OFstream/Test-OFstream.C
Normal file
@ -0,0 +1,228 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Test OFstream. Primarily atomic operations
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Fstream.H"
|
||||
#include "IOstreams.H"
|
||||
#include "OSspecific.H"
|
||||
#include "argList.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
void listFiles(const fileName& dir)
|
||||
{
|
||||
wordList files = ListOps::create<word>
|
||||
(
|
||||
readDir(dir, fileName::FILE),
|
||||
nameOp<fileName>()
|
||||
);
|
||||
|
||||
Info
|
||||
<< nl
|
||||
<< "files:" << nl
|
||||
<< files << nl
|
||||
<< "ls" << nl
|
||||
<< "============" << endl;
|
||||
Foam::system("ls -al " + dir);
|
||||
Info<< "============" << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption("gz", "Use compression");
|
||||
argList::addBoolOption("append", "Use append mode");
|
||||
argList::addBoolOption("atomic", "Use atomic");
|
||||
argList::addBoolOption("keep", "Do not remove test directory");
|
||||
argList::addOption("write", "file", "test writing to file");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
const fileName baseDir("Test-OFstream-directory");
|
||||
|
||||
Foam::mkDir(baseDir);
|
||||
|
||||
InfoErr<< "mkdir: " << baseDir << endl;
|
||||
|
||||
IOstreamOption streamOpt;
|
||||
|
||||
if (args.found("gz"))
|
||||
{
|
||||
streamOpt.compression(IOstreamOption::COMPRESSED);
|
||||
}
|
||||
|
||||
IOstreamOption::appendType append =
|
||||
(
|
||||
args.found("append")
|
||||
? IOstreamOption::APPEND
|
||||
: IOstreamOption::NON_APPEND
|
||||
);
|
||||
IOstreamOption::atomicType atomic =
|
||||
(
|
||||
args.found("atomic")
|
||||
? IOstreamOption::ATOMIC
|
||||
: IOstreamOption::NON_ATOMIC
|
||||
);
|
||||
|
||||
{
|
||||
OFstream(baseDir/"dummy")() << "Some file content" << endl;
|
||||
|
||||
Foam::ln("dummy", baseDir/"Test2.txt");
|
||||
Foam::ln("dummy", baseDir/"Test3.txt");
|
||||
Foam::ln("dummy", baseDir/"Test4.txt");
|
||||
Foam::ln("dummy", baseDir/"Test4.txt.gz");
|
||||
Foam::ln("dummy", baseDir/"Test5.txt");
|
||||
Foam::ln("dummy", baseDir/"Test5.txt.gz");
|
||||
}
|
||||
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
atomic,
|
||||
baseDir/"Test1.txt",
|
||||
streamOpt,
|
||||
append
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
}
|
||||
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
atomic,
|
||||
baseDir/"Test2.txt",
|
||||
streamOpt
|
||||
// NON_APPEND
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
}
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
atomic,
|
||||
baseDir/"Test3.txt",
|
||||
streamOpt,
|
||||
IOstreamOption::APPEND
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
}
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
baseDir/"Test4.txt",
|
||||
IOstreamOption::ASCII,
|
||||
IOstreamOption::COMPRESSED
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
}
|
||||
{
|
||||
OFstream os
|
||||
(
|
||||
IOstreamOption::ATOMIC,
|
||||
baseDir/"Test5.txt"
|
||||
// ASCII UNCOMPRESSED NON_APPEND
|
||||
);
|
||||
|
||||
os << "=========================" << endl;
|
||||
|
||||
InfoErr<< "open: " << os.name() << endl;
|
||||
InfoErr<< "... sleep" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
sleep(2);
|
||||
|
||||
os << "+++++++++++++++++++++++++++++++++++" << endl;
|
||||
}
|
||||
|
||||
Info<< nl << "done:" << endl;
|
||||
|
||||
listFiles(baseDir);
|
||||
|
||||
if (args.found("keep"))
|
||||
{
|
||||
InfoErr<< "keep: " << baseDir << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
InfoErr<< "rmdir: " << baseDir << endl;
|
||||
Foam::rmDir(baseDir);
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/test/foamToEnsight-check/Make/files
Normal file
3
applications/test/foamToEnsight-check/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
foamToEnsight-check.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/foamToEnsight-check
|
||||
16
applications/test/foamToEnsight-check/Make/options
Normal file
16
applications/test/foamToEnsight-check/Make/options
Normal file
@ -0,0 +1,16 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/finiteArea/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/conversion/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lfiniteArea \
|
||||
-lfileFormats \
|
||||
-lmeshTools \
|
||||
-lconversion \
|
||||
-llagrangianIntermediate \
|
||||
-lgenericPatchFields
|
||||
357
applications/test/foamToEnsight-check/foamToEnsight-check.C
Normal file
357
applications/test/foamToEnsight-check/foamToEnsight-check.C
Normal file
@ -0,0 +1,357 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
foamToEnsight-check
|
||||
|
||||
Description
|
||||
Check data sizes for conversion to ensight format.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "timeSelector.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "IOmanip.H"
|
||||
#include "OFstream.H"
|
||||
#include "Pstream.H"
|
||||
#include "HashOps.H"
|
||||
#include "regionProperties.H"
|
||||
|
||||
#include "fvc.H"
|
||||
#include "faMesh.H"
|
||||
#include "fvMesh.H"
|
||||
|
||||
// file-format/conversion
|
||||
#include "ensightFaMesh.H"
|
||||
#include "ensightMesh.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
|
||||
void printStats(const FixedList<label, 3>& stats, const char *what = "")
|
||||
{
|
||||
Info<< what << "max-comm: "<< stats[0] << nl
|
||||
<< what << "max-size: "<< stats[1] << nl
|
||||
<< what << "off-proc: "<< stats[2] << nl;
|
||||
}
|
||||
|
||||
|
||||
template<class EnsightPartType>
|
||||
FixedList<label, 3> printPartInfo
|
||||
(
|
||||
const EnsightPartType& part,
|
||||
int verbose = 0
|
||||
)
|
||||
{
|
||||
Info<< "part: " << part.name().c_str() << nl
|
||||
<< " size: "
|
||||
<< (Pstream::parRun() ? part.total() : part.size())
|
||||
<< " (";
|
||||
|
||||
FixedList<label, 3> stats(Zero);
|
||||
|
||||
label& maxComm = stats[0];
|
||||
label& maxSize = stats[1];
|
||||
label& totNonLocalSize = stats[2];
|
||||
|
||||
for (int typei=0; typei < EnsightPartType::nTypes; ++typei)
|
||||
{
|
||||
const auto etype = typename EnsightPartType::elemType(typei);
|
||||
|
||||
if (typei) Info<< ' ';
|
||||
Info<< EnsightPartType::elemNames[etype] << ": "
|
||||
<< (Pstream::parRun() ? part.total(etype) : part.size(etype));
|
||||
|
||||
label elemCount = part.size(etype);
|
||||
label commCount = (Pstream::master() ? label(0) : elemCount);
|
||||
label nonLocalCount = commCount;
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(elemCount, maxOp<label>());
|
||||
reduce(commCount, maxOp<label>());
|
||||
|
||||
reduce(nonLocalCount, sumOp<label>());
|
||||
}
|
||||
|
||||
maxComm = max(maxComm, commCount);
|
||||
maxSize = max(maxSize, elemCount);
|
||||
totNonLocalSize = max(totNonLocalSize, nonLocalCount);
|
||||
}
|
||||
Info<< ")" << endl;
|
||||
|
||||
if (verbose && Pstream::parRun() && part.total())
|
||||
{
|
||||
for (int typei=0; typei < EnsightPartType::nTypes; ++typei)
|
||||
{
|
||||
const auto etype = typename EnsightPartType::elemType(typei);
|
||||
|
||||
label elemCount = part.size(etype);
|
||||
label totCount = part.total(etype);
|
||||
|
||||
Info<< " "
|
||||
<< EnsightPartType::elemNames[etype] << ": "
|
||||
<< totCount;
|
||||
|
||||
if (totCount)
|
||||
{
|
||||
labelList sizes(UPstream::listGatherValues(elemCount));
|
||||
|
||||
Info<< " ";
|
||||
sizes.writeList(Info);
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
printStats(stats, " ");
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
||||
void printInfo(const ensightMesh& mesh, int verbose = 0)
|
||||
{
|
||||
FixedList<label, 3> cellStats(Zero);
|
||||
FixedList<label, 3> faceStats(Zero);
|
||||
|
||||
for (const auto& iter : mesh.cellZoneParts().sorted())
|
||||
{
|
||||
FixedList<label, 3> stats = printPartInfo(iter.val(), verbose);
|
||||
|
||||
for (label i=0; i < 3; ++i)
|
||||
{
|
||||
cellStats[i] = max(cellStats[i], stats[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& iter : mesh.faceZoneParts().sorted())
|
||||
{
|
||||
FixedList<label, 3> stats = printPartInfo(iter.val(), verbose);
|
||||
|
||||
for (label i=0; i < 3; ++i)
|
||||
{
|
||||
faceStats[i] = max(faceStats[i], stats[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& iter : mesh.boundaryParts().sorted())
|
||||
{
|
||||
FixedList<label, 3> stats = printPartInfo(iter.val(), verbose);
|
||||
|
||||
for (label i=0; i < 3; ++i)
|
||||
{
|
||||
faceStats[i] = max(faceStats[i], stats[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< nl
|
||||
<< "===============" << nl;
|
||||
printStats(cellStats, "cell ");
|
||||
|
||||
Info<< nl;
|
||||
printStats(faceStats, "face ");
|
||||
|
||||
Info<< "===============" << endl;
|
||||
}
|
||||
|
||||
|
||||
void printInfo(const ensightFaMesh& mesh, int verbose = 0)
|
||||
{
|
||||
printPartInfo(mesh.areaPart());
|
||||
}
|
||||
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Check data sizes for conversion of OpenFOAM to Ensight format"
|
||||
);
|
||||
// timeSelector::addOptions();
|
||||
|
||||
// Less frequently used - reduce some clutter
|
||||
argList::setAdvanced("decomposeParDict");
|
||||
|
||||
argList::addVerboseOption("Additional verbosity");
|
||||
|
||||
#include "addAllRegionOptions.H"
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-boundary", // noPatches
|
||||
"Suppress writing any patches"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-internal",
|
||||
"Suppress writing the internal mesh"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-cellZones",
|
||||
"Suppress writing any cellZones"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
"no-finite-area",
|
||||
"Suppress output of finite-area mesh/fields",
|
||||
true // mark as an advanced option
|
||||
);
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Configuration
|
||||
|
||||
const int optVerbose = args.verbose();
|
||||
const bool doBoundary = !args.found("no-boundary");
|
||||
const bool doInternal = !args.found("no-internal");
|
||||
const bool doCellZones = !args.found("no-cellZones");
|
||||
const bool doFiniteArea = !args.found("no-finite-area");
|
||||
|
||||
ensightMesh::options writeOpts;
|
||||
writeOpts.useBoundaryMesh(doBoundary);
|
||||
writeOpts.useInternalMesh(doInternal);
|
||||
writeOpts.useCellZones(doCellZones);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#include "createTime.H"
|
||||
|
||||
instantList timeDirs = timeSelector::select0(runTime, args);
|
||||
|
||||
// Handle -allRegions, -regions, -region
|
||||
#include "getAllRegionOptions.H"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
#include "createNamedMeshes.H"
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/// #include "createMeshAccounting.H"
|
||||
|
||||
PtrList<ensightMesh> ensightMeshes(regionNames.size());
|
||||
PtrList<faMesh> meshesFa(regionNames.size());
|
||||
PtrList<ensightFaMesh> ensightMeshesFa(regionNames.size());
|
||||
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const fvMesh& mesh = meshes[regioni];
|
||||
|
||||
ensightMeshes.set
|
||||
(
|
||||
regioni,
|
||||
new ensightMesh(mesh, writeOpts)
|
||||
);
|
||||
ensightMeshes[regioni].verbose(optVerbose);
|
||||
|
||||
|
||||
if (doFiniteArea)
|
||||
{
|
||||
autoPtr<faMesh> faMeshPtr(faMesh::TryNew(mesh));
|
||||
|
||||
if (faMeshPtr)
|
||||
{
|
||||
meshesFa.set(regioni, std::move(faMeshPtr));
|
||||
|
||||
ensightMeshesFa.set
|
||||
(
|
||||
regioni,
|
||||
new ensightFaMesh(meshesFa[regioni])
|
||||
);
|
||||
ensightMeshesFa[regioni].verbose(optVerbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
Info<< "Checking " << timeDirs.size() << " time steps" << nl;
|
||||
}
|
||||
|
||||
forAll(timeDirs, timei)
|
||||
{
|
||||
runTime.setTime(timeDirs[timei], timei);
|
||||
|
||||
forAll(regionNames, regioni)
|
||||
{
|
||||
const word& regionName = regionNames[regioni];
|
||||
// const word& regionDir = polyMesh::regionName(regionName);
|
||||
|
||||
auto& mesh = meshes[regioni];
|
||||
|
||||
polyMesh::readUpdateState meshState = mesh.readUpdate();
|
||||
const bool moving = (meshState != polyMesh::UNCHANGED);
|
||||
|
||||
auto& ensMesh = ensightMeshes[regioni];
|
||||
|
||||
// Finite-area (can be missing)
|
||||
auto* ensFaMeshPtr = ensightMeshesFa.get(regioni);
|
||||
|
||||
if (moving)
|
||||
{
|
||||
ensMesh.expire();
|
||||
ensMesh.correct();
|
||||
|
||||
if (ensFaMeshPtr)
|
||||
{
|
||||
ensFaMeshPtr->expire();
|
||||
ensFaMeshPtr->correct();
|
||||
}
|
||||
}
|
||||
|
||||
if (moving || timei == 0) // report
|
||||
{
|
||||
if (regionNames.size() > 1)
|
||||
{
|
||||
Info<< "region=" << regionName << nl;
|
||||
}
|
||||
|
||||
printInfo(ensMesh, optVerbose);
|
||||
|
||||
if (ensFaMeshPtr)
|
||||
{
|
||||
printInfo(*ensFaMeshPtr, optVerbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "\nEnd"<< nl << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
3
applications/test/write-wrapped-string/Make/files
Normal file
3
applications/test/write-wrapped-string/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
Test-write-wrapped-string.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-write-wrapped-string
|
||||
2
applications/test/write-wrapped-string/Make/options
Normal file
2
applications/test/write-wrapped-string/Make/options
Normal file
@ -0,0 +1,2 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
@ -0,0 +1,93 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
Test-write-wrapped-string
|
||||
|
||||
Description
|
||||
Simple tests for wrapped strings
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "argList.H"
|
||||
#include "stringOps.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
void print(const std::string& str, std::size_t width, std::size_t indent=0)
|
||||
{
|
||||
auto& os = Info();
|
||||
|
||||
os << nl
|
||||
<< "string[" << str.size() << "]" << nl
|
||||
<< str.c_str() << "<<<<" << nl
|
||||
<< "indent:" << indent << " width:" << width << endl;
|
||||
|
||||
for (size_t i = 0; i < width; ++i)
|
||||
{
|
||||
os << '=';
|
||||
}
|
||||
os << endl;
|
||||
|
||||
stringOps::writeWrapped(os, str, width, indent);
|
||||
|
||||
for (size_t i = 0; i < width; ++i)
|
||||
{
|
||||
os << '=';
|
||||
}
|
||||
os << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
{
|
||||
string test =
|
||||
"123456789-12345\n\n"
|
||||
"6789-12\t"
|
||||
"xyz3456789-1234 56789-123456789-";
|
||||
|
||||
print(test, 10, 4);
|
||||
}
|
||||
|
||||
{
|
||||
string test = "ABCDEFGHI";
|
||||
print(test, 10, 4);
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -95,7 +95,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "printMeshSummary.H"
|
||||
// Mesh information (verbose)
|
||||
faMeshTools::printMeshChecks(aMesh);
|
||||
|
||||
if (args.found("write-vtk"))
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -15,47 +15,78 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// Embed do-while to support early termination
|
||||
if (doDecompose && Pstream::parRun())
|
||||
do
|
||||
{
|
||||
faMeshReconstructor reconstructor(aMesh);
|
||||
reconstructor.writeAddressing();
|
||||
faMeshReconstructor reconstructor(aMesh, IOobjectOption::READ_IF_PRESENT);
|
||||
|
||||
Info<< "Wrote proc-addressing" << nl << endl;
|
||||
if (!reconstructor.good())
|
||||
{
|
||||
Info<< "Missing volume proc-addressing, "
|
||||
"cannot generate area proc-addressing." << nl
|
||||
<< "Also skip decomposing area fields...."
|
||||
<< endl;
|
||||
break;
|
||||
}
|
||||
|
||||
reconstructor.writeMesh(); // Writes on master only
|
||||
reconstructor.writeAddressing(); // Writes per-proc
|
||||
|
||||
Info<< "Wrote proc-addressing and serial mesh" << nl << endl;
|
||||
|
||||
// Handle area fields
|
||||
// ------------------
|
||||
|
||||
faFieldDecomposer::fieldsCache areaFieldsCache;
|
||||
|
||||
const faMesh& fullMesh = reconstructor.mesh();
|
||||
const faMesh& serialMesh = reconstructor.mesh();
|
||||
|
||||
if (doDecompFields)
|
||||
{
|
||||
// Use uncollated (or master uncollated) file handler here.
|
||||
// - each processor is reading in the identical serial fields.
|
||||
// - nothing should be parallel-coordinated.
|
||||
// The serial finite-area mesh exists and is identical on all
|
||||
// processors, but its fields can only reliably be read on the
|
||||
// master (eg, running with distributed roots).
|
||||
//
|
||||
// - mark mesh fields as readable on master only (haveMeshOnProc)
|
||||
// - 'subset' entire serial mesh so that a full copy will be
|
||||
// broadcast to other ranks (subsetterPtr)
|
||||
// - scan available IOobjects on the master only
|
||||
|
||||
// Similarly, if we write the serial finite-area mesh, this is only
|
||||
// done from one processor!
|
||||
bitSet haveMeshOnProc;
|
||||
std::unique_ptr<faMeshSubset> subsetter;
|
||||
IOobjectList objects(0);
|
||||
|
||||
reconstructor.writeMesh();
|
||||
const bool oldDistributed = fileHandler().distributed();
|
||||
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
||||
fileHandler().distributed(true);
|
||||
|
||||
if (doDecompFields)
|
||||
if (Pstream::master())
|
||||
{
|
||||
const bool oldDistributed = fileHandler().distributed();
|
||||
auto oldHandler = fileHandler(fileOperation::NewUncollated());
|
||||
fileHandler().distributed(true);
|
||||
haveMeshOnProc.set(Pstream::myProcNo());
|
||||
subsetter.reset(new faMeshSubset(serialMesh));
|
||||
|
||||
IOobjectList objects(fullMesh.time(), runTime.timeName());
|
||||
const bool oldParRun = Pstream::parRun(false);
|
||||
|
||||
areaFieldsCache.readAllFields(fullMesh, objects);
|
||||
objects = IOobjectList(serialMesh.time(), runTime.timeName());
|
||||
|
||||
// Restore old settings
|
||||
if (oldHandler)
|
||||
{
|
||||
fileHandler(std::move(oldHandler));
|
||||
}
|
||||
fileHandler().distributed(oldDistributed);
|
||||
Pstream::parRun(oldParRun);
|
||||
}
|
||||
|
||||
// Restore old settings
|
||||
if (oldHandler)
|
||||
{
|
||||
fileHandler(std::move(oldHandler));
|
||||
}
|
||||
fileHandler().distributed(oldDistributed);
|
||||
|
||||
areaFieldsCache.readAllFields
|
||||
(
|
||||
haveMeshOnProc,
|
||||
subsetter.get(),
|
||||
serialMesh,
|
||||
objects
|
||||
);
|
||||
}
|
||||
|
||||
const label nAreaFields = areaFieldsCache.size();
|
||||
@ -66,7 +97,7 @@ if (doDecompose && Pstream::parRun())
|
||||
|
||||
faFieldDecomposer fieldDecomposer
|
||||
(
|
||||
fullMesh,
|
||||
serialMesh,
|
||||
aMesh,
|
||||
reconstructor.edgeProcAddressing(),
|
||||
reconstructor.faceProcAddressing(),
|
||||
@ -77,7 +108,7 @@ if (doDecompose && Pstream::parRun())
|
||||
areaFieldsCache.decomposeAllFields(fieldDecomposer, true);
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
} while (false);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -42,13 +42,14 @@ Original Authors
|
||||
#include "argList.H"
|
||||
#include "OSspecific.H"
|
||||
#include "faMesh.H"
|
||||
#include "faMeshTools.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "IOobjectList.H"
|
||||
|
||||
#include "areaFields.H"
|
||||
#include "edgeFields.H"
|
||||
#include "faFieldDecomposer.H"
|
||||
#include "faMeshReconstructor.H"
|
||||
#include "faMeshSubset.H"
|
||||
#include "PtrListOps.H"
|
||||
#include "foamVtkIndPatchWriter.H"
|
||||
#include "OBJstream.H"
|
||||
@ -131,8 +132,8 @@ int main(int argc, char *argv[])
|
||||
// Create
|
||||
faMesh aMesh(mesh, meshDefDict);
|
||||
|
||||
// Mesh information
|
||||
#include "printMeshSummary.H"
|
||||
// Mesh information (less verbose)
|
||||
faMeshTools::printMeshChecks(aMesh, 0);
|
||||
|
||||
if (args.found("write-edges-obj"))
|
||||
{
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
|
||||
Description
|
||||
Summary of faMesh information
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
{
|
||||
const faBoundaryMesh& patches = aMesh.boundary();
|
||||
const label nNonProcessor = patches.nNonProcessor();
|
||||
const label nPatches = patches.size();
|
||||
|
||||
Info<< "----------------" << nl
|
||||
<< "Mesh Information" << nl
|
||||
<< "----------------" << nl
|
||||
<< " " << "boundingBox: " << boundBox(aMesh.points()) << nl
|
||||
<< " " << "nFaces: " << returnReduce(aMesh.nFaces(), sumOp<label>())
|
||||
<< nl;
|
||||
|
||||
|
||||
Info<< "----------------" << nl
|
||||
<< "Patches" << nl
|
||||
<< "----------------" << nl;
|
||||
|
||||
for (label patchi = 0; patchi < nNonProcessor; ++patchi)
|
||||
{
|
||||
const faPatch& p = patches[patchi];
|
||||
|
||||
// Report physical size (nEdges) not virtual size
|
||||
Info<< " " << "patch " << p.index()
|
||||
<< " (size: " << returnReduce(p.nEdges(), sumOp<label>())
|
||||
<< ") name: " << p.name()
|
||||
<< nl;
|
||||
}
|
||||
|
||||
Info<< "----------------" << nl
|
||||
<< "Used polyPatches: " << flatOutput(aMesh.whichPolyPatches()) << nl;
|
||||
|
||||
|
||||
// Geometry information
|
||||
Info<< nl;
|
||||
{
|
||||
scalarMinMax limit(gMinMax(aMesh.S().field()));
|
||||
Info<< "Face area:" << nl
|
||||
<< " min = " << limit.min() << " max = " << limit.max() << nl;
|
||||
}
|
||||
|
||||
{
|
||||
scalarMinMax limit(minMax(aMesh.magLe().primitiveField()));
|
||||
|
||||
// Include processor boundaries into 'internal' edges
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
for (label patchi = nNonProcessor; patchi < nPatches; ++patchi)
|
||||
{
|
||||
limit.add(minMax(aMesh.magLe().boundaryField()[patchi]));
|
||||
}
|
||||
|
||||
reduce(limit, minMaxOp<scalar>());
|
||||
}
|
||||
|
||||
Info<< "Edge length (internal):" << nl
|
||||
<< " min = " << limit.min() << " max = " << limit.max() << nl;
|
||||
|
||||
|
||||
// Include (non-processor) boundaries
|
||||
for (label patchi = 0; patchi < nNonProcessor; ++patchi)
|
||||
{
|
||||
limit.add(minMax(aMesh.magLe().boundaryField()[patchi]));
|
||||
}
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
reduce(limit, minMaxOp<scalar>());
|
||||
}
|
||||
|
||||
Info<< "Edge length:" << nl
|
||||
<< " min = " << limit.min()
|
||||
<< " max = " << limit.max() << nl;
|
||||
}
|
||||
|
||||
// Not particularly meaningful
|
||||
#if 0
|
||||
{
|
||||
MinMax<vector> limit(gMinMax(aMesh.faceAreaNormals().field()));
|
||||
|
||||
Info<< "Face area normals:" << nl
|
||||
<< " min = " << limit.min() << " max = " << limit.max() << nl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -60,8 +60,8 @@ Usage
|
||||
Use numbered patch/zone (not names) directly from ccm ids.
|
||||
|
||||
- \par -remap \<name\>
|
||||
Use specified remapping dictionary instead of
|
||||
<tt>constant/remapping</tt>
|
||||
Alternative remapping dictionary
|
||||
(default: <tt>constant/remapping</tt>)
|
||||
|
||||
- \par -scale \<factor\>
|
||||
Specify an alternative geometry scaling factor.
|
||||
@ -121,7 +121,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"remap",
|
||||
"name",
|
||||
"Use specified remapping dictionary instead of <constant/remapping>"
|
||||
"Alternative remapping dictionary (default: 'constant/remapping')"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
|
||||
@ -46,8 +46,8 @@ Usage
|
||||
No backup of existing output files.
|
||||
|
||||
- \par -remap \<name\>
|
||||
Use specified remapping dictionary instead of
|
||||
<tt>constant/remapping</tt>
|
||||
Alternative remapping dictionary
|
||||
(default: <tt>constant/remapping</tt>)
|
||||
|
||||
- \par -results
|
||||
Convert results only to CCM format
|
||||
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"remap",
|
||||
"name",
|
||||
"Use specified remapping dictionary instead of <constant/remapping>"
|
||||
"Alternative remapping dictionary (default: 'constant/remapping')"
|
||||
);
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -428,7 +428,7 @@ void Foam::mergeAndWrite
|
||||
// Renumber local ids -> global ids
|
||||
globalIndex(mesh.nPoints()).inplaceToGlobal(mergedIDs);
|
||||
|
||||
globalIndex gatherer(mergedIDs.size(), globalIndex::gatherOnly{});
|
||||
globalIndex gatherer(globalIndex::gatherOnly{}, mergedIDs.size());
|
||||
gatherer.gatherInplace(mergedIDs);
|
||||
gatherer.gatherInplace(mergedPts);
|
||||
}
|
||||
|
||||
@ -1,2 +1,5 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lmeshTools
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2018-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,6 +65,9 @@ Usage
|
||||
#include "TimePaths.H"
|
||||
#include "ListOps.H"
|
||||
#include "stringOps.H"
|
||||
#include "regionProperties.H"
|
||||
#include "polyMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -243,8 +246,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
timeSelector::addOptions(true, true); // constant(true), zero(true)
|
||||
|
||||
#include "addAllRegionOptions.H"
|
||||
#include "setRootCase.H"
|
||||
|
||||
wordList regionNames0;
|
||||
{
|
||||
// Dummy time just for the database to read regionProperties
|
||||
|
||||
autoPtr<Time> dummyTimePtr(Time::New(args));
|
||||
|
||||
const auto& runTime = *dummyTimePtr;
|
||||
|
||||
// Handle -allRegions, -regions, -region
|
||||
#include "getAllRegionOptions.H"
|
||||
|
||||
regionNames0 = std::move(regionNames);
|
||||
}
|
||||
|
||||
dryrun = args.dryRun();
|
||||
verbose = args.verbose();
|
||||
|
||||
@ -414,51 +432,65 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "\nTime = " << timeName << nl;
|
||||
|
||||
label count = 0;
|
||||
wordList files;
|
||||
|
||||
if (nProcs)
|
||||
for (const word& regionName : regionNames0)
|
||||
{
|
||||
if (leadProcIdx >= 0)
|
||||
const word& regionDir = polyMesh::regionName(regionName);
|
||||
|
||||
if (regionNames0.size() > 1)
|
||||
{
|
||||
files = getFiles(args.path()/procDirs[leadProcIdx], timeName);
|
||||
Info<< "region = " << regionName << nl;
|
||||
}
|
||||
|
||||
for (const fileName& procDir : procDirs)
|
||||
label count = 0;
|
||||
wordList files;
|
||||
|
||||
if (nProcs)
|
||||
{
|
||||
if (leadProcIdx >= 0)
|
||||
{
|
||||
files =
|
||||
getFiles
|
||||
(
|
||||
args.path()/procDirs[leadProcIdx],
|
||||
timeName/regionDir
|
||||
);
|
||||
}
|
||||
|
||||
for (const fileName& procDir : procDirs)
|
||||
{
|
||||
count += restoreFields
|
||||
(
|
||||
method,
|
||||
args.path()/procDir/timeName/regionDir,
|
||||
wordHashSet(files),
|
||||
targetNames
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
files = getFiles(args.path(), timeName/regionDir);
|
||||
}
|
||||
Pstream::broadcast(files);
|
||||
|
||||
count += restoreFields
|
||||
(
|
||||
method,
|
||||
args.path()/procDir/timeName,
|
||||
args.path()/timeName/regionDir,
|
||||
wordHashSet(files),
|
||||
targetNames
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Pstream::master())
|
||||
|
||||
if (dryrun)
|
||||
{
|
||||
files = getFiles(args.path(), timeName);
|
||||
Info<< "dry-run: ";
|
||||
}
|
||||
Pstream::broadcast(files);
|
||||
|
||||
count += restoreFields
|
||||
(
|
||||
method,
|
||||
args.path()/timeName,
|
||||
wordHashSet(files),
|
||||
targetNames
|
||||
);
|
||||
Info<< "moved " << count << " files" << nl;
|
||||
}
|
||||
|
||||
if (dryrun)
|
||||
{
|
||||
Info<< "dry-run: ";
|
||||
}
|
||||
Info<< "moved " << count << " files" << nl;
|
||||
}
|
||||
|
||||
Info<< "\nEnd\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"decomposeParDict",
|
||||
"file",
|
||||
"Use specified file for decomposePar dictionary"
|
||||
"Alternative decomposePar dictionary file"
|
||||
);
|
||||
|
||||
#include "addAllRegionOptions.H"
|
||||
@ -887,9 +887,7 @@ int main(int argc, char *argv[])
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudDir,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
// Note: look up "positions" for backwards compatibility
|
||||
@ -972,9 +970,7 @@ int main(int argc, char *argv[])
|
||||
mesh,
|
||||
runTime.timeName(),
|
||||
cloud::prefix/cloudDirs[cloudI],
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
IOobject::NO_REGISTER
|
||||
);
|
||||
|
||||
lagrangianFieldCache.readAllFields
|
||||
|
||||
@ -45,10 +45,10 @@ if (doLagrangian)
|
||||
|
||||
ensightOutput::writeCloudPositions
|
||||
(
|
||||
os.ref(),
|
||||
mesh,
|
||||
cloudName,
|
||||
cloudExists,
|
||||
os
|
||||
cloudExists
|
||||
);
|
||||
|
||||
Info<< " positions";
|
||||
@ -86,26 +86,34 @@ if (doLagrangian)
|
||||
}
|
||||
|
||||
bool wrote = false;
|
||||
if (fieldType == scalarIOField::typeName)
|
||||
do
|
||||
{
|
||||
autoPtr<ensightFile> os =
|
||||
ensCase.newCloudData<scalar>(cloudName, fieldName);
|
||||
#undef ensight_WRITE_CLOUD_FIELD
|
||||
#define ensight_WRITE_CLOUD_FIELD(PrimitiveType) \
|
||||
\
|
||||
if (fieldType == IOField<PrimitiveType>::typeName) \
|
||||
{ \
|
||||
autoPtr<ensightFile> os = \
|
||||
ensCase.newCloudData<PrimitiveType> \
|
||||
( \
|
||||
cloudName, \
|
||||
fieldName \
|
||||
); \
|
||||
\
|
||||
wrote = ensightOutput::readWriteCloudField<PrimitiveType> \
|
||||
( \
|
||||
os.ref(), \
|
||||
fieldObject, \
|
||||
fieldExists \
|
||||
); \
|
||||
break; \
|
||||
}
|
||||
|
||||
wrote = ensightOutput::writeCloudField<scalar>
|
||||
(
|
||||
fieldObject, fieldExists, os
|
||||
);
|
||||
}
|
||||
else if (fieldType == vectorIOField::typeName)
|
||||
{
|
||||
autoPtr<ensightFile> os =
|
||||
ensCase.newCloudData<vector>(cloudName, fieldName);
|
||||
ensight_WRITE_CLOUD_FIELD(scalar);
|
||||
ensight_WRITE_CLOUD_FIELD(vector);
|
||||
|
||||
wrote = ensightOutput::writeCloudField<vector>
|
||||
(
|
||||
fieldObject, fieldExists, os
|
||||
);
|
||||
}
|
||||
#undef ensight_WRITE_CLOUD_FIELD
|
||||
} while (false);
|
||||
|
||||
if (wrote)
|
||||
{
|
||||
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
void resetCloud(const label localCloudSize)
|
||||
{
|
||||
cloudGather_.reset(localCloudSize, globalIndex::gatherOnly{});
|
||||
cloudGather_.reset(globalIndex::gatherOnly{}, localCloudSize);
|
||||
origParcelIds_.resize_nocopy(localCloudSize);
|
||||
origProcIds_.resize_nocopy(localCloudSize);
|
||||
}
|
||||
|
||||
@ -194,10 +194,15 @@ triSurface triangulate
|
||||
|
||||
// CGAL : every processor has whole surface
|
||||
|
||||
globalIndex globalFaceIdx(surface.size(), globalIndex::gatherOnly());
|
||||
globalIndex globalPointIdx
|
||||
const globalIndex globalFaceIdx
|
||||
(
|
||||
surface.points().size(), globalIndex::gatherOnly()
|
||||
globalIndex::gatherOnly{},
|
||||
surface.size()
|
||||
);
|
||||
const globalIndex globalPointIdx
|
||||
(
|
||||
globalIndex::gatherOnly{},
|
||||
surface.points().size()
|
||||
);
|
||||
|
||||
List<labelledTri> globalSurfaceTris(globalFaceIdx.gather(surface));
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -25,7 +25,7 @@
|
||||
# Extracts useful info from log file.
|
||||
logReport()
|
||||
{
|
||||
local logfile=$1
|
||||
local logfile="$1"
|
||||
|
||||
# logfile is path/to/case/log.application
|
||||
caseName=$(dirname $logfile | sed -e 's/\(.*\)\.\///g')
|
||||
@ -77,6 +77,7 @@ collectLogs()
|
||||
|
||||
local appDir log logFiles
|
||||
|
||||
echo "====" > testLoopReport
|
||||
for appDir in *
|
||||
do
|
||||
[ -d $appDir ] || continue
|
||||
@ -99,14 +100,15 @@ collectLogs()
|
||||
logReport $log
|
||||
done
|
||||
echo
|
||||
done > testLoopReport
|
||||
echo "===="
|
||||
done >> testLoopReport
|
||||
echo "====" >> testLoopReport
|
||||
echo "====" 1>&2
|
||||
}
|
||||
|
||||
|
||||
removeLogs()
|
||||
{
|
||||
echo "Removing backup files"
|
||||
echo "Removing backup files" 1>&2
|
||||
|
||||
find . \( \
|
||||
-name '*~' -o -name '*.bak' \
|
||||
|
||||
@ -82,11 +82,15 @@ export WM_LABEL_SIZE=32
|
||||
# = Opt | Dbg | Debug | Prof
|
||||
export WM_COMPILE_OPTION=Opt
|
||||
|
||||
# [WM_COMPILE_CONTROL] - additional control for compiler rules
|
||||
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
|
||||
# +gold : with gold linker
|
||||
# +lld : with lld linker (with clang)
|
||||
# +mold : with mold linker (with clang)
|
||||
# ~libz : without libz compression
|
||||
# +openmp : with openmp
|
||||
# ~openmp : without openmp
|
||||
# +ccache : use ccache
|
||||
# ccache=... : ccache command (unquoted, single/double or <> quoted)
|
||||
# version=... : compiler suffix (eg, "11" for gcc-11)
|
||||
#export WM_COMPILE_CONTROL="+gold"
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -359,9 +359,6 @@ case HPMPI:
|
||||
case i686:
|
||||
set _foamFoundDir=lib/linux_ia32
|
||||
breaksw
|
||||
case ia64:
|
||||
set _foamFoundDir=lib/linux_ia64
|
||||
breaksw
|
||||
endsw
|
||||
|
||||
if ( "${_foamFoundDir}" != "" ) then
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -52,11 +52,6 @@ case Linux:
|
||||
setenv WM_COMPILER_LIB_ARCH 64 # Use lib64
|
||||
breaksw
|
||||
|
||||
case armv7l:
|
||||
setenv WM_ARCH linuxARM7
|
||||
setenv WM_COMPILER_LIB_ARCH 32 # Use lib32
|
||||
breaksw
|
||||
|
||||
case ppc64:
|
||||
setenv WM_ARCH linuxPPC64
|
||||
setenv WM_COMPILER_LIB_ARCH 64 # Use lib64
|
||||
@ -71,10 +66,6 @@ case Linux:
|
||||
setenv WM_ARCH linux
|
||||
breaksw
|
||||
|
||||
case ia64:
|
||||
setenv WM_ARCH linuxIA64
|
||||
breaksw
|
||||
|
||||
default:
|
||||
echo "openfoam: (`uname -m`) - unknown Linux processor type"
|
||||
breaksw
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -363,7 +363,6 @@ HPMPI)
|
||||
case "$(uname -m)" in
|
||||
x86_64) _foamFoundDir=lib/linux_amd64 ;;
|
||||
i686) _foamFoundDir=lib/linux_ia32 ;;
|
||||
ia64) _foamFoundDir=lib/linux_ia64 ;;
|
||||
*) unset _foamFoundDir ;;
|
||||
esac
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
# Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
@ -49,11 +49,6 @@ Linux)
|
||||
export WM_COMPILER_LIB_ARCH=64 # Use lib64
|
||||
;;
|
||||
|
||||
armv7l)
|
||||
WM_ARCH=linuxARM7
|
||||
export WM_COMPILER_LIB_ARCH=32 # Use lib32
|
||||
;;
|
||||
|
||||
ppc64)
|
||||
WM_ARCH=linuxPPC64
|
||||
export WM_COMPILER_LIB_ARCH=64 # Use lib64
|
||||
@ -68,10 +63,6 @@ Linux)
|
||||
WM_ARCH=linux
|
||||
;;
|
||||
|
||||
ia64)
|
||||
WM_ARCH=linuxIA64
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "openfoam: ($(uname -m)) - unknown Linux processor type" 1>&2
|
||||
;;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2206 |
|
||||
| \\ / O peration | Version: v2212 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -118,7 +118,14 @@ OptimisationSwitches
|
||||
// Default: 1e9
|
||||
maxMasterFileBufferSize 1e9;
|
||||
|
||||
commsType nonBlocking; //scheduled; //blocking;
|
||||
// Upper limit when bundling off-processor field transfers (ensight).
|
||||
// for component-wise transfer (uses float: 4 bytes)
|
||||
// Eg, 5M for 50 ranks of 100k cells
|
||||
ensight.maxChunk 5000000;
|
||||
|
||||
|
||||
// Default communication type (nonBlocking | scheduled | blocking);
|
||||
commsType nonBlocking;
|
||||
floatTransfer 0;
|
||||
nProcsSimpleSum 0;
|
||||
|
||||
@ -136,6 +143,7 @@ OptimisationSwitches
|
||||
// global reduction, even if multi-pass is not needed)
|
||||
maxCommsSize 0;
|
||||
|
||||
|
||||
// Trap floating point exception.
|
||||
// Can override with FOAM_SIGFPE env variable (true|false)
|
||||
trapFpe 1;
|
||||
@ -539,6 +547,7 @@ DebugSwitches
|
||||
empty 0;
|
||||
engineMesh 0;
|
||||
enrichedPatch 0;
|
||||
ensight 0;
|
||||
epsilonWallFunction 0;
|
||||
errorDrivenRefinement 0;
|
||||
evaporationModel 0;
|
||||
|
||||
@ -82,11 +82,15 @@ setenv WM_LABEL_SIZE 32
|
||||
# = Opt | Dbg | Debug | Prof
|
||||
setenv WM_COMPILE_OPTION Opt
|
||||
|
||||
# [WM_COMPILE_CONTROL] - additional control for compiler rules
|
||||
# [WM_COMPILE_CONTROL] - additional control for compilation/linking
|
||||
# +gold : with gold linker
|
||||
# +lld : with lld linker (with clang)
|
||||
# +mold : with mold linker (with clang)
|
||||
# ~libz : without libz compression
|
||||
# +openmp : with openmp
|
||||
# ~openmp : without openmp
|
||||
# +ccache : use ccache
|
||||
# ccache=... : ccache command (unquoted, single/double or <> quoted)
|
||||
# version=... : compiler suffix (eg, "11" for gcc-11)
|
||||
#setenv WM_COMPILE_CONTROL "+gold"
|
||||
|
||||
|
||||
@ -4,17 +4,19 @@ EXE_INC = \
|
||||
LIB_LIBS = \
|
||||
$(FOAM_LIBBIN)/libOSspecific.o
|
||||
|
||||
/* libz: (not disabled) */
|
||||
ifeq (,$(findstring ~libz,$(WM_COMPILE_CONTROL)))
|
||||
EXE_INC += -DHAVE_LIBZ
|
||||
LIB_LIBS += -lz
|
||||
endif
|
||||
|
||||
|
||||
/* Never self-link (WM_PROJECT == OpenFOAM), but do link to Pstream */
|
||||
|
||||
PROJECT_LIBS =
|
||||
|
||||
ifeq (libo,$(FOAM_LINK_DUMMY_PSTREAM))
|
||||
LIB_LIBS += $(FOAM_LIBBIN)/dummy/libPstream.o
|
||||
else
|
||||
LIB_LIBS += -L$(FOAM_LIBBIN)/dummy -lPstream
|
||||
endif
|
||||
|
||||
/* libz */
|
||||
EXE_INC += -DHAVE_LIBZ
|
||||
|
||||
LIB_LIBS += -lz
|
||||
|
||||
|
||||
/* Project lib dependencies. Never self-link (WM_PROJECT == OpenFOAM) */
|
||||
PROJECT_LIBS =
|
||||
|
||||
@ -57,16 +57,6 @@ Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
|
||||
(
|
||||
HashPtrTable<T, Key, Hash>&& rhs
|
||||
)
|
||||
:
|
||||
parent_type(std::move(rhs))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
|
||||
@ -99,6 +99,12 @@ public:
|
||||
//- Construct given initial table capacity
|
||||
inline explicit HashPtrTable(const label size);
|
||||
|
||||
//- Copy construct, making a copy of each element
|
||||
HashPtrTable(const this_type& rhs);
|
||||
|
||||
//- Move construct
|
||||
inline HashPtrTable(this_type&& rhs);
|
||||
|
||||
//- Construct from Istream using given Istream constructor class
|
||||
template<class INew>
|
||||
HashPtrTable(Istream& is, const INew& inew);
|
||||
@ -109,12 +115,6 @@ public:
|
||||
//- Construct from dictionary with default dictionary constructor class
|
||||
explicit HashPtrTable(const dictionary& dict);
|
||||
|
||||
//- Copy construct, making a copy of each element
|
||||
HashPtrTable(const this_type& rhs);
|
||||
|
||||
//- Move construct
|
||||
HashPtrTable(this_type&& rhs);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~HashPtrTable();
|
||||
|
||||
@ -38,6 +38,16 @@ inline Foam::HashPtrTable<T, Key, Hash>::HashPtrTable(const label size)
|
||||
{}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
inline Foam::HashPtrTable<T, Key, Hash>::HashPtrTable
|
||||
(
|
||||
HashPtrTable<T, Key, Hash>&& rhs
|
||||
)
|
||||
:
|
||||
parent_type(std::move(rhs))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
|
||||
@ -62,8 +62,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef HashSet_H
|
||||
#define HashSet_H
|
||||
#ifndef Foam_HashSet_H
|
||||
#define Foam_HashSet_H
|
||||
|
||||
#include "HashTable.H"
|
||||
#include "IndirectList.H"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -273,7 +273,7 @@ public:
|
||||
//- Find and return a hashed entry. FatalError if it does not exist.
|
||||
inline const T& at(const Key& key) const;
|
||||
|
||||
//- Return true if hashed entry is found in table
|
||||
//- True if hashed key is found in table
|
||||
inline bool found(const Key& key) const;
|
||||
|
||||
//- Find and return an iterator set at the hashed entry
|
||||
@ -630,39 +630,7 @@ protected:
|
||||
>::type;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- True if iterator points to an entry
|
||||
// This can be used directly instead of comparing to end()
|
||||
inline bool good() const noexcept;
|
||||
|
||||
//- True if iterator points to an entry - same as good()
|
||||
inline bool found() const noexcept;
|
||||
|
||||
//- The key associated with the iterator
|
||||
inline const Key& key() const;
|
||||
|
||||
//- Write the (key, val) pair
|
||||
inline Ostream& print(Ostream& os) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- True if iterator points to an entry
|
||||
// This can be used directly instead of comparing to end()
|
||||
explicit inline operator bool() const noexcept;
|
||||
|
||||
//- Compare hash-entry element pointers.
|
||||
// Independent of const/non-const access
|
||||
template<bool Any>
|
||||
inline bool operator==(const Iterator<Any>& iter) const noexcept;
|
||||
|
||||
template<bool Any>
|
||||
inline bool operator!=(const Iterator<Any>& iter) const noexcept;
|
||||
|
||||
|
||||
protected:
|
||||
friend class HashTable; // For begin/find constructors
|
||||
|
||||
// Protected Data
|
||||
|
||||
@ -680,10 +648,13 @@ protected:
|
||||
// to mark the position.
|
||||
label index_;
|
||||
|
||||
// Friendship with HashTable, for begin/find constructors
|
||||
friend class HashTable;
|
||||
|
||||
|
||||
// Protected Constructors
|
||||
|
||||
//- Default construct (end iterator)
|
||||
//- Default construct. Also the same as the end iterator
|
||||
inline constexpr Iterator() noexcept;
|
||||
|
||||
//- Construct from begin of hash-table
|
||||
@ -704,9 +675,47 @@ protected:
|
||||
{
|
||||
return *reinterpret_cast<const Iterator<Any>*>(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- True if iterator points to an entry
|
||||
// This can be used directly instead of comparing to end()
|
||||
bool good() const noexcept { return entry_; }
|
||||
|
||||
//- True if iterator points to an entry - same as good()
|
||||
bool found() const noexcept { return entry_; }
|
||||
|
||||
//- The key associated with the iterator
|
||||
const Key& key() const { return entry_->key(); }
|
||||
|
||||
//- Write the (key, val) pair
|
||||
inline Ostream& print(Ostream& os) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- True if iterator points to an entry
|
||||
// This can be used directly instead of comparing to end()
|
||||
explicit operator bool() const noexcept { return entry_; }
|
||||
|
||||
//- Compare hash-entry element pointers.
|
||||
// Independent of const/non-const access
|
||||
template<bool Any>
|
||||
bool operator==(const Iterator<Any>& iter) const noexcept
|
||||
{
|
||||
return (entry_ == iter.entry_);
|
||||
}
|
||||
|
||||
template<bool Any>
|
||||
bool operator!=(const Iterator<Any>& iter) const noexcept
|
||||
{
|
||||
return (entry_ != iter.entry_);
|
||||
}
|
||||
};
|
||||
|
||||
//- Low-level entry erasure using iterator internals.
|
||||
// This invalidates the iterator until the next ++ operation.
|
||||
// \return True if the corresponding entry existed and was removed
|
||||
|
||||
@ -36,8 +36,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef HashTableCore_H
|
||||
#define HashTableCore_H
|
||||
#ifndef Foam_HashTableCore_H
|
||||
#define Foam_HashTableCore_H
|
||||
|
||||
#include "label.H"
|
||||
#include "uLabel.H"
|
||||
@ -66,7 +66,7 @@ struct HashTableCore
|
||||
ClassName("HashTable");
|
||||
|
||||
//- Default construct
|
||||
HashTableCore() = default;
|
||||
HashTableCore() noexcept = default;
|
||||
|
||||
static_assert
|
||||
(
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -109,32 +109,6 @@ Foam::HashTable<T, Key, Hash>::Iterator<Const>::increment()
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
inline bool
|
||||
Foam::HashTable<T, Key, Hash>::Iterator<Const>::good() const noexcept
|
||||
{
|
||||
return entry_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
inline bool
|
||||
Foam::HashTable<T, Key, Hash>::Iterator<Const>::found() const noexcept
|
||||
{
|
||||
return entry_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
inline const Key& Foam::HashTable<T, Key, Hash>::Iterator<Const>::key() const
|
||||
{
|
||||
return entry_->key();
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
inline Foam::Ostream& Foam::HashTable<T, Key, Hash>::Iterator<Const>::print
|
||||
@ -150,39 +124,6 @@ inline Foam::Ostream& Foam::HashTable<T, Key, Hash>::Iterator<Const>::print
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
inline Foam::HashTable<T, Key, Hash>::Iterator<Const>::operator
|
||||
bool() const noexcept
|
||||
{
|
||||
return entry_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
template<bool Any>
|
||||
inline bool Foam::HashTable<T, Key, Hash>::Iterator<Const>::operator==
|
||||
(
|
||||
const Iterator<Any>& iter
|
||||
) const noexcept
|
||||
{
|
||||
return entry_ == iter.entry_;
|
||||
}
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
template<bool Const>
|
||||
template<bool Any>
|
||||
inline bool Foam::HashTable<T, Key, Hash>::Iterator<Const>::operator!=
|
||||
(
|
||||
const Iterator<Any>& iter
|
||||
) const noexcept
|
||||
{
|
||||
return entry_ != iter.entry_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * STL iterator * * * * * * * * * * * * * * //
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
|
||||
@ -40,8 +40,8 @@ See also
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Map_H
|
||||
#define Map_H
|
||||
#ifndef Foam_Map_H
|
||||
#define Foam_Map_H
|
||||
|
||||
#include "HashTable.H"
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
parent_type(std::move(map))
|
||||
{}
|
||||
|
||||
//- Construct from an initializer list
|
||||
//- Construct from pairs of values
|
||||
Map(std::initializer_list<std::pair<label, T>> map)
|
||||
:
|
||||
parent_type(map)
|
||||
|
||||
@ -35,8 +35,8 @@ See also
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PtrMap_H
|
||||
#define PtrMap_H
|
||||
#ifndef Foam_PtrMap_H
|
||||
#define Foam_PtrMap_H
|
||||
|
||||
#include "HashPtrTable.H"
|
||||
|
||||
|
||||
@ -99,38 +99,12 @@ void Foam::IOobjectList::syncNames(wordList& objNames)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::IOobjectList::IOobjectList()
|
||||
:
|
||||
HashPtrTable<IOobject>()
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOobjectList::IOobjectList(const label nObjects)
|
||||
:
|
||||
HashPtrTable<IOobject>(nObjects) // Could also use 2*nObjects instead
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOobjectList::IOobjectList(const IOobjectList& list)
|
||||
:
|
||||
HashPtrTable<IOobject>(list)
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOobjectList::IOobjectList(IOobjectList&& list)
|
||||
:
|
||||
HashPtrTable<IOobject>(std::move(list))
|
||||
{}
|
||||
|
||||
|
||||
Foam::IOobjectList::IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
const fileName& local,
|
||||
IOobjectOption::readOption rOpt,
|
||||
IOobjectOption::writeOption wOpt,
|
||||
bool registerObject
|
||||
IOobjectOption ioOpt
|
||||
)
|
||||
:
|
||||
HashPtrTable<IOobject>()
|
||||
@ -152,9 +126,7 @@ Foam::IOobjectList::IOobjectList
|
||||
newInstance,
|
||||
local,
|
||||
db,
|
||||
rOpt,
|
||||
wOpt,
|
||||
registerObject
|
||||
ioOpt
|
||||
);
|
||||
|
||||
bool ok = false;
|
||||
@ -182,51 +154,7 @@ Foam::IOobjectList::IOobjectList
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
|
||||
{
|
||||
if (objectPtr)
|
||||
{
|
||||
return insert(objectPtr->name(), objectPtr);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOobjectList::add(autoPtr<IOobject>&& objectPtr)
|
||||
{
|
||||
if (objectPtr)
|
||||
{
|
||||
return insert(objectPtr->name(), objectPtr);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::IOobjectList::append(const IOobjectList& other)
|
||||
{
|
||||
label count = 0;
|
||||
|
||||
forAllConstIters(other, iter)
|
||||
{
|
||||
if (!found(iter.key()))
|
||||
{
|
||||
if (IOobject::debug)
|
||||
{
|
||||
InfoInFunction << "Copy append " << iter.key() << nl;
|
||||
}
|
||||
|
||||
set(iter.key(), new IOobject(*iter.val()));
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::IOobjectList::append(IOobjectList&& other)
|
||||
Foam::label Foam::IOobjectList::merge(IOobjectList&& other)
|
||||
{
|
||||
// Remove by name to avoid uncertainties about invalid iterators
|
||||
|
||||
@ -240,7 +168,7 @@ Foam::label Foam::IOobjectList::append(IOobjectList&& other)
|
||||
{
|
||||
if (IOobject::debug)
|
||||
{
|
||||
InfoInFunction << "Move append " << key << nl;
|
||||
InfoInFunction << "Merge " << key << nl;
|
||||
}
|
||||
|
||||
if (add(other.remove(key)))
|
||||
@ -254,12 +182,6 @@ Foam::label Foam::IOobjectList::append(IOobjectList&& other)
|
||||
}
|
||||
|
||||
|
||||
bool Foam::IOobjectList::remove(const IOobject& io)
|
||||
{
|
||||
return erase(io.name());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::IOobject* Foam::IOobjectList::cfindObject
|
||||
@ -267,23 +189,28 @@ const Foam::IOobject* Foam::IOobjectList::cfindObject
|
||||
const word& objName
|
||||
) const
|
||||
{
|
||||
const_iterator iter = cfind(objName);
|
||||
// Like HashPtrTable::get(), or lookup() with a nullptr
|
||||
const IOobject* io = nullptr;
|
||||
|
||||
if (iter.found())
|
||||
const const_iterator iter(cfind(objName));
|
||||
if (iter.good())
|
||||
{
|
||||
if (IOobject::debug)
|
||||
io = iter.val();
|
||||
}
|
||||
|
||||
if (IOobject::debug)
|
||||
{
|
||||
if (io)
|
||||
{
|
||||
InfoInFunction << "Found " << objName << endl;
|
||||
}
|
||||
|
||||
return iter.val();
|
||||
}
|
||||
else if (IOobject::debug)
|
||||
{
|
||||
InfoInFunction << "Could not find " << objName << endl;
|
||||
else
|
||||
{
|
||||
InfoInFunction << "Could not find " << objName << endl;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return io;
|
||||
}
|
||||
|
||||
|
||||
@ -444,14 +371,6 @@ void Foam::IOobjectList::checkNames(const bool syncPar) const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::IOobjectList::operator=(IOobjectList&& list)
|
||||
{
|
||||
transfer(list);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const IOobjectList& list)
|
||||
|
||||
@ -29,9 +29,12 @@ Class
|
||||
|
||||
Description
|
||||
List of IOobjects with searching and retrieving facilities.
|
||||
Implemented as a HashTable, so the various sorted methods should
|
||||
be used if traversing in parallel.
|
||||
|
||||
SourceFiles
|
||||
IOobjectList.C
|
||||
IOobjectListI.H
|
||||
IOobjectListTemplates.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -41,8 +44,8 @@ SourceFiles
|
||||
|
||||
#include "HashPtrTable.H"
|
||||
#include "HashSet.H"
|
||||
#include "UPtrList.H"
|
||||
#include "IOobject.H"
|
||||
#include "UPtrList.H"
|
||||
#include "wordRes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -164,27 +167,52 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null with default (128) table capacity
|
||||
IOobjectList();
|
||||
//- Default construct (empty) with default (128) table capacity
|
||||
inline IOobjectList();
|
||||
|
||||
//- Construct given initial table capacity
|
||||
explicit IOobjectList(const label nObjects);
|
||||
inline explicit IOobjectList(const label nObjects);
|
||||
|
||||
//- Copy construct
|
||||
IOobjectList(const IOobjectList& list);
|
||||
inline IOobjectList(const IOobjectList& list);
|
||||
|
||||
//- Move construct
|
||||
IOobjectList(IOobjectList&& list);
|
||||
inline IOobjectList(IOobjectList&& list);
|
||||
|
||||
//- Construct from objectRegistry and instance path
|
||||
//- Construct from registry, instance, io options
|
||||
inline IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
IOobjectOption ioOpt
|
||||
);
|
||||
|
||||
//- Construct from registry, instance, local, io options
|
||||
IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
const fileName& local = "",
|
||||
IOobjectOption::readOption rOpt = IOobjectOption::MUST_READ,
|
||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||
bool registerObject = true
|
||||
const fileName& local,
|
||||
IOobjectOption ioOpt
|
||||
);
|
||||
|
||||
//- Construct from registry, instance, registration option
|
||||
//- with MUST_READ, NO_WRITE
|
||||
inline IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
IOobjectOption::registerOption = IOobjectOption::REGISTER
|
||||
);
|
||||
|
||||
//- Construct from registry, instance, local, registration option
|
||||
//- with MUST_READ, NO_WRITE
|
||||
inline IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
const fileName& local,
|
||||
IOobjectOption::registerOption = IOobjectOption::REGISTER
|
||||
);
|
||||
|
||||
|
||||
@ -196,35 +224,32 @@ public:
|
||||
|
||||
// Basic methods
|
||||
|
||||
//- Add IOobject to the list
|
||||
bool add(autoPtr<IOobject>& objectPtr);
|
||||
//- Move insert IOobject into the list
|
||||
inline bool add(autoPtr<IOobject>&& objectPtr);
|
||||
|
||||
//- Add IOobject to the list
|
||||
bool add(autoPtr<IOobject>&& objectPtr);
|
||||
//- Move insert IOobject into the list
|
||||
inline bool add(autoPtr<IOobject>& objectPtr);
|
||||
|
||||
//- Copy append objects from other to this list, but do not overwrite
|
||||
//- existing keys.
|
||||
//
|
||||
// \return number of items added
|
||||
label append(const IOobjectList& other);
|
||||
|
||||
//- Move append objects from other to this list, but do not overwrite
|
||||
//- Add objects from other to this list without overwriting
|
||||
//- existing keys.
|
||||
// After calling this, the other parameter will contains any items
|
||||
// that could not be moved.
|
||||
// that could not be merged.
|
||||
//
|
||||
// \return number of items added
|
||||
label append(IOobjectList&& other);
|
||||
// \return number of items merged
|
||||
label merge(IOobjectList&& other);
|
||||
|
||||
//- Remove IOobject from the list, by name or by iterator.
|
||||
//- Remove object from the list, by name or by iterator.
|
||||
//
|
||||
// \return autoPtr<IOobject>
|
||||
using HashPtrTable<IOobject>::remove;
|
||||
|
||||
//- Remove IOobject from the list.
|
||||
//- Remove object from the list by its IOobject::name().
|
||||
//
|
||||
// \return True if object was removed
|
||||
bool remove(const IOobject& io);
|
||||
// \return autoPtr<IOobject>
|
||||
autoPtr<IOobject> remove(const IOobject& io)
|
||||
{
|
||||
return remove(io.name());
|
||||
}
|
||||
|
||||
|
||||
// Lookup single item
|
||||
@ -708,11 +733,32 @@ public:
|
||||
void operator=(const IOobjectList&) = delete;
|
||||
|
||||
//- Move assignment
|
||||
void operator=(IOobjectList&& list);
|
||||
inline void operator=(IOobjectList&& list);
|
||||
|
||||
|
||||
// Housekeeping
|
||||
|
||||
//- Construct from registry, instance, local, io options
|
||||
// \deprecated(2022-11) prefer IOobjectOption or registerOption
|
||||
IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
const fileName& local,
|
||||
IOobjectOption::readOption rOpt,
|
||||
IOobjectOption::writeOption wOpt = IOobjectOption::NO_WRITE,
|
||||
bool registerObject = true
|
||||
)
|
||||
:
|
||||
IOobjectList
|
||||
(
|
||||
db,
|
||||
instance,
|
||||
local,
|
||||
IOobjectOption(rOpt, wOpt, registerObject)
|
||||
)
|
||||
{}
|
||||
|
||||
//- Deprecated(2018-11) Locate an object by name (c-string).
|
||||
//- Disambiguated from multiple-lookup version by calling parameter.
|
||||
// \deprecated(2018-11) use findObject() for non-ambiguous resolution
|
||||
@ -741,6 +787,10 @@ Ostream& operator<<(Ostream& os, const IOobjectList& list);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "IOobjectListI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "IOobjectListTemplates.C"
|
||||
#endif
|
||||
|
||||
142
src/OpenFOAM/db/IOobjectList/IOobjectListI.H
Normal file
142
src/OpenFOAM/db/IOobjectList/IOobjectListI.H
Normal file
@ -0,0 +1,142 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2022 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList()
|
||||
:
|
||||
HashPtrTable<IOobject>()
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList(const label nObjects)
|
||||
:
|
||||
HashPtrTable<IOobject>(nObjects) // Could also use 2*nObjects instead
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList(const IOobjectList& list)
|
||||
:
|
||||
HashPtrTable<IOobject>(list)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList(IOobjectList&& list)
|
||||
:
|
||||
HashPtrTable<IOobject>(std::move(list))
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
IOobjectOption ioOpt
|
||||
)
|
||||
:
|
||||
IOobjectList(db, instance, fileName::null, ioOpt)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
IOobjectOption::registerOption registerObject
|
||||
)
|
||||
:
|
||||
IOobjectList
|
||||
(
|
||||
db,
|
||||
instance,
|
||||
fileName::null,
|
||||
IOobjectOption
|
||||
(
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
registerObject
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
inline Foam::IOobjectList::IOobjectList
|
||||
(
|
||||
const objectRegistry& db,
|
||||
const fileName& instance,
|
||||
const fileName& local,
|
||||
IOobjectOption::registerOption registerObject
|
||||
)
|
||||
:
|
||||
IOobjectList
|
||||
(
|
||||
db,
|
||||
instance,
|
||||
local,
|
||||
IOobjectOption
|
||||
(
|
||||
IOobjectOption::MUST_READ,
|
||||
IOobjectOption::NO_WRITE,
|
||||
registerObject
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline bool Foam::IOobjectList::add(autoPtr<IOobject>&& objectPtr)
|
||||
{
|
||||
if (objectPtr)
|
||||
{
|
||||
return insert(objectPtr->name(), std::move(objectPtr));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::IOobjectList::add(autoPtr<IOobject>& objectPtr)
|
||||
{
|
||||
if (objectPtr)
|
||||
{
|
||||
return insert(objectPtr->name(), std::move(objectPtr));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
inline void Foam::IOobjectList::operator=(IOobjectList&& list)
|
||||
{
|
||||
transfer(list);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -308,30 +308,38 @@ const Foam::IOobject* Foam::IOobjectList::cfindObject
|
||||
const word& objName
|
||||
) const
|
||||
{
|
||||
const_iterator iter = cfind(objName);
|
||||
// Like HashPtrTable::get(), or lookup() with a nullptr
|
||||
const IOobject* io = nullptr;
|
||||
|
||||
if (iter.found())
|
||||
const const_iterator iter(cfind(objName));
|
||||
if (iter.good())
|
||||
{
|
||||
const IOobject* io = iter.val();
|
||||
io = iter.val();
|
||||
}
|
||||
|
||||
if (io->isHeaderClass<Type>())
|
||||
if (IOobject::debug)
|
||||
{
|
||||
if (io)
|
||||
{
|
||||
if (IOobject::debug)
|
||||
if (io->isHeaderClass<Type>())
|
||||
{
|
||||
InfoInFunction << "Found " << objName << endl;
|
||||
}
|
||||
|
||||
return io;
|
||||
else
|
||||
{
|
||||
InfoInFunction << "Found " << objName
|
||||
<< " with different type" << endl;
|
||||
}
|
||||
}
|
||||
else if (IOobject::debug)
|
||||
else
|
||||
{
|
||||
InfoInFunction
|
||||
<< "Found " << objName << " of different type" << endl;
|
||||
InfoInFunction << "Could not find " << objName << endl;
|
||||
}
|
||||
}
|
||||
else if (IOobject::debug)
|
||||
|
||||
if (io && io->isHeaderClass<Type>())
|
||||
{
|
||||
InfoInFunction << "Could not find " << objName << endl;
|
||||
return io;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
||||
@ -126,7 +126,7 @@ void Foam::IFstream::rewind()
|
||||
if (IOstreamOption::COMPRESSED == ifstreamPointer::whichCompression())
|
||||
{
|
||||
lineNumber_ = 1; // Reset line number
|
||||
ifstreamPointer::reopen_gz(this->name() + ".gz");
|
||||
ifstreamPointer::reopen_gz(this->name());
|
||||
setState(ifstreamPointer::get()->rdstate());
|
||||
}
|
||||
else
|
||||
@ -150,7 +150,7 @@ Foam::IFstream& Foam::IFstream::operator()() const
|
||||
if (!good())
|
||||
{
|
||||
// Also checks .gz file
|
||||
if (isFile(this->name(), true))
|
||||
if (Foam::isFile(this->name(), true))
|
||||
{
|
||||
check(FUNCTION_NAME);
|
||||
FatalIOError.exit();
|
||||
|
||||
@ -64,14 +64,14 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from pathname
|
||||
//- Construct from pathname, default or specified stream options
|
||||
explicit IFstream
|
||||
(
|
||||
const fileName& pathname,
|
||||
IOstreamOption streamOpt = IOstreamOption()
|
||||
);
|
||||
|
||||
//- Construct from pathname, format (version)
|
||||
//- Construct from pathname and format
|
||||
IFstream
|
||||
(
|
||||
const fileName& pathname,
|
||||
|
||||
@ -56,12 +56,19 @@ Foam::OFstream::OFstream
|
||||
|
||||
Foam::OFstream::OFstream
|
||||
(
|
||||
IOstreamOption::atomicType atomic,
|
||||
const fileName& pathname,
|
||||
IOstreamOption streamOpt,
|
||||
const bool append
|
||||
IOstreamOption::appendType append
|
||||
)
|
||||
:
|
||||
Foam::ofstreamPointer(pathname, streamOpt.compression(), append),
|
||||
Foam::ofstreamPointer
|
||||
(
|
||||
pathname,
|
||||
streamOpt.compression(),
|
||||
(IOstreamOption::appendType::APPEND == append),
|
||||
(IOstreamOption::atomicType::ATOMIC == atomic)
|
||||
),
|
||||
OSstream(*(ofstreamPointer::get()), pathname, streamOpt)
|
||||
{
|
||||
setClosed();
|
||||
@ -100,7 +107,9 @@ Foam::OFstream::OFstream
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::OFstream::~OFstream()
|
||||
{}
|
||||
{
|
||||
ofstreamPointer::close(this->name());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -137,15 +146,8 @@ const std::ostream& Foam::OFstream::stdStream() const
|
||||
|
||||
void Foam::OFstream::rewind()
|
||||
{
|
||||
if (IOstreamOption::COMPRESSED == ofstreamPointer::whichCompression())
|
||||
{
|
||||
ofstreamPointer::reopen_gz(this->name() + ".gz");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reopen (truncate)
|
||||
ofstreamPointer::reopen(this->name());
|
||||
}
|
||||
// Reopen (truncate) std::ostream
|
||||
ofstreamPointer::reopen(this->name());
|
||||
|
||||
// As per OSstream::rewind()
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user