mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -273,10 +273,12 @@ bool Foam::checkCoupledPoints
|
||||
const faceList& fcs = mesh.faces();
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
// Zero'th point on coupled faces
|
||||
pointField nbrZeroPoint(fcs.size()-mesh.nInternalFaces(), vector::max);
|
||||
// Check size of faces
|
||||
label maxSize = 0;
|
||||
{
|
||||
labelList nbrSize(fcs.size()-mesh.nInternalFaces(), 0);
|
||||
|
||||
// Exchange zero point
|
||||
// Exchange size
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (patches[patchI].coupled())
|
||||
@ -289,17 +291,95 @@ bool Foam::checkCoupledPoints
|
||||
forAll(cpp, i)
|
||||
{
|
||||
label bFaceI = cpp.start()+i-mesh.nInternalFaces();
|
||||
const point& p0 = p[cpp[i][0]];
|
||||
nbrZeroPoint[bFaceI] = p0;
|
||||
nbrSize[bFaceI] = cpp[i].size();
|
||||
maxSize = max(maxSize, cpp[i].size());
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFacePositions(mesh, nbrZeroPoint);
|
||||
syncTools::swapBoundaryFaceList(mesh, nbrSize);
|
||||
|
||||
|
||||
// Check on owner
|
||||
label nErrorFaces = 0;
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (patches[patchI].coupled())
|
||||
{
|
||||
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[patchI]
|
||||
);
|
||||
|
||||
if (cpp.owner())
|
||||
{
|
||||
forAll(cpp, i)
|
||||
{
|
||||
label bFaceI = cpp.start()+i-mesh.nInternalFaces();
|
||||
|
||||
if (cpp[i].size() != nbrSize[bFaceI])
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->insert(cpp.start()+i);
|
||||
}
|
||||
nErrorFaces++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nErrorFaces, sumOp<label>());
|
||||
if (nErrorFaces > 0)
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< " **Error in coupled faces: "
|
||||
<< nErrorFaces
|
||||
<< " faces have different size "
|
||||
<< " compared to their coupled equivalent." << endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
reduce(maxSize, maxOp<label>());
|
||||
}
|
||||
|
||||
|
||||
// Compare to local ones. Use same tolerance as for matching
|
||||
label nErrorFaces = 0;
|
||||
scalar avgMismatch = 0;
|
||||
label nCoupledFaces = 0;
|
||||
label nCoupledPoints = 0;
|
||||
|
||||
for (label index = 0; index < maxSize; index++)
|
||||
{
|
||||
// point at index on coupled faces
|
||||
pointField nbrPoint(fcs.size()-mesh.nInternalFaces(), vector::max);
|
||||
|
||||
// Exchange point
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (patches[patchI].coupled())
|
||||
{
|
||||
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
|
||||
(
|
||||
patches[patchI]
|
||||
);
|
||||
|
||||
forAll(cpp, i)
|
||||
{
|
||||
const face& f = cpp[i];
|
||||
if (f.size() > index)
|
||||
{
|
||||
label bFaceI = cpp.start()+i-mesh.nInternalFaces();
|
||||
nbrPoint[bFaceI] = p[f[index]];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFacePositions(mesh, nbrPoint);
|
||||
|
||||
|
||||
// Compare to local ones. Use same tolerance as for matching
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
@ -324,22 +404,34 @@ bool Foam::checkCoupledPoints
|
||||
);
|
||||
|
||||
forAll(cpp, i)
|
||||
{
|
||||
const face& f = cpp[i];
|
||||
if (f.size() > index)
|
||||
{
|
||||
label bFaceI = cpp.start()+i-mesh.nInternalFaces();
|
||||
const point& p0 = p[cpp[i][0]];
|
||||
|
||||
scalar d = mag(p0 - nbrZeroPoint[bFaceI]);
|
||||
label reverseIndex = (f.size()-index)%f.size();
|
||||
scalar d = mag(p[f[reverseIndex]]-nbrPoint[bFaceI]);
|
||||
|
||||
if (d > smallDist[i])
|
||||
{
|
||||
if (setPtr)
|
||||
{
|
||||
setPtr->insert(cpp.start()+i);
|
||||
}
|
||||
// Avoid duplicate counting of faces
|
||||
if (setPtr->insert(cpp.start()+i))
|
||||
{
|
||||
nErrorFaces++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No checking on duplicates
|
||||
nErrorFaces++;
|
||||
}
|
||||
}
|
||||
avgMismatch += d;
|
||||
nCoupledFaces++;
|
||||
nCoupledPoints++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -347,11 +439,11 @@ bool Foam::checkCoupledPoints
|
||||
|
||||
reduce(nErrorFaces, sumOp<label>());
|
||||
reduce(avgMismatch, maxOp<scalar>());
|
||||
reduce(nCoupledFaces, sumOp<label>());
|
||||
reduce(nCoupledPoints, sumOp<label>());
|
||||
|
||||
if (nCoupledFaces > 0)
|
||||
if (nCoupledPoints > 0)
|
||||
{
|
||||
avgMismatch /= nCoupledFaces;
|
||||
avgMismatch /= nCoupledPoints;
|
||||
}
|
||||
|
||||
if (nErrorFaces > 0)
|
||||
@ -360,7 +452,7 @@ bool Foam::checkCoupledPoints
|
||||
{
|
||||
Info<< " **Error in coupled point location: "
|
||||
<< nErrorFaces
|
||||
<< " faces have their 0th vertex not opposite"
|
||||
<< " faces have their 0th or consecutive vertex not opposite"
|
||||
<< " their coupled equivalent. Average mismatch "
|
||||
<< avgMismatch << "."
|
||||
<< endl;
|
||||
@ -581,7 +673,8 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
|
||||
if (nFaces > 0)
|
||||
{
|
||||
Info<< " <<Writing " << nFaces
|
||||
<< " faces with incorrectly matched 0th vertex to set "
|
||||
<< " faces with incorrectly matched 0th (or consecutive)"
|
||||
<< " vertex to set "
|
||||
<< faces.name() << endl;
|
||||
faces.instance() = mesh.pointsInstance();
|
||||
faces.write();
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-ldynamicFvMesh \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -32,19 +32,98 @@ Description
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "vtkSurfaceWriter.H"
|
||||
#include "cyclicAMIPolyPatch.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Dump patch + weights to vtk file
|
||||
void writeWeights
|
||||
(
|
||||
const scalarField& wghtSum,
|
||||
const primitivePatch& patch,
|
||||
const fileName& folder,
|
||||
const fileName& prefix,
|
||||
const word& timeName
|
||||
)
|
||||
{
|
||||
vtkSurfaceWriter writer;
|
||||
|
||||
writer.write
|
||||
(
|
||||
folder,
|
||||
prefix + "_proc" + Foam::name(Pstream::myProcNo()) + "_" + timeName,
|
||||
patch.localPoints(),
|
||||
patch.localFaces(),
|
||||
"weightsSum",
|
||||
wghtSum,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void writeWeights(const polyMesh& mesh)
|
||||
{
|
||||
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
|
||||
|
||||
const word tmName(mesh.time().timeName());
|
||||
|
||||
forAll(pbm, patchI)
|
||||
{
|
||||
if (isA<cyclicAMIPolyPatch>(pbm[patchI]))
|
||||
{
|
||||
const cyclicAMIPolyPatch& cpp =
|
||||
refCast<const cyclicAMIPolyPatch>(pbm[patchI]);
|
||||
|
||||
if (cpp.owner())
|
||||
{
|
||||
const AMIPatchToPatchInterpolation& ami =
|
||||
cpp.AMI();
|
||||
writeWeights
|
||||
(
|
||||
ami.tgtWeightsSum(),
|
||||
cpp.neighbPatch(),
|
||||
"output",
|
||||
"tgt",
|
||||
tmName
|
||||
);
|
||||
writeWeights
|
||||
(
|
||||
ami.srcWeightsSum(),
|
||||
cpp,
|
||||
"output",
|
||||
"src",
|
||||
tmName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Main program:
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addBoolOption
|
||||
(
|
||||
"checkAMI",
|
||||
"check AMI weights"
|
||||
);
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createDynamicFvMesh.H"
|
||||
|
||||
const bool checkAMI = args.optionFound("checkAMI");
|
||||
|
||||
if (checkAMI)
|
||||
{
|
||||
Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
|
||||
}
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << endl;
|
||||
@ -52,6 +131,11 @@ int main(int argc, char *argv[])
|
||||
mesh.update();
|
||||
mesh.checkMesh(true);
|
||||
|
||||
if (checkAMI)
|
||||
{
|
||||
writeWeights(mesh);
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lreactionThermophysicalModels \
|
||||
-lfiniteVolume \
|
||||
-lgenericPatchFields \
|
||||
-lspecie \
|
||||
-lbasicThermophysicalModels
|
||||
-lsolid \
|
||||
-lbasicThermophysicalModels \
|
||||
-lbasicSolidThermo
|
||||
|
||||
@ -5,6 +5,7 @@ autoPtr<basicThermo> thermo
|
||||
|
||||
const volScalarField& h = thermo->he();
|
||||
|
||||
// Register copy of thermo density
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
@ -16,7 +17,16 @@ volScalarField rho
|
||||
thermo->rho()
|
||||
);
|
||||
|
||||
volVectorField U
|
||||
// Construct turbulence model (if fluid)
|
||||
autoPtr<volVectorField> UPtr;
|
||||
autoPtr<surfaceScalarField> phiPtr;
|
||||
autoPtr<compressible::turbulenceModel> turbulence;
|
||||
|
||||
if (!isA<solidThermo>(thermo()))
|
||||
{
|
||||
UPtr.reset
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -27,17 +37,20 @@ volVectorField U
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
const volVectorField& U = UPtr();
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
// Copy phi to autoPtr. Rename to make sure copy is now registered as 'phi'.
|
||||
phi.rename("phiFluid");
|
||||
phiPtr.reset(new surfaceScalarField("phi", phi));
|
||||
|
||||
autoPtr<compressible::RASModel> RASModel
|
||||
(
|
||||
compressible::RASModel::New
|
||||
turbulence = compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
phiPtr(),
|
||||
thermo()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -32,7 +32,8 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "RASModel.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "solidThermo.H"
|
||||
#include "wallFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -56,7 +57,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
surfaceScalarField heatFlux
|
||||
(
|
||||
fvc::interpolate(RASModel->alphaEff())*fvc::snGrad(h)
|
||||
fvc::interpolate
|
||||
(
|
||||
(
|
||||
turbulence.valid()
|
||||
? turbulence->alphaEff()()
|
||||
: thermo->alpha()
|
||||
)
|
||||
)*fvc::snGrad(h)
|
||||
);
|
||||
|
||||
const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,6 +93,7 @@ int main(int argc, char *argv[])
|
||||
U[celli] *= ::pow(y[celli]/yblv, (1.0/7.0));
|
||||
}
|
||||
}
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
Info<< "Writing U\n" << endl;
|
||||
U.write();
|
||||
@ -109,7 +110,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (args.optionFound("writenut"))
|
||||
{
|
||||
Info<< "Writing nut" << endl;
|
||||
Info<< "Writing " << nut.name() << nl << endl;
|
||||
nut.write();
|
||||
}
|
||||
|
||||
@ -126,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
k = sqr(nut/(ck0*min(y, ybl)));
|
||||
k.correctBoundaryConditions();
|
||||
|
||||
Info<< "Writing k\n" << endl;
|
||||
Info<< "Writing " << k.name() << nl << endl;
|
||||
k.write();
|
||||
|
||||
|
||||
@ -137,7 +138,7 @@ int main(int argc, char *argv[])
|
||||
epsilon = ce0*k*sqrt(k)/min(y, ybl);
|
||||
epsilon.correctBoundaryConditions();
|
||||
|
||||
Info<< "Writing epsilon\n" << endl;
|
||||
Info<< "Writing " << epsilon.name() << nl << endl;
|
||||
epsilon.write();
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,9 +41,9 @@ License
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::RASModel::New(U, phi, laminarTransport)
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
Info<< "Calculating wall distance field" << endl;
|
||||
|
||||
@ -88,7 +88,7 @@ cleanCase()
|
||||
rm -rf \
|
||||
allOwner* cell* face* meshModifiers* \
|
||||
owner* neighbour* point* edge* \
|
||||
cellLevel* pointLevel* refinementHistory* level0Edge surfaceIndex* sets \
|
||||
cellLevel* pointLevel* refinementHistory* level0Edge* surfaceIndex* sets \
|
||||
> /dev/null 2>&1 \
|
||||
)
|
||||
fi
|
||||
|
||||
@ -172,7 +172,7 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
|
||||
maxLenSqr = max(maxLenSqr, magSqr(pt - cc));
|
||||
maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt)));
|
||||
}
|
||||
tols[faceI] = max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr));
|
||||
tols[faceI] = max(SMALL, max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr)));
|
||||
}
|
||||
return tols;
|
||||
}
|
||||
@ -200,12 +200,40 @@ Foam::label Foam::coupledPolyPatch::getRotation
|
||||
}
|
||||
}
|
||||
|
||||
if (anchorFp == -1 || mag(minDistSqr) > tol)
|
||||
if (anchorFp == -1 || Foam::sqrt(minDistSqr) > tol)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check that anchor is unique.
|
||||
forAll(f, fp)
|
||||
{
|
||||
scalar distSqr = magSqr(anchor - points[f[fp]]);
|
||||
|
||||
if (distSqr == minDistSqr && fp != anchorFp)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"label coupledPolyPatch::getRotation\n"
|
||||
"(\n"
|
||||
" const pointField&,\n"
|
||||
" const face&,\n"
|
||||
" const point&,\n"
|
||||
" const scalar\n"
|
||||
")"
|
||||
) << "Cannot determine unique anchor point on face "
|
||||
<< UIndirectList<point>(points, f)
|
||||
<< endl
|
||||
<< "Both at index " << anchorFp << " and " << fp
|
||||
<< " the vertices have the same distance "
|
||||
<< Foam::sqrt(minDistSqr)
|
||||
<< " to the anchor " << anchor
|
||||
<< ". Continuing but results might be wrong."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Positive rotation
|
||||
return (f.size() - anchorFp) % f.size();
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -118,9 +118,20 @@ void Foam::primitiveMesh::makeFaceCentresAndAreas
|
||||
sumAc += a*c;
|
||||
}
|
||||
|
||||
fCtrs[facei] = (1.0/3.0)*sumAc/(sumA + VSMALL);
|
||||
|
||||
if (sumA < ROOTVSMALL)
|
||||
{
|
||||
// Sum of area too small. No chance of reliably calculating
|
||||
// centroid so fallback to average.
|
||||
fCtrs[facei] = fCentre;
|
||||
fAreas[facei] = 0.5*sumN;
|
||||
}
|
||||
else
|
||||
{
|
||||
fCtrs[facei] = (1.0/3.0)*sumAc/sumA;
|
||||
fAreas[facei] = 0.5*sumN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,209 +28,14 @@ License
|
||||
#include "unitConversion.H"
|
||||
#include "refinementSurfaces.H"
|
||||
#include "searchableSurfaces.H"
|
||||
#include "regExp.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// Read the number of layers from dictionary. Per patch 0 or the number
|
||||
// of layers.
|
||||
Foam::labelList Foam::layerParameters::readNumLayers
|
||||
(
|
||||
const PtrList<dictionary>& surfaceDicts,
|
||||
const refinementSurfaces& refineSurfaces,
|
||||
const labelList& globalToPatch,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
)
|
||||
{
|
||||
// Per surface the number of layers
|
||||
labelList globalSurfLayers(surfaceDicts.size());
|
||||
// Per surface, per region the number of layers
|
||||
List<Map<label> > regionSurfLayers(surfaceDicts.size());
|
||||
|
||||
const labelList& surfaceIndices = refineSurfaces.surfaces();
|
||||
|
||||
forAll(surfaceDicts, surfI)
|
||||
{
|
||||
const dictionary& dict = surfaceDicts[surfI];
|
||||
|
||||
globalSurfLayers[surfI] = readLabel(dict.lookup("surfaceLayers"));
|
||||
|
||||
if (dict.found("regions"))
|
||||
{
|
||||
// Per-region layer information
|
||||
|
||||
PtrList<dictionary> regionDicts(dict.lookup("regions"));
|
||||
|
||||
const wordList& regionNames =
|
||||
refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
|
||||
|
||||
forAll(regionDicts, dictI)
|
||||
{
|
||||
const dictionary& regionDict = regionDicts[dictI];
|
||||
|
||||
const word regionName(regionDict.lookup("name"));
|
||||
|
||||
label regionI = findIndex(regionNames, regionName);
|
||||
|
||||
label nLayers = readLabel(regionDict.lookup("surfaceLayers"));
|
||||
|
||||
Info<< " region " << regionName << ':'<< nl
|
||||
<< " surface layers:" << nLayers << nl;
|
||||
|
||||
regionSurfLayers[surfI].insert(regionI, nLayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Transfer per surface/region information into patchwise region info
|
||||
|
||||
labelList nLayers(boundaryMesh.size(), 0);
|
||||
|
||||
forAll(surfaceIndices, surfI)
|
||||
{
|
||||
const wordList& regionNames =
|
||||
refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
|
||||
|
||||
forAll(regionNames, regionI)
|
||||
{
|
||||
const word& regionName = regionNames[regionI];
|
||||
|
||||
label global = refineSurfaces.globalRegion(surfI, regionI);
|
||||
|
||||
label patchI = globalToPatch[global];
|
||||
|
||||
// Initialise to surface-wise layers
|
||||
nLayers[patchI] = globalSurfLayers[surfI];
|
||||
|
||||
// Override with region specific data if available
|
||||
Map<label>::const_iterator iter =
|
||||
regionSurfLayers[surfI].find(regionI);
|
||||
|
||||
if (iter != regionSurfLayers[surfI].end())
|
||||
{
|
||||
nLayers[patchI] = iter();
|
||||
}
|
||||
|
||||
// Check
|
||||
if (nLayers[patchI] < 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"layerParameters::readNumLayers(..)"
|
||||
) << "Illegal number of layers " << nLayers[patchI]
|
||||
<< " for surface "
|
||||
<< refineSurfaces.names()[surfI]
|
||||
<< " region " << regionName << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nLayers;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
//// Construct from dictionary
|
||||
//Foam::layerParameters::layerParameters
|
||||
//(
|
||||
// const PtrList<dictionary>& surfaceDicts,
|
||||
// const refinementSurfaces& refineSurfaces,
|
||||
// const labelList& globalToPatch,
|
||||
// const dictionary& dict,
|
||||
// const polyBoundaryMesh& boundaryMesh
|
||||
//)
|
||||
//:
|
||||
// numLayers_
|
||||
// (
|
||||
// readNumLayers
|
||||
// (
|
||||
// surfaceDicts,
|
||||
// refineSurfaces,
|
||||
// globalToPatch,
|
||||
// boundaryMesh
|
||||
// )
|
||||
// ),
|
||||
// expansionRatio_
|
||||
// (
|
||||
// numLayers_.size(),
|
||||
// readScalar(dict.lookup("expansionRatio"))
|
||||
// ),
|
||||
// relativeSizes_(false),
|
||||
// finalLayerThickness_
|
||||
// (
|
||||
// numLayers_.size(),
|
||||
// readScalar(dict.lookup("finalLayerRatio"))
|
||||
// ),
|
||||
// minThickness_
|
||||
// (
|
||||
// numLayers_.size(),
|
||||
// readScalar(dict.lookup("minThickness"))
|
||||
// ),
|
||||
// featureAngle_(readScalar(dict.lookup("featureAngle"))),
|
||||
// concaveAngle_
|
||||
// (
|
||||
// dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
|
||||
// ),
|
||||
// nGrow_(readLabel(dict.lookup("nGrow"))),
|
||||
// nSmoothSurfaceNormals_
|
||||
// (
|
||||
// readLabel(dict.lookup("nSmoothSurfaceNormals"))
|
||||
// ),
|
||||
// nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
|
||||
// nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
|
||||
// maxFaceThicknessRatio_
|
||||
// (
|
||||
// readScalar(dict.lookup("maxFaceThicknessRatio"))
|
||||
// ),
|
||||
// layerTerminationCos_
|
||||
// (
|
||||
// Foam::cos(degToRad(0.5*featureAngle_))
|
||||
// ),
|
||||
// maxThicknessToMedialRatio_
|
||||
// (
|
||||
// readScalar(dict.lookup("maxThicknessToMedialRatio"))
|
||||
// ),
|
||||
// minMedianAxisAngleCos_
|
||||
// (
|
||||
// Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
|
||||
// ),
|
||||
// nBufferCellsNoExtrude_
|
||||
// (
|
||||
// readLabel(dict.lookup("nBufferCellsNoExtrude"))
|
||||
// ),
|
||||
// nSnap_(readLabel(dict.lookup("nSnap"))),
|
||||
// nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
|
||||
// nRelaxedIter_(labelMax)
|
||||
//{
|
||||
// if (nGrow_ > 0)
|
||||
// {
|
||||
// WarningIn("layerParameters::layerParameters(..)")
|
||||
// << "The nGrow parameter effect has changed with respect to 1.6.x."
|
||||
// << endl
|
||||
// << "Please set nGrow=0 for 1.6.x behaviour."
|
||||
// << endl;
|
||||
// }
|
||||
//
|
||||
// dict.readIfPresent("nRelaxedIter", nRelaxedIter_);
|
||||
//
|
||||
// if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
|
||||
// {
|
||||
// FatalErrorIn("layerParameters::layerParameters(..)")
|
||||
// << "Layer iterations should be >= 0." << endl
|
||||
// << "nLayerIter:" << nLayerIter_
|
||||
// << " nRelaxedIter:" << nRelaxedIter_
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// Construct from dictionary
|
||||
Foam::layerParameters::layerParameters
|
||||
(
|
||||
@ -315,13 +120,30 @@ Foam::layerParameters::layerParameters
|
||||
|
||||
const dictionary& layersDict = dict.subDict("layers");
|
||||
|
||||
forAll(boundaryMesh, patchI)
|
||||
forAllConstIter(dictionary, layersDict, iter)
|
||||
{
|
||||
const word& patchName = boundaryMesh[patchI].name();
|
||||
if (iter().isDict())
|
||||
{
|
||||
const word& key = iter().keyword();
|
||||
const labelHashSet patchIDs
|
||||
(
|
||||
boundaryMesh.patchSet(List<wordRe>(1, key))
|
||||
);
|
||||
|
||||
if (layersDict.found(patchName))
|
||||
if (patchIDs.size() == 0)
|
||||
{
|
||||
const dictionary& layerDict = layersDict.subDict(patchName);
|
||||
IOWarningIn("layerParameters::layerParameters(..)", layersDict)
|
||||
<< "Layer specification for " << key
|
||||
<< " does not match any patch." << endl
|
||||
<< "Valid patches are " << boundaryMesh.names() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
const dictionary& layerDict = iter().dict();
|
||||
|
||||
forAllConstIter(labelHashSet, patchIDs, patchIter)
|
||||
{
|
||||
label patchI = patchIter.key();
|
||||
|
||||
numLayers_[patchI] =
|
||||
readLabel(layerDict.lookup("nSurfaceLayers"));
|
||||
@ -343,43 +165,6 @@ Foam::layerParameters::layerParameters
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check whether layer specification matches any patches
|
||||
const List<keyType> wildCards = layersDict.keys(true);
|
||||
|
||||
forAll(wildCards, i)
|
||||
{
|
||||
regExp re(wildCards[i]);
|
||||
|
||||
bool hasMatch = false;
|
||||
forAll(boundaryMesh, patchI)
|
||||
{
|
||||
if (re.match(boundaryMesh[patchI].name()))
|
||||
{
|
||||
hasMatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasMatch)
|
||||
{
|
||||
IOWarningIn("layerParameters::layerParameters(..)", layersDict)
|
||||
<< "Wildcard layer specification for " << wildCards[i]
|
||||
<< " does not match any patch." << endl
|
||||
<< "Valid patches are " << boundaryMesh.names() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
const List<keyType> nonWildCards = layersDict.keys(false);
|
||||
|
||||
forAll(nonWildCards, i)
|
||||
{
|
||||
if (boundaryMesh.findPatchID(nonWildCards[i]) == -1)
|
||||
{
|
||||
IOWarningIn("layerParameters::layerParameters(..)", layersDict)
|
||||
<< "Layer specification for " << nonWildCards[i]
|
||||
<< " does not match any patch." << endl
|
||||
<< "Valid patches are " << boundaryMesh.names() << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -109,15 +109,6 @@ class layerParameters
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Extract patch-wise number of layers
|
||||
static labelList readNumLayers
|
||||
(
|
||||
const PtrList<dictionary>& surfaceDicts,
|
||||
const refinementSurfaces& refineSurfaces,
|
||||
const labelList& globalToPatch,
|
||||
const polyBoundaryMesh& boundaryMesh
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
layerParameters(const layerParameters&);
|
||||
|
||||
@ -129,17 +120,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
////- Construct from dictionary - old syntax
|
||||
//layerParameters
|
||||
//(
|
||||
// const PtrList<dictionary>& surfaceDicts,
|
||||
// const refinementSurfaces& refineSurfaces,
|
||||
// const labelList& globalToPatch,
|
||||
// const dictionary& dict,
|
||||
// const polyBoundaryMesh& boundaryMesh
|
||||
//);
|
||||
|
||||
//- Construct from dictionary - new syntax
|
||||
//- Construct from dictionary
|
||||
layerParameters(const dictionary& dict, const polyBoundaryMesh&);
|
||||
|
||||
|
||||
|
||||
@ -129,17 +129,9 @@ extern "C"
|
||||
|
||||
// Hack: scotch generates floating point errors so need to switch of error
|
||||
// trapping!
|
||||
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
|
||||
# define LINUX
|
||||
#endif
|
||||
|
||||
#if defined(LINUX) && defined(__GNUC__)
|
||||
# define LINUX_GNUC
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_GNUC
|
||||
# ifndef __USE_GNU
|
||||
# define __USE_GNU
|
||||
#ifdef __GLIBC__
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
# endif
|
||||
# include <fenv.h>
|
||||
#endif
|
||||
@ -651,7 +643,7 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
|
||||
|
||||
// Hack:switch off fpu error trapping
|
||||
# ifdef LINUX_GNUC
|
||||
# ifdef FE_NOMASK_ENV
|
||||
int oldExcepts = fedisableexcept
|
||||
(
|
||||
FE_DIVBYZERO
|
||||
@ -681,7 +673,7 @@ Foam::label Foam::ptscotchDecomp::decompose
|
||||
"SCOTCH_graphMap"
|
||||
);
|
||||
|
||||
# ifdef LINUX_GNUC
|
||||
# ifdef FE_NOMASK_ENV
|
||||
feenableexcept(oldExcepts);
|
||||
# endif
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -135,17 +135,9 @@ extern "C"
|
||||
|
||||
// Hack: scotch generates floating point errors so need to switch of error
|
||||
// trapping!
|
||||
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64)
|
||||
# define LINUX
|
||||
#endif
|
||||
|
||||
#if defined(LINUX) && defined(__GNUC__)
|
||||
# define LINUX_GNUC
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_GNUC
|
||||
# ifndef __USE_GNU
|
||||
# define __USE_GNU
|
||||
#ifdef __GLIBC__
|
||||
# ifndef _GNU_SOURCE
|
||||
# define _GNU_SOURCE
|
||||
# endif
|
||||
# include <fenv.h>
|
||||
#endif
|
||||
@ -503,7 +495,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
|
||||
|
||||
|
||||
// Hack:switch off fpu error trapping
|
||||
# ifdef LINUX_GNUC
|
||||
# ifdef FE_NOMASK_ENV
|
||||
int oldExcepts = fedisableexcept
|
||||
(
|
||||
FE_DIVBYZERO
|
||||
@ -526,7 +518,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
|
||||
"SCOTCH_graphMap"
|
||||
);
|
||||
|
||||
# ifdef LINUX_GNUC
|
||||
# ifdef FE_NOMASK_ENV
|
||||
feenableexcept(oldExcepts);
|
||||
# endif
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ Description
|
||||
#define makesolidThermo_H
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "basicThermo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
namespace Foam
|
||||
@ -127,6 +128,12 @@ addToRunTimeSelectionTable \
|
||||
BaseThermo, \
|
||||
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
|
||||
mesh \
|
||||
); \
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
basicThermo, \
|
||||
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
|
||||
fvMesh \
|
||||
); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
|
||||
0
tutorials/combustion/chemFoam/nc7h16/validation/createGraph
Executable file → Normal file
0
tutorials/combustion/chemFoam/nc7h16/validation/createGraph
Executable file → Normal file
Reference in New Issue
Block a user