Compare commits
8 Commits
feature-re
...
feature-ov
| Author | SHA1 | Date | |
|---|---|---|---|
| 95fe43b079 | |||
| 10b7479dca | |||
| 054e3ebc8b | |||
| 3dc63dc67c | |||
| 141b8376f3 | |||
| 72b9a002a2 | |||
| 808565a673 | |||
| 5da36a3386 |
@ -49,7 +49,7 @@
|
||||
|
||||
<!--
|
||||
Providing details of your set-up can help us identify any issues, e.g.
|
||||
OpenFOAM version : v1806|v1812|v1906|v1912|v2006|v2012|v2106 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
|
||||
|
||||
29
Allwmake
29
Allwmake
@ -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 "========================================"
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
api=2108
|
||||
api=2107
|
||||
patch=0
|
||||
|
||||
@ -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 ========================================
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -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
|
||||
|
||||
@ -138,13 +138,6 @@ public:
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
|
||||
//- Return a clone
|
||||
virtual refPtr<regIOobject> deepClone() const
|
||||
{
|
||||
NotImplemented;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~PDRDragModel();
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
bool ddtCorr
|
||||
(
|
||||
pimple.dict().getOrDefault("ddtCorr", true)
|
||||
);
|
||||
@ -69,6 +69,8 @@ mesh.setFluxRequired(p.name());
|
||||
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
|
||||
@ -43,7 +43,6 @@ Description
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "fluidThermo.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "bound.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "pressureControl.H"
|
||||
#include "CorrectPhi.H"
|
||||
@ -89,10 +88,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
|
||||
// Store divrhoU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
@ -128,7 +125,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
|
||||
@ -137,52 +133,22 @@ int main(int argc, char *argv[])
|
||||
MRF.update();
|
||||
|
||||
#include "setCellMask.H"
|
||||
|
||||
const surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
|
||||
// Zero Uf on old faceMask (H-I)
|
||||
rhoUf() *= faceMaskOld;
|
||||
|
||||
surfaceVectorField rhoUfint(fvc::interpolate(rho*U));
|
||||
|
||||
// Update Uf and phi on new C-I faces
|
||||
rhoUf() += (1-faceMaskOld)*rhoUfint;
|
||||
|
||||
// Update Uf boundary
|
||||
forAll(rhoUf().boundaryField(), patchI)
|
||||
{
|
||||
rhoUf().boundaryFieldRef()[patchI] =
|
||||
rhoUfint.boundaryField()[patchI];
|
||||
}
|
||||
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf();
|
||||
#include "setInterpolatedCells.H"
|
||||
#include "correctRhoPhiFaceMask.H"
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
// Corrects flux on separated regions
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
// Zero phi on current H-I
|
||||
const surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
phi *= faceMask;
|
||||
U *= cellMask;
|
||||
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
|
||||
}
|
||||
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
if (checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,17 +25,6 @@ surfaceScalarField phiHbyA
|
||||
fvc::interpolate(rho)*fvc::flux(HbyA)
|
||||
);
|
||||
|
||||
if (ddtCorr)
|
||||
{
|
||||
surfaceScalarField faceMaskOld
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask.oldTime())
|
||||
);
|
||||
|
||||
phiHbyA +=
|
||||
faceMaskOld*MRF.zeroFilter(rhorAUf*fvc::ddtCorr(rho, U, phi, rhoUf));
|
||||
}
|
||||
|
||||
fvc::makeRelative(phiHbyA, rho, U);
|
||||
MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
|
||||
|
||||
@ -134,8 +123,4 @@ if (thermo.dpdt())
|
||||
}
|
||||
}
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
phi *= faceMask;
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo =
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
@ -124,3 +124,6 @@ dimensionedScalar initialMass("initialMass", fvc::domainIntegrate(rho));
|
||||
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
@ -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>
|
||||
|
||||
@ -37,7 +37,10 @@ scalar meanCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField phiMask(localMin<scalar>(mesh).interpolate(cellMask));
|
||||
surfaceScalarField phiMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask + interpolatedCells)
|
||||
);
|
||||
|
||||
scalarField sumPhi(fvc::surfaceSum(mag(phiMask*phi))().internalField());
|
||||
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
// Solve the Momentum equation
|
||||
|
||||
MRF.correctBoundaryVelocity(U);
|
||||
|
||||
tmp<fvVectorMatrix> tUEqn
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
#include "createTimeControls.H"
|
||||
|
||||
bool correctPhi
|
||||
(
|
||||
pimple.dict().getOrDefault("correctPhi", false)
|
||||
);
|
||||
|
||||
bool checkMeshCourantNo
|
||||
(
|
||||
pimple.dict().getOrDefault("checkMeshCourantNo", false)
|
||||
);
|
||||
|
||||
bool massFluxInterpolation
|
||||
(
|
||||
pimple.dict().getOrDefault("massFluxInterpolation", false)
|
||||
);
|
||||
|
||||
bool adjustFringe
|
||||
(
|
||||
pimple.dict().getOrDefault("oversetAdjustPhi", false)
|
||||
);
|
||||
|
||||
bool ddtCorr
|
||||
(
|
||||
pimple.dict().getOrDefault("ddtCorr", true)
|
||||
);
|
||||
@ -1,273 +0,0 @@
|
||||
// Interpolation used
|
||||
interpolationCellPoint<vector> UInterpolator(HbyA);
|
||||
|
||||
// Determine faces on outside of interpolated cells
|
||||
bitSet isOwnerInterpolatedFace(mesh.nInternalFaces());
|
||||
bitSet isNeiInterpolatedFace(mesh.nInternalFaces());
|
||||
|
||||
// Determine donor cells
|
||||
labelListList donorCell(mesh.nInternalFaces());
|
||||
|
||||
scalarListList weightCellCells(mesh.nInternalFaces());
|
||||
|
||||
// Interpolated HbyA faces
|
||||
vectorField UIntFaces(mesh.nInternalFaces(), Zero);
|
||||
|
||||
// Determine receptor neighbour cells
|
||||
labelList receptorNeigCell(mesh.nInternalFaces(), -1);
|
||||
|
||||
{
|
||||
const cellCellStencilObject& overlap = Stencil::New(mesh);
|
||||
const labelList& cellTypes = overlap.cellTypes();
|
||||
const labelIOList& zoneID = overlap.zoneID();
|
||||
|
||||
label nZones = gMax(zoneID)+1;
|
||||
PtrList<fvMeshSubset> meshParts(nZones);
|
||||
labelList nCellsPerZone(nZones, Zero);
|
||||
|
||||
// A mesh subset for each zone
|
||||
forAll(meshParts, zonei)
|
||||
{
|
||||
meshParts.set
|
||||
(
|
||||
zonei,
|
||||
// Select cells where the zoneID == zonei
|
||||
new fvMeshSubset(mesh, zonei, zoneID)
|
||||
);
|
||||
}
|
||||
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
label ownType = cellTypes[mesh.faceOwner()[faceI]];
|
||||
label neiType = cellTypes[mesh.faceNeighbour()[faceI]];
|
||||
if
|
||||
(
|
||||
ownType == cellCellStencil::INTERPOLATED
|
||||
&& neiType == cellCellStencil::CALCULATED
|
||||
)
|
||||
{
|
||||
isOwnerInterpolatedFace.set(faceI);
|
||||
|
||||
const vector& fc = mesh.faceCentres()[faceI];
|
||||
|
||||
for (label zoneI = 0; zoneI < nZones; zoneI++)
|
||||
{
|
||||
if (zoneI != zoneID[mesh.faceOwner()[faceI]])
|
||||
{
|
||||
const fvMesh& partMesh = meshParts[zoneI].subMesh();
|
||||
const labelList& cellMap = meshParts[zoneI].cellMap();
|
||||
label cellI = partMesh.findCell(fc);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
// Determine weights
|
||||
labelList stencil(partMesh.cellCells()[cellI]);
|
||||
|
||||
stencil.append(cellI);
|
||||
|
||||
label st = stencil.size();
|
||||
|
||||
donorCell[faceI].setSize(st);
|
||||
|
||||
weightCellCells[faceI].setSize(st);
|
||||
|
||||
scalarField weights(st);
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
scalar d = mag
|
||||
(
|
||||
partMesh.cellCentres()[stencil[i]]
|
||||
- fc
|
||||
);
|
||||
weights[i] = 1.0/d;
|
||||
donorCell[faceI][i] = cellMap[stencil[i]];
|
||||
}
|
||||
weights /= sum(weights);
|
||||
|
||||
weightCellCells[faceI] = weights;
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
UIntFaces[faceI] +=
|
||||
weightCellCells[faceI][i]
|
||||
*UInterpolator.interpolate
|
||||
(
|
||||
fc,
|
||||
donorCell[faceI][i]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
receptorNeigCell[faceI] = mesh.faceNeighbour()[faceI];
|
||||
}
|
||||
else if
|
||||
(
|
||||
ownType == cellCellStencil::CALCULATED
|
||||
&& neiType == cellCellStencil::INTERPOLATED
|
||||
)
|
||||
{
|
||||
isNeiInterpolatedFace.set(faceI);
|
||||
|
||||
const vector& fc = mesh.faceCentres()[faceI];
|
||||
for (label zoneI = 0; zoneI < nZones; zoneI++)
|
||||
{
|
||||
if (zoneI != zoneID[mesh.faceNeighbour()[faceI]])
|
||||
{
|
||||
const fvMesh& partMesh = meshParts[zoneI].subMesh();
|
||||
const labelList& cellMap = meshParts[zoneI].cellMap();
|
||||
label cellI = partMesh.findCell(fc);
|
||||
|
||||
if (cellI != -1)
|
||||
{
|
||||
// Determine weights
|
||||
labelList stencil(partMesh.cellCells()[cellI]);
|
||||
|
||||
stencil.append(cellI);
|
||||
|
||||
label st = stencil.size();
|
||||
|
||||
donorCell[faceI].setSize(st);
|
||||
|
||||
weightCellCells[faceI].setSize(st);
|
||||
|
||||
scalarField weights(st);
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
scalar d = mag
|
||||
(
|
||||
partMesh.cellCentres()[stencil[i]]
|
||||
- fc
|
||||
);
|
||||
weights[i] = 1.0/d;
|
||||
donorCell[faceI][i] = cellMap[stencil[i]];
|
||||
}
|
||||
weights /= sum(weights);
|
||||
|
||||
weightCellCells[faceI] = weights;
|
||||
|
||||
forAll(stencil, i)
|
||||
{
|
||||
UIntFaces[faceI] +=
|
||||
weightCellCells[faceI][i]
|
||||
*UInterpolator.interpolate
|
||||
(
|
||||
fc,
|
||||
donorCell[faceI][i]
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
receptorNeigCell[faceI] = mesh.faceOwner()[faceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// contravariant U
|
||||
vectorField U1Contrav(mesh.nInternalFaces(), Zero);
|
||||
|
||||
surfaceVectorField faceNormals(mesh.Sf()/mesh.magSf());
|
||||
|
||||
forAll(isNeiInterpolatedFace, faceI)
|
||||
{
|
||||
label cellId = -1;
|
||||
if (isNeiInterpolatedFace.test(faceI))
|
||||
{
|
||||
cellId = mesh.faceNeighbour()[faceI];
|
||||
}
|
||||
else if (isOwnerInterpolatedFace.test(faceI))
|
||||
{
|
||||
cellId = mesh.faceOwner()[faceI];
|
||||
}
|
||||
|
||||
if (cellId != -1)
|
||||
{
|
||||
const vector& n = faceNormals[faceI];
|
||||
vector n1(Zero);
|
||||
|
||||
// 2-D cases
|
||||
if (mesh.nSolutionD() == 2)
|
||||
{
|
||||
for (direction cmpt=0; cmpt<vector::nComponents; cmpt++)
|
||||
{
|
||||
if (mesh.geometricD()[cmpt] == -1)
|
||||
{
|
||||
switch (cmpt)
|
||||
{
|
||||
case vector::X:
|
||||
{
|
||||
n1 = vector(0, n.z(), -n.y());
|
||||
break;
|
||||
}
|
||||
|
||||
case vector::Y:
|
||||
{
|
||||
n1 = vector(n.z(), 0, -n.x());
|
||||
break;
|
||||
}
|
||||
|
||||
case vector::Z:
|
||||
{
|
||||
n1 = vector(n.y(), -n.x(), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mesh.nSolutionD() == 3)
|
||||
{
|
||||
//Determine which is the primary direction
|
||||
if (mag(n.x()) > mag(n.y()) && mag(n.x()) > mag(n.z()))
|
||||
{
|
||||
n1 = vector(n.y(), -n.x(), 0);
|
||||
}
|
||||
else if (mag(n.y()) > mag(n.z()))
|
||||
{
|
||||
n1 = vector(0, n.z(), -n.y());
|
||||
}
|
||||
else
|
||||
{
|
||||
n1 = vector(-n.z(), 0, n.x());
|
||||
}
|
||||
}
|
||||
n1.normalise();
|
||||
|
||||
const vector n2 = normalised(n ^ n1);
|
||||
|
||||
tensor rot =
|
||||
tensor
|
||||
(
|
||||
n.x() ,n.y(), n.z(),
|
||||
n1.x() ,n1.y(), n1.z(),
|
||||
n2.x() ,n2.y(), n2.z()
|
||||
);
|
||||
|
||||
// tensor rot =
|
||||
// tensor
|
||||
// (
|
||||
// n & x ,n & y, n & z,
|
||||
// n1 & x ,n1 & y, n1 & z,
|
||||
// n2 & x ,n2 & y, n2 & z
|
||||
// );
|
||||
|
||||
U1Contrav[faceI].x() =
|
||||
2*transform(rot, UIntFaces[faceI]).x()
|
||||
- transform(rot, HbyA[receptorNeigCell[faceI]]).x();
|
||||
|
||||
U1Contrav[faceI].y() = transform(rot, HbyA[cellId]).y();
|
||||
|
||||
U1Contrav[faceI].z() = transform(rot, HbyA[cellId]).z();
|
||||
|
||||
HbyA[cellId] = transform(inv(rot), U1Contrav[faceI]);
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
correctPhi = pimple.dict().getOrDefault("correctPhi", false);
|
||||
|
||||
checkMeshCourantNo = pimple.dict().getOrDefault("checkMeshCourantNo", false);
|
||||
|
||||
massFluxInterpolation =
|
||||
pimple.dict().getOrDefault("massFluxInterpolation", false);
|
||||
|
||||
ddtCorr = pimple.dict().getOrDefault("ddtCorr", true);
|
||||
@ -24,7 +24,3 @@ bool adjustFringe
|
||||
(
|
||||
simple.dict().getOrDefault("oversetAdjustPhi", false)
|
||||
);
|
||||
bool massFluxInterpolation
|
||||
(
|
||||
simple.dict().getOrDefault("massFluxInterpolation", false)
|
||||
);
|
||||
|
||||
@ -1,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));
|
||||
|
||||
@ -129,10 +129,5 @@ compressibleInterPhaseTransportModel turbulence
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
@ -80,9 +80,6 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createTimeControls.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "createFields.H"
|
||||
|
||||
@ -109,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
if (LTS)
|
||||
{
|
||||
@ -154,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();
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
(
|
||||
|
||||
@ -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)
|
||||
);
|
||||
@ -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();
|
||||
|
||||
@ -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
|
||||
(
|
||||
(
|
||||
|
||||
@ -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);
|
||||
@ -149,10 +149,5 @@ surfaceScalarField alphaPhi10
|
||||
// Mask field for zeroing out contributions on hole cells
|
||||
#include "createCellMask.H"
|
||||
|
||||
surfaceScalarField faceMask
|
||||
(
|
||||
localMin<scalar>(mesh).interpolate(cellMask)
|
||||
);
|
||||
|
||||
// Create bool field with interpolated cells
|
||||
#include "createInterpolatedCells.H"
|
||||
|
||||
@ -82,9 +82,7 @@ int main(int argc, char *argv[])
|
||||
#include "setRootCaseLists.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
#include "createTimeControls.H"
|
||||
#include "createDyMControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
@ -118,7 +116,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "readDyMControls.H"
|
||||
|
||||
// Store divU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
@ -153,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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-DynamicList2.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-DynamicList2
|
||||
@ -1,2 +0,0 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-PrecisionAdaptor.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-PrecisionAdaptor
|
||||
@ -1,2 +0,0 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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});
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
foamCellZoneToVTK.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/foamCellZoneToVTK
|
||||
@ -1,7 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfileFormats \
|
||||
-lmeshTools
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,4 +0,0 @@
|
||||
foamMeshToTet-vtk.C
|
||||
writeVTKtetMesh.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/foamMeshToTet-vtk
|
||||
@ -1,7 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfileFormats \
|
||||
-lmeshTools
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
Test-gatherValues1.C
|
||||
|
||||
EXE = $(FOAM_USER_APPBIN)/Test-gatherValues1
|
||||
@ -1,2 +0,0 @@
|
||||
/* EXE_INC = */
|
||||
/* EXE_LIBS = */
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -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
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,61 +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;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application solidFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 500;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
//writeControl adjustable;
|
||||
//writeInterval 0.1;
|
||||
writeControl timeStep;
|
||||
writeInterval 10;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 8;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
//maxCo 0.6;
|
||||
|
||||
// Maximum diffusion number
|
||||
//maxDi 10.0;
|
||||
|
||||
//adjustTimeStep yes;
|
||||
|
||||
//functions
|
||||
//{
|
||||
// #include "vtkWrite"
|
||||
//}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +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 decomposeParDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
numberOfSubdomains 4;
|
||||
|
||||
method scotch;
|
||||
// method hierarchical;
|
||||
// method simple;
|
||||
|
||||
regions
|
||||
{
|
||||
heater
|
||||
{
|
||||
numberOfSubdomains 1;
|
||||
method simple; // none;
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (1 1 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
coeffs
|
||||
{
|
||||
n (2 2 1);
|
||||
}
|
||||
|
||||
/*
|
||||
constraints
|
||||
{
|
||||
//- Keep owner and neighbour on same processor for faces in zones:
|
||||
faces
|
||||
{
|
||||
type preserveFaceZones;
|
||||
zones (heater solid1 solid3);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,53 +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 fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
h
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-06;
|
||||
relTol 0.1;
|
||||
}
|
||||
|
||||
hFinal
|
||||
{
|
||||
$h;
|
||||
tolerance 1e-06;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
equations
|
||||
{
|
||||
h 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,61 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
// Use the vtkWrite function object
|
||||
|
||||
vtkWrite
|
||||
{
|
||||
type vtkWrite;
|
||||
libs (utilityFunctionObjects);
|
||||
log true;
|
||||
|
||||
writeControl writeTime;
|
||||
writeInterval 1;
|
||||
|
||||
regions (".*");
|
||||
|
||||
internal true;
|
||||
|
||||
boundary true;
|
||||
|
||||
single false;
|
||||
|
||||
interpolate true;
|
||||
|
||||
// Fields to output (words or regex)
|
||||
fields (".*");
|
||||
|
||||
//- Output format (ascii | binary) - Default=binary
|
||||
// format binary;
|
||||
|
||||
//- Use legacy output format - Default=false
|
||||
// legacy false;
|
||||
|
||||
//- Output directory name - Default="postProcessing/<name>"
|
||||
// directory "VTK";
|
||||
|
||||
//- Write cell ids as field - Default=true
|
||||
writeIds false;
|
||||
}
|
||||
|
||||
|
||||
// Solid walls only
|
||||
walls
|
||||
{
|
||||
type vtkWrite;
|
||||
libs (utilityFunctionObjects);
|
||||
log true;
|
||||
|
||||
writeControl writeTime;
|
||||
writeInterval 1;
|
||||
|
||||
internal false;
|
||||
|
||||
// single true;
|
||||
|
||||
regions ( heater "(?i).*solid" );
|
||||
patches ( "(?i).*solid_to.*" "heater.*(Air|Water)" );
|
||||
|
||||
fields (T);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,51 +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/leftSolid";
|
||||
object T;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
dimensions [ 0 0 0 1 0 0 0 ];
|
||||
|
||||
internalField uniform 300;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
#includeEtc "caseDicts/setConstraintTypes"
|
||||
|
||||
left
|
||||
{
|
||||
type zeroGradient;
|
||||
value $internalField;
|
||||
}
|
||||
right
|
||||
{
|
||||
type zeroGradient;
|
||||
value $internalField;
|
||||
}
|
||||
bottom
|
||||
{
|
||||
type zeroGradient;
|
||||
value $internalField;
|
||||
}
|
||||
top
|
||||
{
|
||||
type compressible::turbulentTemperatureRadCoupledMixed;
|
||||
value $internalField;
|
||||
Tnbr T;
|
||||
kappaMethod solidThermo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,24 +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 regionProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
regions
|
||||
(
|
||||
fluid ()
|
||||
solid (solid1 solid2)
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1 +0,0 @@
|
||||
../solid1/radiationProperties
|
||||
@ -1 +0,0 @@
|
||||
../solid1/thermophysicalProperties
|
||||
@ -1,61 +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;
|
||||
location "system";
|
||||
object controlDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
application chtMultiRegionFoam;
|
||||
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
stopAt endTime;
|
||||
|
||||
endTime 500;
|
||||
|
||||
deltaT 1;
|
||||
|
||||
//writeControl adjustable;
|
||||
//writeInterval 0.1;
|
||||
writeControl timeStep;
|
||||
writeInterval 10;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
writeFormat ascii;
|
||||
|
||||
writePrecision 8;
|
||||
|
||||
writeCompression off;
|
||||
|
||||
timeFormat general;
|
||||
|
||||
timePrecision 6;
|
||||
|
||||
runTimeModifiable yes;
|
||||
|
||||
//maxCo 0.6;
|
||||
|
||||
// Maximum diffusion number
|
||||
//maxDi 10.0;
|
||||
|
||||
//adjustTimeStep yes;
|
||||
|
||||
//functions
|
||||
//{
|
||||
// #include "vtkWrite"
|
||||
//}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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 dictionary;
|
||||
object fvSchemes;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
ddtSchemes
|
||||
{
|
||||
//default Euler;
|
||||
default steadyState;
|
||||
}
|
||||
|
||||
gradSchemes
|
||||
{
|
||||
default Gauss linear;
|
||||
}
|
||||
|
||||
divSchemes
|
||||
{
|
||||
default none;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
{
|
||||
default none;
|
||||
laplacian(alpha,h) Gauss linear corrected;
|
||||
}
|
||||
|
||||
interpolationSchemes
|
||||
{
|
||||
default linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
{
|
||||
default corrected;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,53 +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 fvSolution;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
solvers
|
||||
{
|
||||
h
|
||||
{
|
||||
solver PCG;
|
||||
preconditioner DIC;
|
||||
tolerance 1e-06;
|
||||
relTol 0.1;
|
||||
}
|
||||
|
||||
hFinal
|
||||
{
|
||||
$h;
|
||||
tolerance 1e-06;
|
||||
relTol 0;
|
||||
}
|
||||
}
|
||||
|
||||
PIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
SIMPLE
|
||||
{
|
||||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
equations
|
||||
{
|
||||
h 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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 solid2;
|
||||
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
|
||||
(
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1 +0,0 @@
|
||||
../fvSchemes
|
||||
@ -1 +0,0 @@
|
||||
../fvSolution
|
||||
@ -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.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)
|
||||
( 0.1 0.00 0.05)
|
||||
(-0.1 0.00 0.05)
|
||||
);
|
||||
|
||||
blocks
|
||||
(
|
||||
hex (0 1 2 3 4 5 6 7) (20 10 1) simpleGrading (1 1 1)
|
||||
);
|
||||
|
||||
edges
|
||||
(
|
||||
);
|
||||
|
||||
boundary
|
||||
(
|
||||
bottom
|
||||
{
|
||||
type wall;
|
||||
faces
|
||||
(
|
||||
(1 5 4 0)
|
||||
);
|
||||
}
|
||||
top
|
||||
{
|
||||
type mappedWall;
|
||||
inGroups 1 ( wall );
|
||||
sampleMode nearestPatchFace;
|
||||
|
||||
//sampleWorld solid1;
|
||||
sampleRegion solid1;
|
||||
samplePatch bottom;
|
||||
|
||||
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
Reference in New Issue
Block a user