Compare commits

..

8 Commits

Author SHA1 Message Date
95fe43b079 TUT: Add and update overset tutorials 2021-08-23 19:31:22 -07:00
10b7479dca COMP: Compilation of src with Allwmake 2021-08-23 19:30:43 -07:00
054e3ebc8b ENH: Update overset solvers 2021-08-23 19:29:54 -07:00
3dc63dc67c ENH: Updating tutorials 2021-08-23 12:06:18 -07:00
141b8376f3 ENh: Updating overset solvers
1) Deleting ddtCorr option
2) Deleting fluxInterpolation flux option
3) Reducing control readers files
2021-08-23 12:05:36 -07:00
72b9a002a2 ENH: adding cellTypes for use in overset to cellSetOption 2021-08-23 12:05:35 -07:00
808565a673 ENH: Delete unused ot updated files 2021-08-23 12:03:33 -07:00
5da36a3386 ENH: overset lib modifications
1) Creating static/dynamic oversetFvMesh
2) Adding helper functions for overset solvers in include
3) Changes to allow overlapping patches from the inset mesh on the
   background mesh for cellVolumeWeightCell, trackingInverseDistanc
   and inverseDistance stencils.
2021-08-23 12:03:33 -07:00
2531 changed files with 29241 additions and 66417 deletions

View File

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

View File

@ -8,7 +8,7 @@ wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
}
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
echo "Argument parse error"
echo "Argument parse error";
else
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
echo " Check your OpenFOAM environment and installation"
@ -23,23 +23,23 @@ else
echo "mpirun=$(command -v mpirun || true)"
fi
echo
# Report compiler information. First non-blank line from --version output
# Report compiler information
compiler="$(wmake -show-path-cxx 2>/dev/null || true)"
if [ -x "$compiler" ]
then
echo "compiler=$compiler"
"$compiler" --version 2>/dev/null | sed -e '/^$/d;q'
"$compiler" --version 2>/dev/null | sed -ne '1p'
else
echo "compiler=unknown"
fi
echo
echo ========================================
echo "========================================"
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
echo "Starting compile ${WM_PROJECT_DIR##*/} ${0##*/}"
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
echo ========================================
echo "========================================"
echo
# Compile tools for wmake
@ -62,21 +62,24 @@ else
echo "Skip ThirdParty (no directory)"
fi
# OpenFOAM libraries
echo "========================================"
echo "Compile OpenFOAM libraries"
echo
src/Allwmake $targetType $*
# OpenFOAM applications
echo "========================================"
echo "Compile OpenFOAM applications"
echo
applications/Allwmake $targetType $*
# Additional components/modules
if [ "$FOAM_MODULE_PREFIX" = false ] || [ "$FOAM_MODULE_PREFIX" = none ]
then
echo ========================================
echo "========================================"
echo "OpenFOAM modules disabled (prefix=${FOAM_MODULE_PREFIX})"
echo
else
# Use wmake -all instead of Allwmake to allow for overrides
elif [ -d "$WM_PROJECT_DIR/modules" ]
then
(cd "$WM_PROJECT_DIR/modules" 2>/dev/null && wmake -all)
fi
@ -90,7 +93,7 @@ _foamCountDirEntries()
# Some summary information
echo
date "+%Y-%m-%d %H:%M:%S %z" 2>/dev/null || echo "date is unknown"
echo ========================================
echo "========================================"
echo " ${WM_PROJECT_DIR##*/}"
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
@ -100,6 +103,6 @@ echo " patch = $(etc/openfoam -show-patch 2>/dev/null)"
echo " bin = $(_foamCountDirEntries "$FOAM_APPBIN") entries"
echo " lib = $(_foamCountDirEntries "$FOAM_LIBBIN") entries"
echo
echo ========================================
echo "========================================"
#------------------------------------------------------------------------------

View File

@ -1,2 +1,2 @@
api=2109
api=2107
patch=0

View File

@ -40,9 +40,9 @@ Violations of the Trademark are monitored, and will be duly prosecuted.
If OpenFOAM has already been compiled on your system, simply source
the appropriate `etc/bashrc` or `etc/cshrc` file and get started.
For example, for the OpenFOAM-v2112 version:
For example, for the OpenFOAM-v2106 version:
```
source /installation/path/OpenFOAM-v2112/etc/bashrc
source /installation/path/OpenFOAM-v2106/etc/bashrc
```
## Compiling OpenFOAM
@ -127,8 +127,8 @@ These 3rd-party sources are normally located in a directory parallel
to the OpenFOAM directory. For example,
```
/path/parent
|-- OpenFOAM-v2112
\-- ThirdParty-v2112
|-- OpenFOAM-v2106
\-- ThirdParty-v2106
```
There are, however, many cases where this simple convention is inadequate:
@ -136,7 +136,7 @@ There are, however, many cases where this simple convention is inadequate:
operating system or cluster installation provides it)
* When we have changed the OpenFOAM directory name to some arbitrary
directory name, e.g. openfoam-sandbox2112, etc..
directory name, e.g. openfoam-sandbox2106, etc..
* When we would like any additional 3rd party software to be located
inside of the OpenFOAM directory to ensure that the installation is
@ -156,9 +156,9 @@ when locating the ThirdParty directory with the following precedence:
2. PREFIX/ThirdParty-VERSION
* this corresponds to the traditional approach
3. PREFIX/ThirdParty-vAPI
* allows for an updated value of VERSION, *eg*, `v2112-myCustom`,
* allows for an updated value of VERSION, *eg*, `v2106-myCustom`,
without requiring a renamed ThirdParty. The API value would still
be `2112` and the original `ThirdParty-v2112/` would be found.
be `2106` and the original `ThirdParty-v2106/` would be found.
4. PREFIX/ThirdParty-API
* same as the previous example, but using an unadorned API value.
5. PREFIX/ThirdParty-common

View File

@ -8,17 +8,13 @@ wmake -check-dir "$WM_PROJECT_DIR/applications" 2>/dev/null || {
}
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
echo "Argument parse error"
echo "Argument parse error";
else
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
echo " Check your OpenFOAM environment and installation"
exit 1
fi
echo ========================================
echo Compile OpenFOAM applications
echo ========================================
#------------------------------------------------------------------------------
wmake -all $targetType solvers
@ -28,9 +24,3 @@ wmake -all $targetType utilities
## wmake -all $targetType tools
#------------------------------------------------------------------------------
echo ========================================
echo Done OpenFOAM applications
echo ========================================
#------------------------------------------------------------------------------

View File

@ -149,7 +149,7 @@ int main(int argc, char *argv[])
mesh.update();
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
//surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
// Since solver contains no time loop it would never execute
// function objects so do it ourselves

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -43,9 +43,9 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
Info<< "Selecting drag model " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -57,9 +57,7 @@ Foam::autoPtr<Foam::PDRDragModel> Foam::PDRDragModel::New
}
return autoPtr<PDRDragModel>
(
ctorPtr(dict, turbulence, rho, U, phi)
);
(cstrIter()(dict, turbulence, rho, U, phi));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,9 +42,9 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
Info<< "Selecting flame-wrinkling model " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -55,7 +55,7 @@ Foam::autoPtr<Foam::XiEqModel> Foam::XiEqModel::New
) << exit(FatalIOError);
}
return autoPtr<XiEqModel>(ctorPtr(dict, thermo, turbulence, Su));
return autoPtr<XiEqModel>(cstrIter()(dict, thermo, turbulence, Su));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -42,9 +42,9 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
Info<< "Selecting flame-wrinkling model " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -55,7 +55,7 @@ Foam::autoPtr<Foam::XiGModel> Foam::XiGModel::New
) << exit(FatalIOError);
}
return autoPtr<XiGModel>(ctorPtr(dict, thermo, turbulence, Su));
return autoPtr<XiGModel>(cstrIter()(dict, thermo, turbulence, Su));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -45,9 +45,9 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
Info<< "Selecting flame-wrinkling model " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -59,9 +59,7 @@ Foam::autoPtr<Foam::XiModel> Foam::XiModel::New
}
return autoPtr<XiModel>
(
ctorPtr(dict, thermo, turbulence, Su, rho, b, phi)
);
(cstrIter()(dict, thermo, turbulence, Su, rho, b, phi));
}

View File

@ -1,4 +0,0 @@
bool ddtCorr
(
pimple.dict().getOrDefault("ddtCorr", true)
);

View File

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

View File

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

View File

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

View File

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

View File

@ -49,7 +49,7 @@
);
}
// Update the boundary values of the reciprocal time-step
// Update tho boundary values of the reciprocal time-step
rDeltaT.correctBoundaryConditions();
Info<< "Flow time scale min/max = "

View File

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

View File

@ -86,9 +86,6 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readControls.H"
#include "readDyMControls.H"
#include "compressibleCourantNo.H"
@ -128,45 +125,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);
}

View File

@ -21,16 +21,6 @@ surfaceScalarField phiHbyA
fvc::flux(rho*HbyA) + phig
);
if (ddtCorr)
{
surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
phiHbyA +=
faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi));
}
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
@ -122,8 +112,4 @@ if (thermo.dpdt())
}
}
surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
phi *= faceMask;

View File

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

View File

@ -9,7 +9,7 @@ forAll(fluidRegions, i)
const rhoThermo& thermo = refCast<const rhoThermo>(thermoFluid[i]);
const auto& bpsi = thermo.T().boundaryField();
forAll(bpsi, patchI)
forAll (bpsi, patchI)
{
if (bpsi[patchI].useImplicit())
{
@ -23,7 +23,7 @@ forAll(solidRegions, i)
solidThermo& thermo = thermos[i];
const auto& bpsi = thermo.T().boundaryField();
forAll(bpsi, patchI)
forAll (bpsi, patchI)
{
if (bpsi[patchI].useImplicit())
{
@ -37,25 +37,7 @@ forAll(fluidRegions, i)
const rhoThermo& thermo = refCast<const rhoThermo>(thermoFluid[i]);
if (coupled)
{
Info<< "Create fvMatrixAssembly." << endl;
fvMatrixAssemblyPtr.reset
(
new fvMatrix<scalar>
(
thermo.he(),
dimEnergy/dimTime
)
);
break;
}
}
if (coupled && !fvMatrixAssemblyPtr)
{
forAll(solidRegions, i)
{
solidThermo& thermo = thermos[i];
Info<< "Create fvMatrixAssembly." << endl;
Info << "Create fvMatrixAssembly." << endl;
fvMatrixAssemblyPtr.reset
(
new fvMatrix<scalar>

View File

@ -1,5 +1,3 @@
#include "createRDeltaT.H"
Info<< "Reading field p\n" << endl;
volScalarField p
(

View File

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

View File

@ -1,5 +1,4 @@
// Solve the Momentum equation
MRF.correctBoundaryVelocity(U);
tmp<fvVectorMatrix> tUEqn

View File

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

View File

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

View File

@ -46,11 +46,7 @@ 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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -68,10 +64,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 +83,7 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readControls.H"
#include "readDyMControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
@ -97,45 +92,26 @@ 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())
);
if (correctPhi)
{
// Corrects flux on separated regions
#include "correctPhi.H"
}
// 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;
fvc::makeRelative(phi, U);
// 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

View File

@ -1,29 +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();
@ -38,18 +20,14 @@ if (pimple.nCorrPISO() <= 1)
phiHbyA = fvc::flux(HbyA);
if (ddtCorr)
if (runTime.outputTime())
{
surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
phiHbyA += rAUf*faceMaskOld*fvc::ddtCorr(U, Uf);
volScalarField divPhiHbyA("divPhiHbyA", fvc::div(phiHbyA));
divPhiHbyA.write();
}
MRF.makeRelative(phiHbyA);
// WIP
if (p.needReference())
{
fvc::makeRelative(phiHbyA, U);
@ -57,7 +35,8 @@ if (p.needReference())
fvc::makeAbsolute(phiHbyA, U);
}
// WIP: To adjust phi on fringe faces to help mass
// conservation
if (adjustFringe)
{
fvc::makeRelative(phiHbyA, U);
@ -79,27 +58,29 @@ 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);
}
}
// Excludes error in interpolated/hole cells
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
volVectorField gradP(fvc::grad(p));
if (runTime.outputTime())
{
volVectorField Ucorrected("Ucorrected", U);
Ucorrected.write();
// 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);
volScalarField divPhiCon("divPhiCon", fvc::div(phi));
divPhiCon.write();
}
{
Uf = fvc::interpolate(U);
@ -109,9 +90,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;

View File

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

View File

@ -81,8 +81,6 @@ Note
#include "pimpleControl.H"
#include "CorrectPhi.H"
#include "fvOptions.H"
#include "localEulerDdtScheme.H"
#include "fvcSmooth.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -109,12 +107,6 @@ int main(int argc, char *argv[])
turbulence->validate();
if (!LTS)
{
#include "CourantNo.H"
#include "setInitialDeltaT.H"
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
@ -122,16 +114,8 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readDyMControls.H"
if (LTS)
{
#include "setRDeltaT.H"
}
else
{
#include "CourantNo.H"
#include "setDeltaT.H"
}
#include "CourantNo.H"
#include "setDeltaT.H"
++runTime;

View File

@ -1,69 +0,0 @@
{
volScalarField& rDeltaT = trDeltaT.ref();
const dictionary& pimpleDict = pimple.dict();
scalar maxCo
(
pimpleDict.getOrDefault<scalar>("maxCo", 0.8)
);
scalar rDeltaTSmoothingCoeff
(
pimpleDict.getOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.02)
);
scalar rDeltaTDampingCoeff
(
pimpleDict.getOrDefault<scalar>("rDeltaTDampingCoeff", 1.0)
);
scalar maxDeltaT
(
pimpleDict.getOrDefault<scalar>("maxDeltaT", GREAT)
);
volScalarField rDeltaT0("rDeltaT0", rDeltaT);
// Set the reciprocal time-step from the local Courant number
rDeltaT.ref() = max
(
1/dimensionedScalar("maxDeltaT", dimTime, maxDeltaT),
fvc::surfaceSum(mag(phi))()()
/((2*maxCo)*mesh.V())
);
// Update the boundary values of the reciprocal time-step
rDeltaT.correctBoundaryConditions();
Info<< "Flow time scale min/max = "
<< gMin(1/rDeltaT.primitiveField())
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
if (rDeltaTSmoothingCoeff < 1.0)
{
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
}
Info<< "Smoothed flow time scale min/max = "
<< gMin(1/rDeltaT.primitiveField())
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
// Limit rate of change of time scale
// - reduce as much as required
// - only increase at a fraction of old time scale
if
(
rDeltaTDampingCoeff < 1.0
&& runTime.timeIndex() > runTime.startTimeIndex() + 1
)
{
rDeltaT =
rDeltaT0
*max(rDeltaT/rDeltaT0, scalar(1) - rDeltaTDampingCoeff);
Info<< "Damped flow time scale min/max = "
<< gMin(1/rDeltaT.primitiveField())
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
}
}

View File

@ -24,7 +24,3 @@ bool adjustFringe
(
simple.dict().getOrDefault("oversetAdjustPhi", false)
);
bool massFluxInterpolation
(
simple.dict().getOrDefault("massFluxInterpolation", false)
);

View File

@ -1,5 +1,5 @@
{
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
//surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", faceMask*fvc::interpolate(rAU));
@ -7,12 +7,6 @@
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));

View File

@ -123,7 +123,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
)
:
fv::cellSetOption(sourceName, modelType, dict, mesh),
alphaSolidT_(Function1<scalar>::New("alphaSolidT", coeffs_, &mesh)),
alphaSolidT_(Function1<scalar>::New("alphaSolidT", coeffs_)),
L_("L", dimEnergy/dimMass, coeffs_),
relax_(coeffs_.getOrDefault("relax", 0.9)),
Cu_(coeffs_.getOrDefault<scalar>("Cu", 100000)),

View File

@ -33,7 +33,7 @@ bool Foam::fv::VoFSolidificationMeltingSource::read(const dictionary& dict)
{
if (fv::cellSetOption::read(dict))
{
alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_, &mesh_);
alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_);
coeffs_.readEntry("L", L_);
coeffs_.readIfPresent("relax", relax_);
coeffs_.readIfPresent("Cu", Cu_);

View File

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

View File

@ -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,25 +151,7 @@ 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;
#include "correctPhiFaceMask.H"
// Correct phi on individual regions
if (correctPhi)
@ -182,12 +161,6 @@ int main(int argc, char *argv[])
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 +175,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();

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2015 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -44,9 +44,9 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
Info<< "Selecting incompressible transport model " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -58,9 +58,7 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
}
return autoPtr<mixtureViscosityModel>
(
ctorPtr(name, dict, U, phi)
);
(cstrIter()(name, dict, U, phi));
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2014-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -111,9 +111,9 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
Info<< "Selecting relative velocity model " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -127,7 +127,7 @@ Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
return
autoPtr<relativeVelocityModel>
(
ctorPtr
cstrIter()
(
dict.optionalSubDict(modelType + "Coeffs"),
mixture

View File

@ -11,6 +11,7 @@ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \

View File

@ -343,12 +343,12 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
focalLaserPosition_
(
Function1<point>::New("focalLaserPosition", *this, &mesh_)
Function1<point>::New("focalLaserPosition", *this)
),
laserDirection_
(
Function1<vector>::New("laserDirection", *this, &mesh_)
Function1<vector>::New("laserDirection", *this)
),
focalLaserRadius_(get<scalar>("focalLaserRadius")),
@ -359,7 +359,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
sigma_(0),
I0_(0),
laserPower_(Function1<scalar>::New("laserPower", *this, &mesh_)),
laserPower_(Function1<scalar>::New("laserPower", *this)),
powerDistribution_(),
reflectionSwitch_(false),
@ -441,11 +441,11 @@ Foam::radiation::laserDTRM::laserDTRM
focalLaserPosition_
(
Function1<point>::New("focalLaserPosition", *this, &mesh_)
Function1<point>::New("focalLaserPosition", *this)
),
laserDirection_
(
Function1<vector>::New("laserDirection", *this, &mesh_)
Function1<vector>::New("laserDirection", *this)
),
focalLaserRadius_(get<scalar>("focalLaserRadius")),
@ -456,7 +456,7 @@ Foam::radiation::laserDTRM::laserDTRM
sigma_(0),
I0_(0),
laserPower_(Function1<scalar>::New("laserPower", *this, &mesh_)),
laserPower_(Function1<scalar>::New("laserPower", *this)),
powerDistribution_(),
reflectionSwitch_(false),

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,9 +41,9 @@ Foam::radiation::reflectionModel::New
Info<< "Selecting reflectionModel " << modelType << endl;
auto* ctorPtr = dictionaryConstructorTable(modelType);
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -54,7 +54,7 @@ Foam::radiation::reflectionModel::New
) << exit(FatalIOError);
}
return autoPtr<reflectionModel>(ctorPtr(dict, mesh));
return autoPtr<reflectionModel>(cstrIter()(dict, mesh));
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020-2021 OpenCFD Ltd.
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020 Henning Scheufler
-------------------------------------------------------------------------------
License
@ -269,14 +269,14 @@ correct()
// interface heat resistance
mDotc_ = interfaceArea_*R_*max(TSat - T, T0)/L;
mDote_ = interfaceArea_*R_*max(T - TSat, T0)/L;
mDote_ = interfaceArea_*R_*(T - TSat)/L;
// Limiting max condensation
forAll(mDotc_, celli)
{
scalar rhobyDt = mixture_.rho1().value()/mesh_.time().deltaTValue();
scalar maxEvap = mixture_.alpha1()[celli]*rhobyDt; // positive
scalar maxCond = -mixture_.alpha2()[celli]*rhobyDt; // negative
mDote_[celli] = min(max(mDote_[celli], maxCond), maxEvap);
mDotc_[celli] = min(max(mDotc_[celli], maxCond), maxEvap);
}
@ -326,6 +326,14 @@ correct()
void Foam::temperaturePhaseChangeTwoPhaseMixtures::interfaceHeatResistance::
updateInterface()
{
const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo>
(
mesh_.lookupObject<basicThermo>(basicThermo::dictName)
);
const dimensionedScalar& TSat = thermo.TSat();
// interface heat resistance
// Interpolating alpha1 cell centre values to mesh points (vertices)
@ -346,6 +354,30 @@ updateInterface()
mag(cutCell.faceArea())/mesh_.V()[celli];
}
}
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
forAll(pbm, patchi)
{
if (isA<wallPolyPatch>(pbm[patchi]))
{
const polyPatch& pp = pbm[patchi];
forAll(pp.faceCells(),i)
{
const label pCelli = pp.faceCells()[i];
if
(
(TSat.value() - T[pCelli]) > 0
&& mixture_.alpha1()[pCelli] < 0.9
)
{
interfaceArea_[pCelli] =
mag(pp.faceAreas()[i])/mesh_.V()[pCelli];
}
}
}
}
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -54,9 +54,9 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
Info<< "Selecting phaseChange model " << modelType << endl;
auto* ctorPtr = componentsConstructorTable(modelType);
auto cstrIter = componentsConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -70,7 +70,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixture::New
return
autoPtr<temperaturePhaseChangeTwoPhaseMixture>
(
ctorPtr(thermo, mesh)
cstrIter()(thermo, mesh)
);
}

View File

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

View File

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

View File

@ -49,13 +49,9 @@ 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"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,8 +72,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"
@ -102,6 +97,7 @@ int main(int argc, char *argv[])
#include "correctPhi.H"
}
#include "createUf.H"
#include "createControls.H"
#include "setCellMask.H"
#include "setInterpolatedCells.H"
@ -119,7 +115,7 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readControls.H"
#include "readDyMControls.H"
if (LTS)
{
@ -164,27 +160,7 @@ int main(int argc, char *argv[])
// Update cellMask field for blocking out hole cells
#include "setCellMask.H"
#include "setInterpolatedCells.H"
const surfaceScalarField faceMaskOld
(
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
);
// 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;
#include "correctPhiFaceMask.H"
// Correct phi on individual regions
if (correctPhi)
@ -194,17 +170,8 @@ int main(int argc, char *argv[])
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);
}
if (mesh.changing() && checkMeshCourantNo)
@ -213,14 +180,9 @@ int main(int argc, char *argv[])
}
}
#include "alphaControls.H"
#include "alphaEqnSubCycle.H"
const surfaceScalarField faceMask
(
localMin<scalar>(mesh).interpolate(cellMask)
);
rhoPhi *= faceMask;
mixture.correct();

View File

@ -1,8 +1,5 @@
{
rAU = 1.0/UEqn.A();
//mesh.interpolate(rAU);
surfaceScalarField faceMask(localMin<scalar>(mesh).interpolate(cellMask));
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
@ -12,22 +9,8 @@
//HbyA = rAU*UEqn.H();
HbyA = constrainHbyA(rAU*H, U, p_rgh);
if (massFluxInterpolation)
{
#include "interpolatedFaces.H"
}
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())
@ -37,13 +20,6 @@
fvc::makeAbsolute(phiHbyA, U);
}
if (adjustFringe)
{
fvc::makeRelative(phiHbyA, U);
oversetAdjustPhi(phiHbyA, U);
fvc::makeAbsolute(phiHbyA, U);
}
surfaceScalarField phig
(
(

View File

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

View File

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

View File

@ -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,26 +151,7 @@ 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;
#include "correctPhiFaceMask.H"
if (correctPhi)
{
@ -181,12 +160,6 @@ int main(int argc, char *argv[])
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);
}

View File

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

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,9 +56,9 @@ Foam::phaseChangeTwoPhaseMixture::New
Info<< "Selecting phaseChange model " << modelType << endl;
auto* ctorPtr = componentsConstructorTable(modelType);
auto cstrIter = componentsConstructorTablePtr_->cfind(modelType);
if (!ctorPtr)
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
@ -69,7 +69,7 @@ Foam::phaseChangeTwoPhaseMixture::New
) << exit(FatalIOError);
}
return autoPtr<phaseChangeTwoPhaseMixture>(ctorPtr(U, phi));
return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi));
}

View File

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

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,155 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 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 allocation patterns when reading into an existing list.
\*---------------------------------------------------------------------------*/
#include "DynamicList.H"
#include "DynamicField.H"
#include "IOstreams.H"
#include "ITstream.H"
#include "OTstream.H"
#include "StringStream.H"
#include "FlatOutput.H"
#include "ListOps.H"
#include "labelRange.H"
#include "labelIndList.H"
using namespace Foam;
template<class T, int SizeMin>
void printInfo
(
const word& tag,
const DynamicList<T, SizeMin>& list,
const bool showSize = true
)
{
Info<< '<' << tag;
if (showSize)
{
Info<< " size=\"" << list.size()
<< "\" capacity=\"" << list.capacity() << "\"";
if (list.cdata())
{
Info<< " ptr=\"" << name(list.cdata()) << "\"";
}
else
{
Info<< " ptr=\"nullptr\"";
}
}
Info<< '>' << nl << flatOutput(list) << nl
<< "</" << tag << ">\n" << endl;
}
template<class T, int SizeMin>
void printInfo
(
const word& tag,
const DynamicField<T, SizeMin>& list,
const bool showSize = true
)
{
Info<< '<' << tag;
if (showSize)
{
Info<< " size=\"" << list.size()
<< "\" capacity=\"" << list.capacity() << "\"";
if (list.cdata())
{
Info<< " ptr=\"" << name(list.cdata()) << "\"";
}
else
{
Info<< " ptr=\"nullptr\"";
}
}
Info<< '>' << nl << flatOutput(list) << nl
<< "</" << tag << ">\n" << endl;
}
template<class T, int SizeMin>
void readList
(
DynamicList<T, SizeMin>& output,
const UList<T>& input
)
{
OTstream os;
os << input;
ITstream is("input", os.tokens());
is >> output;
}
template<class T, int SizeMin>
void readList
(
DynamicField<T, SizeMin>& output,
const UList<T>& input
)
{
OTstream os;
os << input;
ITstream is("input", os.tokens());
is >> output;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
//
{
DynamicList<label, 64> list1;
list1.resize(4);
ListOps::identity(list1);
list1.resize(3);
printInfo("", list1);
// list1.clear();
// printInfo("", list1);
list1.setCapacity(3);
printInfo("", list1);
}
Info<< "\nEnd\n";
return 0;
}
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -138,53 +138,4 @@ cosine6
}
expr1
{
type expression;
functions<scalar>
{
func1 constant 21;
func2 constant 15;
sin constant -5;
}
functions<vector>
{
vfunc3 constant (1 2 3);
vfunc4 constant (3 2 1);
}
expression
#{
100 * fn:vfunc3() & fn:vfunc4() * (vector::z) .z()
* (fn:sin(arg()) + fn:func1(fn:func2()))
#};
}
expr2
{
type expression;
functions<scalar>
{
func1 constant 21;
func2 constant 15;
sin constant -5;
}
functions<vector>
{
vfunc3 constant (1 2 3);
vfunc4 constant (3 2 1);
}
expression
#{
(fn:vfunc3() & vector::z) * arg()
#};
}
// ************************************************************************* //

View File

@ -48,9 +48,7 @@ See also
#include "scalarList.H"
#include "HashOps.H"
#include "ListOps.H"
#include "IndirectList.H"
#include "SubList.H"
#include "SliceList.H"
#include "ListPolicy.H"
#include <list>
@ -346,7 +344,7 @@ int main(int argc, char *argv[])
labelList longLabelList = identity(25);
reverse(longLabelList);
FixedList<label, 6> fixedLabelList({0,1,2,3,4,5});
FixedList<label, 6> fixedLabelList{0,1,2,3,4,5};
const labelList constLabelList = identity(25);
Info<< "full-list: " << flatOutput(longLabelList) << nl;
@ -355,36 +353,6 @@ int main(int argc, char *argv[])
Info<<"sub range:" << range1 << "=";
Info<< SubList<label>(longLabelList, range1) << nl;
{
// A valid range
const labelRange subset(4, 5);
// Assign some values
longLabelList.slice(subset) = identity(subset.size());
Info<<"assigned identity in range:" << subset
<< "=> " << flatOutput(longLabelList) << nl;
labelList someList(identity(24));
longLabelList.slice(subset) =
SliceList<label>(someList, sliceRange(8, subset.size(), 2));
Info<<"assigned sliced/stride in range:" << subset
<< "=> " << flatOutput(longLabelList) << nl;
// Does not work - need a reference, not a temporary
// Foam::reverse(longLabelList[subset]);
{
auto sub(longLabelList.slice(subset));
Foam::reverse(sub);
}
Info<<"reversed range:" << subset
<< "=> " << flatOutput(longLabelList) << nl;
}
labelRange range2(7, 8);
Info<<"sub range:" << range2 << "=";
Info<< SubList<label>(longLabelList, range2) << nl;
@ -400,29 +368,29 @@ int main(int argc, char *argv[])
// > constLabelList[labelRange(23,5)] = 5;
// Check correct overlaps
longLabelList.slice(labelRange(-10, 12)) = 200;
longLabelList.slice({18,3}) = 100;
longLabelList.slice({23,3}) = 400;
longLabelList[labelRange(-10, 12)] = 200;
longLabelList[{18,3}] = 100;
longLabelList[{23,3}] = 400;
// and complete misses
longLabelList.slice({500,50}) = 100;
longLabelList[{500,50}] = 100;
// -ve size suppressed by internal 'validateRange' = no-op
longLabelList.slice({5,-5}) = 42;
longLabelList.slice({21,100}) = 42;
longLabelList[{5,-5}] = 42;
longLabelList[{21,100}] = 42;
//Good: does not compile
longLabelList.slice(labelRange(20,50)) = constLabelList;
//> longLabelList[labelRange(20,50)] = constLabelList;
//Good: does not compile
// longLabelList[labelRange(20,50)] = fixedLabelList;
Info<< "updated: " << constLabelList.slice(labelRange(23,5)) << nl;
Info<< "updated: " << constLabelList[labelRange(23,5)] << nl;
Info<< "updated: " << flatOutput(longLabelList) << nl;
//Nope: sort(longLabelList.slice(labelRange(18,5)));
//Nope: sort(longLabelList[labelRange(18,5)]);
{
// Instead
auto sub = longLabelList.slice(labelRange(8));
UList<label> sub = longLabelList[labelRange(8)];
sort(sub);
}
Info<< "sub-sorted: " << flatOutput(longLabelList) << nl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -180,7 +180,7 @@ int main(int argc, char *argv[])
// Fatal with FULLDEBUG
{
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
const label nx = mesh.sizes().x();
const label ny = mesh.sizes().y();
@ -230,7 +230,7 @@ int main(int argc, char *argv[])
<< err.message().c_str() << nl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
}

View File

@ -6,7 +6,6 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -172,7 +171,7 @@ int main(int argc, char *argv[])
Info<< "\ntest operator[] non-const with out-of-range index\n";
// Expect failure
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
@ -191,7 +190,7 @@ int main(int argc, char *argv[])
Info<< "Failed (expected) " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
report(list1);
}
@ -199,7 +198,7 @@ int main(int argc, char *argv[])
Info<< "\ntest operator[] with out-of-range index\n";
// Expect failure
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
@ -213,7 +212,7 @@ int main(int argc, char *argv[])
Info<< "Failed (expected) " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
report(list1);
}
@ -269,7 +268,7 @@ int main(int argc, char *argv[])
// Expect failure
{
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
Info<< "\ntest operator[] assignment with auto-vivify\n";
@ -287,7 +286,7 @@ int main(int argc, char *argv[])
list1.set(36, list1.max_value);
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
report(list1);
}

View File

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

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,111 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 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-PrecisionAdaptor
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "primitiveFields.H"
#include "PrecisionAdaptor.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
Field<double> content1(8);
Field<double> content2(8);
forAll(content1, i)
{
content1[i] = 10 * i;
content2[i] = 10 * i;
}
Foam::reverse(content2);
ConstPrecisionAdaptor<float, double, Field> cadaptor1;
cadaptor1.set(content1);
cadaptor1.commit(); // This is a no-op
Info<< "wrapped: " << cadaptor1() << nl;
cadaptor1.set(content2);
Info<< "wrapped: " << cadaptor1() << nl;
Info<< nl;
PrecisionAdaptor<float, double, Field> adaptor2;
adaptor2.set(content1);
adaptor2.ref() *= 2;
adaptor2.commit(); // Propagate changes back to input now
Info<< "modified wrapped: " << adaptor2() << nl;
adaptor2.set(content2);
adaptor2.ref() *= 2;
adaptor2.commit(); // Propagate changes back to input now
Info<< "modified wrapped: " << adaptor2() << nl;
Info<< "source: " << content1 << nl;
Info<< "source: " << content2 << nl;
content2 *= 2;
Info<< nl
<< "set with " << content2 << nl;
Info<< "wrapped was " << adaptor2() << nl;
adaptor2.set(content2);
Info<< "wrapped now " << adaptor2() << nl;
Info<< "source: " << content2 << nl;
// Can even do this
Foam::reverse(adaptor2.ref());
adaptor2.ref() *= 2;
adaptor2.set(content1); // implicit commit
Info<< "updated: " << content2 << nl;
Info<< nl
<< "input: " << content1 << nl;
adaptor2.ref() *= 2;
adaptor2.clear(); // discard
adaptor2.commit();
Info<< "unchanged: " << content1 << nl;
Info<< nl << "Done" << nl << endl;
return 0;
}
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -271,7 +271,7 @@ int main(int argc, char *argv[])
// This should fail (in FULLDEBUG)
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
Info<<"Random position(10,5): "
@ -282,7 +282,7 @@ int main(int argc, char *argv[])
Info<< "Caught FatalError " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
Info<< "\nDone" << nl << endl;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,7 +40,7 @@ void predicateTests_label(const word& optName, const argList& args)
{
Info<< "predicate tests for " << optName << nl;
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
label val;
@ -52,7 +52,7 @@ void predicateTests_label(const word& optName, const argList& args)
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
}
@ -60,7 +60,7 @@ void predicateTests_scalar(const word& optName, const argList& args)
{
Info<< "predicate tests for " << optName << nl;
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
scalar val;
@ -72,7 +72,7 @@ void predicateTests_scalar(const word& optName, const argList& args)
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
}
@ -121,9 +121,6 @@ int main(int argc, char *argv[])
argList::addArgument("label");
argList::noMandatoryArgs();
argList::addDryRunOption("Just for testing");
argList::addVerboseOption("Increase verbosity");
#include "setRootCase.H"
Pout<< "command-line ("
@ -136,10 +133,6 @@ int main(int argc, char *argv[])
<< "globalPath: " << args.globalPath() << nl
<< nl;
Pout<< "dry-run: " << args.dryRun()
<< " verbose: " << args.verbose() << nl;
if (args.found("relative"))
{
Pout<< "input path: " << args["relative"] << nl

View File

@ -57,8 +57,9 @@ int main(int argc, char *argv[])
#include "addAllRegionOptions.H"
argList::addVerboseOption
argList::addBoolOption
(
"verbose",
"more information about decomposition"
);
@ -70,6 +71,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const auto decompFile = args.get<fileName>(1);
const bool verbose = args.found("verbose");
// Set time from database
#include "createTime.H"
@ -144,7 +146,7 @@ int main(int argc, char *argv[])
nDomains
);
if (args.verbose())
if (verbose)
{
info.printDetails(Info);
Info<< nl;

View File

@ -101,8 +101,8 @@ void doTest(const dictionary& dict)
Info<< dict.dictName() << dict << nl;
// Could fail?
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOErr = FatalIOError.throwing(true);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
@ -120,8 +120,8 @@ void doTest(const dictionary& dict)
{
Info<< "Caught FatalError " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOErr);
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
}
@ -130,8 +130,8 @@ void doTest(const objectRegistry& obr, const dictionary& dict)
Info<< dict.dictName() << dict << nl;
// Could fail?
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOErr = FatalIOError.throwing(true);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
@ -148,8 +148,8 @@ void doTest(const objectRegistry& obr, const dictionary& dict)
{
Info<< "Caught FatalError " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOErr);
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
}

View File

@ -18,8 +18,6 @@ FoamFile
#sinclude "$FOAM_CASE/someUnknownFile"
#includeIfPresent "$FOAM_CASE/someUnknownFile-$FOAM_CASENAME"
zeroVelocity uniform (0 0 0);
internalField uniform 1;
// supply defaults
@ -50,7 +48,7 @@ x 5;
varName x;
// Indirection for keys
//Indirection for keys
key inlet_9;
@ -69,17 +67,13 @@ boundaryField
inlet_5 { $inactive }
inlet_6a { $...inactive } // Relative scoping - fairly horrible to use
inlet_6b { $^inactive } // Absolute scoping
inlet_6c { key ${/key}; } // Absolute scoping
inlet_7 { ${inactive}} // Test variable expansion
inlet_8 { $inactive }
// Variable expansion for a keyword
${key} { $inactive }
#include "testDictInc"
outletBase
outlet
{
type inletOutlet;
inletValue $internalField;
@ -89,36 +83,16 @@ boundaryField
y 6;
}
outlet
{
$outletBase
}
Default_Boundary_Region
{
valueOut $zeroVelocity;
}
// this should have no effect (not in scope)
// this should have no effect
#remove inactive
// But this should work to remove things in different scopes
#remove "/zeroVelocity"
inlet_7 { ${inactive} } // Test variable expansion
inlet_8 { $inactive }
inlet_7a { ${${varType}} } // Test indirection/recursive expansion
inlet_7b { ${${varType}} } // Test indirection/recursive expansion
inlet_7 { ${${varType}}} // Test indirection/recursive expansion
inlet_8 { $active }
#overwrite inlet_8 { type none; }
}
// No patterns with scoped removal
// #remove "/boundaryField/outletB.*"
#remove "/boundaryField/outletBase"
#include "testDict2"
verbatim #{
@ -149,25 +123,10 @@ baz
$active
}
// This should work
#remove x
// this should work
#remove active
// This should work too
// this should work too
#remove ( bar baz )
// Remove a sub-dictionary entry
#remove "/anynumber.*/value"
// Removal does not auto-vivify
#remove "/nonExistentDict/value"
// Add into existing dictionary
"/anynumber.*/someValue" 100;
// Auto-vivify
// - but currently cannot auto-vivify entries with dictionary patterns
"/abd/someValue" 100;
"/def/'someValue.*" 100;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,8 +57,8 @@ scalar try_readScalar(const dictionary& dict, const word& k)
{
scalar val(-GREAT);
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOerr = FatalIOError.throwing(true);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
@ -75,8 +75,8 @@ scalar try_readScalar(const dictionary& dict, const word& k)
Info<< "readScalar(" << k << ") Caught FatalError "
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOerr);
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
return val;
}
@ -87,8 +87,8 @@ scalar try_getScalar(const dictionary& dict, const word& k)
{
scalar val(-GREAT);
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOerr = FatalIOError.throwing(true);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
@ -105,8 +105,8 @@ scalar try_getScalar(const dictionary& dict, const word& k)
Info<< "get<scalar>(" << k << ") Caught FatalError "
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOerr);
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
return val;
}
@ -123,8 +123,8 @@ scalar try_getCheckScalar
{
scalar val(-GREAT);
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOerr = FatalIOError.throwing(true);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
@ -141,8 +141,8 @@ scalar try_getCheckScalar
Info<< "getCheck<scalar>(" << k << ") Caught FatalError "
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOerr);
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
return val;
}
@ -159,8 +159,8 @@ scalar try_getScalar(const entry* eptr, const word& k)
return val;
}
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOerr = FatalIOError.throwing(true);
const bool throwingIOError = FatalIOError.throwExceptions();
const bool throwingError = FatalError.throwExceptions();
try
{
@ -177,8 +177,8 @@ scalar try_getScalar(const entry* eptr, const word& k)
Info<< "entry get<scalar>(" << k << ") Caught FatalError "
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOerr);
FatalError.throwExceptions(throwingError);
FatalIOError.throwExceptions(throwingIOError);
return val;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -94,7 +94,7 @@ unsigned checkDimensions
std::string errMsg;
// Expect some failures
const bool oldThrowingError = FatalError.throwing(true);
const bool prev = FatalError.throwExceptions();
for
(
@ -127,7 +127,7 @@ unsigned checkDimensions
hadDimensionError(test, dimsOk, errMsg);
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(prev);
return nFail;
}

View File

@ -56,8 +56,8 @@ int main(int argc, char *argv[])
if (!args.found("no-throw"))
{
FatalIOError.throwing(true);
FatalError.throwing(true);
FatalIOError.throwExceptions();
FatalError.throwExceptions();
}
try

View File

@ -103,8 +103,8 @@ int main(int argc, char *argv[])
{
string str(t.stringToken());
const bool oldThrowingError = FatalError.throwing(true);
const bool oldThrowingIOErr = FatalIOError.throwing(true);
const bool throwingErr = FatalError.throwExceptions();
const bool throwingIOErr = FatalIOError.throwExceptions();
try
{
@ -128,8 +128,8 @@ int main(int argc, char *argv[])
Info<< err.message().c_str() << nl;
}
FatalError.throwing(oldThrowingError);
FatalIOError.throwing(oldThrowingIOErr);
FatalError.throwExceptions(throwingErr);
FatalIOError.throwExceptions(throwingIOErr);
Info<< nl;
}
}

View File

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

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,108 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
Description
Basic tests of expression traits
\*---------------------------------------------------------------------------*/
#include "IOstreams.H"
#include "ITstream.H"
#include "exprTraits.H"
#include "uLabel.H"
#include "error.H"
#include "stringList.H"
#include "exprScanToken.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class T>
void printTraits()
{
const auto typeCode = exprTypeTraits<T>::value;
Info<< "type " << pTraits<T>::typeName
<< " code:" << int(typeCode)
<< " name:" << exprTypeTraits<T>::name;
if (pTraits<T>::typeName != word(exprTypeTraits<T>::name))
{
Info<< " (UNSUPPORTED)";
}
Info << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main()
{
Info<< nl << "Traits:" << nl;
printTraits<word>();
printTraits<string>();
printTraits<bool>();
printTraits<label>();
printTraits<scalar>();
printTraits<vector>();
printTraits<tensor>();
printTraits<symmTensor>();
printTraits<sphericalTensor>();
const auto getName = nameOp<expressions::valueTypeCode>();
Info<< nl;
Info<< "Name of typeCode: "
<< Foam::name(expressions::valueTypeCode::type_scalar) << nl;
Info<< "Name of typeCode: "
<< getName(expressions::valueTypeCode::type_bool) << nl;
{
expressions::scanToken tok;
expressions::scanToken tok2;
Info<< nl << "sizeof(scanToken): "
<< sizeof(tok) << nl;
Info<< " type:" << int(tok.type_) << nl;
Info<< " ptr:" << Foam::name(tok.name_) << nl;
Info<< " type:" << int(tok2.type_) << nl;
Info<< " ptr:" << Foam::name(tok2.name_) << nl;
tok.setWord("hello");
Info<< " type:" << int(tok.type_) << nl;
Info<< " ptr:" << Foam::name(tok.name_) << nl;
tok2 = tok;
Info<< " type:" << int(tok2.type_) << nl;
Info<< " ptr:" << Foam::name(tok2.name_) << nl;
tok2.destroy();
Info<< " type:" << int(tok2.type_) << nl;
Info<< " ptr:" << Foam::name(tok2.name_) << nl;
}
Info<< nl << "Done" << nl;
return 0;
}
// ************************************************************************* //

View File

@ -148,7 +148,7 @@ int main(int argc, char *argv[])
#if 0
// Expect failure, but triggers abort which cannot be caught
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
labelledTri l1({1, 2, 3, 10, 24});
@ -159,7 +159,7 @@ int main(int argc, char *argv[])
WarningInFunction
<< "Caught FatalError " << err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
#endif
labelledTri l2({1, 2, 3});

View File

@ -224,8 +224,7 @@ void testDirname(const fileName& input)
<< " path:" << input.path()
<< " name:\"" << input.name() << '"'
<< " ext:\"" << input.ext() << '"'
<< " components: " << flatOutput(input.components())
<< " last: " << input.component(string::npos) << nl;
<< " components: " << flatOutput(input.components()) << nl;
}
@ -779,7 +778,7 @@ int main(int argc, char *argv[])
Info<< nl << "Expect a FatalError for findEtcFile() with a bad name:"
<< nl;
const bool oldThrowingError = FatalError.throwing(true);
const bool throwingError = FatalError.throwExceptions();
try
{
@ -792,7 +791,7 @@ int main(int argc, char *argv[])
Info<< nl << "findEtcFile() Caught FatalError "
<< err << nl << endl;
}
FatalError.throwing(oldThrowingError);
FatalError.throwExceptions(throwingError);
}

View File

@ -1,3 +0,0 @@
foamCellZoneToVTK.C
EXE = $(FOAM_USER_APPBIN)/foamCellZoneToVTK

View File

@ -1,7 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lmeshTools

View File

@ -1,161 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 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
foamCellZoneToVTK.C
Description
Write tet-decomposed OpenFOAM mesh in VTK format.
For diagnostic purposes.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
#include "foamVtkInternalMeshWriter.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Write OpenFOAM cellZone mesh to VTK"
);
argList::addOption
(
"cellZone",
"name",
"Convert mesh subset corresponding to specified cellZone"
);
argList::addBoolOption
(
"list",
"List names of cellZones and exit"
);
timeSelector::addOptions();
#include "setRootCase.H"
word cellZoneName;
args.readIfPresent("cellZone", cellZoneName);
const bool optList = args.found("list");
if (optList)
{
if (!cellZoneName.empty())
{
Info<< "specify -list or -cellZone, but not both!" << nl;
return 1;
}
}
else if (cellZoneName.empty())
{
Info<< "Did not specify a cellZone!!" << nl;
return 1;
}
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
fileName exportName("zonemesh-" + cellZoneName);
#include "createPolyMesh.H"
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timei], timei);
polyMesh::readUpdateState state = mesh.readUpdate();
if (!timei || state != polyMesh::UNCHANGED)
{
fileName meshName(exportName);
if (state != polyMesh::UNCHANGED)
{
meshName += '_' + runTime.timeName();
}
if (optList)
{
Info<< "cellZones:" << nl;
for (const word& name : mesh.cellZones().names())
{
Info<< " " << name << nl;
}
}
else
{
const cellZone* zonePtr =
mesh.cellZones().cfindZone(cellZoneName);
Info<< "cellZone " << cellZoneName;
if (!zonePtr)
{
Info<< " ... not found" << nl;
continue;
}
Info<< nl;
const cellZone& zn = *zonePtr;
// Define a subset
vtk::vtuCells vtuCells;
vtuCells.reset(mesh, zn);
vtk::internalMeshWriter writer
(
mesh,
vtuCells,
fileName
(
mesh.time().globalPath() / meshName
)
);
writer.writeGeometry();
writer.beginCellData();
writer.writeProcIDs();
Info<< "Wrote " << writer.output().name() << nl;
}
}
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,4 +0,0 @@
foamMeshToTet-vtk.C
writeVTKtetMesh.C
EXE = $(FOAM_USER_APPBIN)/foamMeshToTet-vtk

View File

@ -1,7 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/fileFormats/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
-lfileFormats \
-lmeshTools

View File

@ -1,96 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 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
foamMeshToTet-vtk
Description
Write tet-decomposed OpenFOAM mesh in VTK format.
For diagnostic purposes.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "Time.H"
#include "polyMesh.H"
namespace Foam
{
void writeVTKtetMesh(const fileName& output, const polyMesh& mesh);
}
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Write tet-decomposed OpenFOAM mesh in VTK"
);
argList::noParallel();
timeSelector::addOptions();
#include "setRootCase.H"
#include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
fileName exportName = "tetmesh";
if (args.found("case"))
{
exportName += '-' + args.globalCaseName();
}
#include "createPolyMesh.H"
forAll(timeDirs, timei)
{
runTime.setTime(timeDirs[timei], timei);
polyMesh::readUpdateState state = mesh.readUpdate();
if (!timei || state != polyMesh::UNCHANGED)
{
fileName meshName(exportName);
if (state != polyMesh::UNCHANGED)
{
meshName += '_' + runTime.timeName();
}
writeVTKtetMesh(meshName, mesh);
}
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,204 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 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/>.
\*---------------------------------------------------------------------------*/
#include "polyMesh.H"
#include "Fstream.H"
#include "tetMatcher.H"
#include "foamVtkInternalMeshWriter.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
void writeVTKtetMesh(const fileName& output, const polyMesh& mesh_)
{
#if WM_LABEL_SIZE == 64
# define FOAM_VTK_LABEL_NAME "vtktypeint64"
#else
# define FOAM_VTK_LABEL_NAME "int"
#endif
const faceList& faces = mesh_.faces();
const labelList& faceOwner = mesh_.faceOwner();
label nTets = 0;
for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
{
nTets += 2 * faces[facei].nTriangles();
}
for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei)
{
nTets += faces[facei].nTriangles();
}
const label nPoints = (mesh_.nPoints() + mesh_.nCells());
OFstream os(output + ".vtk");
Info<< "Write: " << os.name() << nl;
os << "# vtk DataFile Version 5.1" << nl
<< "tet-mesh" << nl
<< "ASCII" << nl
<< "DATASET UNSTRUCTURED_GRID" << nl
<< nl;
os << "POINTS " << nPoints << " float" << nl;
for (const point& p : mesh_.points())
{
os << float(p.x()) << ' '
<< float(p.y()) << ' '
<< float(p.z()) << nl;
}
for (const point& p : mesh_.cellCentres())
{
os << float(p.x()) << ' '
<< float(p.y()) << ' '
<< float(p.z()) << nl;
}
os << nl;
os << "CELLS " << (1 + nTets) << ' ' << (4 * nTets) << nl;
os << "OFFSETS " << FOAM_VTK_LABEL_NAME << nl
<< 0; // begin offset = 0
{
label offset = 0;
for (label teti = 0; teti < nTets; ++teti)
{
offset += 4;
os << ' ' << offset;
}
os << nl << nl;
}
labelList nLocalTets(mesh_.nCells(), Zero);
os << nl
<< "CONNECTIVITY " << FOAM_VTK_LABEL_NAME << nl;
for (label celli = 0; celli < mesh_.nCells(); ++celli)
{
const cell& cFaces = mesh_.cells()[celli];
if (tetMatcher::test(mesh_, celli))
{
// Tet: no cell-centre decomposition
const label facei = cFaces[0];
const face& f0 = faces[facei];
// Get the other point from f1. Tbd: check if not duplicate face
// (ACMI / ignoreBoundaryFaces_).
const face& f1 = faces[cFaces[1]];
label apexi = -1;
forAll(f1, fp)
{
apexi = f1[fp];
if (!f0.found(apexi))
{
break;
}
}
const label p0 = f0[0];
label p1 = f0[1];
label p2 = f0[2];
if (faceOwner[facei] == celli)
{
std::swap(p1, p2);
}
++nLocalTets[celli];
os << p0 << ' ' << p1 << ' ' << p2 << ' ' << apexi << nl;
}
else
{
for (const label facei : cFaces)
{
const face& f = faces[facei];
label fp0 = mesh_.tetBasePtIs()[facei];
// Fallback
if (fp0 < 0)
{
fp0 = 0;
}
const label p0 = f[fp0];
label fp = f.fcIndex(fp0);
for (label i = 2; i < f.size(); ++i)
{
label p1 = f[fp];
fp = f.fcIndex(fp);
label p2 = f[fp];
if (faceOwner[facei] == celli)
{
std::swap(p1, p2);
}
++nLocalTets[celli];
os << p0 << ' ' << p1 << ' ' << p2 << ' '
<< (mesh_.nPoints() + celli) << nl;
}
}
}
}
os << nl
<< "CELL_TYPES " << nTets << nl;
for (label teti = 0; teti < nTets; ++teti)
{
if (teti) os << ' ';
os << vtk::cellType::VTK_TETRA;
}
os << nl;
os << nl << "CELL_DATA " << nTets << nl
<< "FIELD FieldData " << 1 << nl;
os << "cellID " << 1 << ' ' << nTets << " int" << nl;
forAll(nLocalTets, celli)
{
label n = nLocalTets[celli];
while (n--)
{
os << ' ' << celli;
}
os << nl;
}
}
} // End namespace Foam
// ************************************************************************* //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -52,7 +52,7 @@ void testExtraction(const std::string& str)
int main()
{
Info<< "\nVersion information (function)" << nl;
foamVersion::printBuildInfo(Info.stdStream());
foamVersion::printBuildInfo(Info().stdStream());
Info
<< "\nVersion information (macros)" << nl

View File

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

View File

@ -1,2 +0,0 @@
/* EXE_INC = */
/* EXE_LIBS = */

View File

@ -1,189 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 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-gatherValues1
Description
Test list gather functionality
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "IPstream.H"
#include "OPstream.H"
#include "vector.H"
#include "IOstreams.H"
#include "Pstream.H"
#include "globalIndex.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::noCheckProcessorDirectories();
#include "setRootCase.H"
const labelList localValues
(
identity(2 *(Pstream::myProcNo()+1), -5*Pstream::myProcNo())
);
// Test resize
{
globalIndex globIdx(localValues.size());
Info<< "globIdx = " << flatOutput(globIdx.offsets()) << nl;
globIdx.setLocalSize(4, 0);
Info<< "globIdx = " << flatOutput(globIdx.offsets()) << nl;
globIdx.setLocalSize(3, 0);
Info<< "globIdx = " << flatOutput(globIdx.offsets()) << nl;
}
// Gather all values
{
const auto& sendData = localValues;
// One-sided sizing! master only
const globalIndex allProcAddr
(
UPstream::listGatherValues<label>(sendData.size()),
globalIndex::SIZES
);
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
// Collect all values
labelList allValues
(
allProcAddr.mpiGather(sendData)
);
Pout<< "all-data: " << allValues << endl;
}
{
const labelList::subList& sendData =
(
Pstream::master()
? SubList<label>(localValues, 0) // exclude
: SubList<label>(localValues)
);
const labelList sendSizes
(
UPstream::listGatherValues<label>(sendData.size())
);
const label sendSize
(
UPstream::listScatterValues<label>(sendSizes)
);
const globalIndex subProcAddr(sendSizes, globalIndex::SIZES);
Pout<< "listGather "
<< localValues.size() << " = " << flatOutput(sendSizes)
<< " offsets " << flatOutput(subProcAddr.offsets())
<< nl;
label newLocalValue = 5 + UPstream::listScatterValues(sendSizes);
Pout<< "listScattered: " << newLocalValue << nl;
// Can also scatter a longer list
Pout<< "listScatter off "
<< UPstream::listScatterValues(subProcAddr.offsets()) << nl;
Pout<< endl << "local list [" << Pstream::myProcNo() << "] "
<< flatOutput(localValues) << nl;
Pout<< endl << "local send [" << Pstream::myProcNo() << "] "
<< sendSize << nl;
// Collect all off-processor values
labelList allValues
(
subProcAddr.mpiGather(sendData)
);
Pout<< "off-proc: " << allValues << endl;
if (Pstream::master())
{
Info<< "master: " << flatOutput(localValues) << nl;
label proci = 0;
for (const labelRange& range : subProcAddr)
{
Info<< proci << ": " << flatOutput(allValues.slice(range)) << nl;
++proci;
}
Info<< nl << "verify ranges" << nl;
{
globalIndex glob;
Info<< "empty:" << nl;
for (const labelRange& range : glob)
{
Info<< " range: " << range << endl;
}
}
{
globalIndex glob(labelList(Foam::one{}, 0), globalIndex::OFFSETS);
Info<< "degenerate:" << nl;
for (const labelRange& range : glob)
{
Info<< " range: " << range << endl;
}
}
{
globalIndex glob(labelList(Foam::one{}, 0), globalIndex::SIZES);
Info<< "single:" << nl;
for (const labelRange& range : glob)
{
Info<< " range: " << range << endl;
}
}
}
}
Info<< "\nEnd\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,7 +56,7 @@ int main(int argc, char *argv[])
argList::noParallel();
argList::noFunctionObjects();
argList::addArgument("start size .. startN sizeN");
argList::addVerbose("enable labelRange::debug");
argList::addOption("verbose");
argList::addNote
(
"The default is to add ranges, use 'add' and 'del' to toggle\n\n"
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
argList args(argc, argv, false, true);
if (args.verbose())
if (args.found("verbose"))
{
labelRange::debug = 1;
}

View File

@ -1,15 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
#- Run in multi-region mode using chtMultiRegionFoam
( cd solid1_solid2 && ./Allrun )
#- Run in multi-world mode
# Could run chtMultiRegionFoam with single solid instead of solidFoam
(cd solid1 && runApplication blockMesh)
(cd solid2 && runApplication blockMesh)
mpirun -app mpirun.schema
#------------------------------------------------------------------------------

View File

@ -1,2 +0,0 @@
-np 1 xterm -font fixed -title fluid -geometry 200x15+0+0 -e ./run_solid1.sh
-np 1 xterm -font fixed -title solid -geometry 200x15+0+200 -e ./run_solid2.sh

View File

@ -1,8 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
solidFoam -case solid1 -world solid1 2>&1 | tee log.solidFoam_solid1
read dummy
#------------------------------------------------------------------------------

View File

@ -1,8 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
solidFoam -case solid2 -world solid2 2>&1 | tee log.solidFoam_solid2
read dummy
#------------------------------------------------------------------------------

View File

@ -1,48 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 400;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
bottom
{
type compressible::turbulentTemperatureRadCoupledMixed;
value $internalField;
Tnbr T;
kappaMethod solidThermo;
thicknessLayers (1e-2);
kappaLayers (400);
}
top
{
type zeroGradient;
}
left
{
type zeroGradient;
}
right
{
type zeroGradient;
}
}
// ************************************************************************* //

View File

@ -1,50 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object p;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [1 -1 -2 0 0 0 0];
internalField uniform 100000;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
top
{
type calculated;
value $internalField;
}
left
{
type calculated;
value $internalField;
}
right
{
type calculated;
value $internalField;
}
bottom
{
type calculated;
value $internalField;
}
}
// ************************************************************************* //

View File

@ -1,20 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class uniformDimensionedVectorField;
object g;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0);
// ************************************************************************* //

View File

@ -1,22 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object radiationProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
radiation off;
radiationModel none;
// ************************************************************************* //

View File

@ -1,52 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType
{
type heSolidThermo;
mixture pureMixture;
transport constIso;
thermo hConst;
equationOfState rhoConst;
specie specie;
energy sensibleEnthalpy;
}
mixture
{
specie
{
molWeight 50;
}
transport
{
kappa 80;
}
thermodynamics
{
Hf 0;
Cp 450;
}
equationOfState
{
rho 8000;
}
}
// ************************************************************************* //

View File

@ -1,96 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
(-0.1 0.00 -0.05)
( 0.1 0.00 -0.05)
( 0.1 0.04 -0.05)
(-0.1 0.04 -0.05)
(-0.1 0.00 0.05)
( 0.1 0.00 0.05)
( 0.1 0.04 0.05)
(-0.1 0.04 0.05)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 10 1) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
bottom
{
type mappedWall;
inGroups 1 ( wall );
sampleMode nearestPatchFace;
sampleWorld solid2;
sampleRegion region0;
samplePatch top;
faces
(
(1 5 4 0)
);
}
top
{
type wall;
faces
(
(3 7 6 2)
);
}
left
{
type wall;
faces
(
(0 4 7 3)
);
}
right
{
type wall;
faces
(
(2 6 5 1)
);
}
frontAndBack
{
type empty;
faces
(
(0 3 2 1)
(4 5 6 7)
);
}
);
mergePatchPairs
(
);
// ************************************************************************* //

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