diff --git a/applications/solvers/combustion/chemFoam/Make/files b/applications/solvers/combustion/chemFoam/Make/files new file mode 100644 index 0000000000..64919e7ff1 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/Make/files @@ -0,0 +1,3 @@ +chemFoam.C + +EXE = $(FOAM_APPBIN)/chemFoam diff --git a/applications/solvers/combustion/chemFoam/Make/options b/applications/solvers/combustion/chemFoam/Make/options new file mode 100644 index 0000000000..d5a7a75202 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/Make/options @@ -0,0 +1,21 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude\ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + + +EXE_LIBS = \ + -lfiniteVolume \ + -lcompressibleRASModels \ + -lreactionThermophysicalModels \ + -lbasicThermophysicalModels \ + -lchemistryModel \ + -lODE \ + -lthermophysicalFunctions \ + -lspecie diff --git a/applications/solvers/combustion/chemFoam/YEqn.H b/applications/solvers/combustion/chemFoam/YEqn.H new file mode 100644 index 0000000000..edb4072b7d --- /dev/null +++ b/applications/solvers/combustion/chemFoam/YEqn.H @@ -0,0 +1,12 @@ +{ + forAll(Y, specieI) + { + volScalarField& Yi = Y[specieI]; + + solve + ( + fvm::ddt(rho, Yi) - chemistry.RR(specieI), + mesh.solver("Yi") + ); + } +} \ No newline at end of file diff --git a/applications/solvers/combustion/chemFoam/chemFoam.C b/applications/solvers/combustion/chemFoam/chemFoam.C new file mode 100644 index 0000000000..9a19930ee5 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/chemFoam.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +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 . + +Application + chemFoam + +Description + Solver for chemistry problems + - designed for use on single cell cases to provide comparison against + other chemistry solvers + - single cell mesh created on-the-fly + - fields created on the fly from the initial conditions + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "hCombustionThermo.H" +#include "turbulenceModel.H" +#include "psiChemistryModel.H" +#include "chemistrySolver.H" +#include "OFstream.H" +#include "thermoPhysicsTypes.H" +#include "basicMultiComponentMixture.H" +#include "cellModeller.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "setRootCase.H" + #include "createTime.H" + #include "createSingleCellMesh.H" + #include "createFields.H" + #include "readInitialConditions.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readControls.H" + + #include "setDeltaT.H" + + runTime++; + Info<< "Time = " << runTime.timeName() << nl << endl; + + #include "solveChemistry.H" + + { + #include "YEqn.H" + + #include "hEqn.H" + + #include "pEqn.H" + } + + #include "output.H" + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info << "Number of steps = " << runTime.timeIndex() << endl; + Info << "End" << nl << endl; + + return(0); +} + + +// ************************************************************************* // diff --git a/applications/solvers/combustion/chemFoam/createBaseFields.H b/applications/solvers/combustion/chemFoam/createBaseFields.H new file mode 100644 index 0000000000..0762f2708d --- /dev/null +++ b/applications/solvers/combustion/chemFoam/createBaseFields.H @@ -0,0 +1,57 @@ +// write base thermo fields - not registered since will be re-read by +// thermo package + +Info<< "Creating base fields for time " << runTime.timeName() << endl; +{ + volScalarField Ydefault + ( + IOobject + ( + "Ydefault", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ), + mesh, + dimensionedScalar("Ydefault", dimless, 1) + ); + + Ydefault.write(); + + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ), + mesh, + dimensionedScalar("p", dimPressure, p0) + ); + + p.write(); + + volScalarField T + ( + IOobject + ( + "T", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ), + mesh, + dimensionedScalar("T", dimTemperature, T0) + ); + + T.write(); +} + diff --git a/applications/solvers/combustion/chemFoam/createFields.H b/applications/solvers/combustion/chemFoam/createFields.H new file mode 100644 index 0000000000..4a971492c9 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/createFields.H @@ -0,0 +1,84 @@ + if (mesh.nCells() != 1) + { + FatalErrorIn(args.executable()) + << "Solver only applicable to single cell cases" + << exit(FatalError); + } + + Info<< "Reading initial conditions.\n" << endl; + IOdictionary initialConditions + ( + IOobject + ( + "initialConditions", + runTime.constant(), + runTime, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + scalar p0 = readScalar(initialConditions.lookup("p")); + scalar T0 = readScalar(initialConditions.lookup("T")); + + #include "createBaseFields.H" + + Info<< nl << "Reading thermophysicalProperties" << endl; + autoPtr pChemistry(psiChemistryModel::New(mesh)); + + psiChemistryModel& chemistry = pChemistry(); + scalar dtChem = refCast(chemistry).deltaTChem()[0]; + + hsCombustionThermo& thermo = chemistry.thermo(); + basicMultiComponentMixture& composition = thermo.composition(); + PtrList& Y = composition.Y(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + volScalarField& p = thermo.p(); + volScalarField& hs = thermo.hs(); + + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + runTime, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedVector("zero", dimVelocity, vector::zero), + p.boundaryField().types() + ); + + #include "createPhi.H" + + Info << "Creating turbulence model.\n" << endl; + autoPtr turbulence + ( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) + ); + + OFstream post(args.path()/"chemFoam.out"); + post<< "# Time" << token::TAB << "Temperature [K]" << token::TAB + << "Pressure [Pa]" << endl; + + diff --git a/applications/solvers/combustion/chemFoam/createSingleCellMesh.H b/applications/solvers/combustion/chemFoam/createSingleCellMesh.H new file mode 100644 index 0000000000..e9f0272772 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/createSingleCellMesh.H @@ -0,0 +1,38 @@ +Info<< "Constructing single cell mesh" << nl << endl; + +labelList owner(6, 0); +labelList neighbour(0); + +pointField points(8); +points[0] = vector(0, 0, 0); +points[1] = vector(1, 0, 0); +points[2] = vector(1, 1, 0); +points[3] = vector(0, 1, 0); +points[4] = vector(0, 0, 1); +points[5] = vector(1, 0, 1); +points[6] = vector(1, 1, 1); +points[7] = vector(0, 1, 1); + +const cellModel& hexa = *(cellModeller::lookup("hex")); +faceList faces = hexa.modelFaces(); + +fvMesh mesh +( + IOobject + ( + fvMesh::defaultRegion, + runTime.timeName(), + runTime, + IOobject::NO_READ + ), + xferMove >(points), + faces.xfer(), + owner.xfer(), + neighbour.xfer() +); + +List patches(1); + +patches[0] = new emptyPolyPatch("boundary", 6, 0, 0, mesh.boundaryMesh()); + +mesh.addFvPatches(patches); diff --git a/applications/solvers/combustion/chemFoam/hEqn.H b/applications/solvers/combustion/chemFoam/hEqn.H new file mode 100644 index 0000000000..855ca66a42 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/hEqn.H @@ -0,0 +1,10 @@ +{ + if (constProp == "volume") + { + hs[0] = u0 + p[0]/rho[0] + integratedHeat; + } + else + { + hs[0] = hs0 + integratedHeat; + } +} \ No newline at end of file diff --git a/applications/solvers/combustion/chemFoam/output.H b/applications/solvers/combustion/chemFoam/output.H new file mode 100644 index 0000000000..5620fe6820 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/output.H @@ -0,0 +1,11 @@ + runTime.write(); + + Info<< "Sh = " << Sh + << ", T = " << thermo.T()[0] + << ", p = " << thermo.p()[0] + << ", " << Y[0].name() << " = " << Y[0][0] + << endl; + + post<< runTime.value() << token::TAB << thermo.T()[0] << token::TAB + << thermo.p()[0] << endl; + diff --git a/applications/solvers/combustion/chemFoam/pEqn.H b/applications/solvers/combustion/chemFoam/pEqn.H new file mode 100644 index 0000000000..28d240940b --- /dev/null +++ b/applications/solvers/combustion/chemFoam/pEqn.H @@ -0,0 +1,9 @@ +{ + thermo.correct(); + rho = thermo.rho(); + if (constProp == "volume") + { + p[0] = rho0*R0*thermo.T()[0]; + rho[0] = rho0; + } +} \ No newline at end of file diff --git a/applications/solvers/combustion/chemFoam/readControls.H b/applications/solvers/combustion/chemFoam/readControls.H new file mode 100644 index 0000000000..416271908f --- /dev/null +++ b/applications/solvers/combustion/chemFoam/readControls.H @@ -0,0 +1,8 @@ + if (runTime.controlDict().lookupOrDefault("suppressSolverInfo", false)) + { + lduMatrix::debug = 0; + } + + Switch adjustTimeStep(runTime.controlDict().lookup("adjustTimeStep")); + + scalar maxDeltaT(readScalar(runTime.controlDict().lookup("maxDeltaT"))); diff --git a/applications/solvers/combustion/chemFoam/readInitialConditions.H b/applications/solvers/combustion/chemFoam/readInitialConditions.H new file mode 100644 index 0000000000..6b26e5fc37 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/readInitialConditions.H @@ -0,0 +1,111 @@ + word constProp(initialConditions.lookup("constantProperty")); + if (constProp == "pressure" || constProp == "volume") + { + Info << constProp << " will be held constant." << nl + << " p = " << p[0] << " [Pa]" << nl + << " T = " << thermo.T()[0] << " [K] " << nl + << " rho = " << rho[0] << " [kg/m3]" << nl + << endl; + } + else + { + FatalError << "in initialConditions, unknown constantProperty type " + << constProp << nl << " Valid types are: pressure volume." + << abort(FatalError); + } + + word fractionBasis(initialConditions.lookup("fractionBasis")); + if ((fractionBasis != "mass") && (fractionBasis != "mole")) + { + FatalError << "in initialConditions, unknown fractionBasis type " << nl + << "Valid types are: mass or mole." + << fractionBasis << abort(FatalError); + } + + label nSpecie = Y.size(); + PtrList specieData(Y.size()); + forAll(specieData, i) + { + specieData.set + ( + i, + new gasThermoPhysics + ( + dynamic_cast&> + (thermo).speciesData()[i] + ) + ); + } + + scalarList Y0(nSpecie, 0.0); + scalarList X0(nSpecie, 0.0); + + dictionary fractions(initialConditions.subDict("fractions")); + if (fractionBasis == "mole") + { + forAll(Y, i) + { + const word& name = Y[i].name(); + if (fractions.found(name)) + { + X0[i] = readScalar(fractions.lookup(name)); + } + } + + scalar mw = 0.0; + const scalar mTot = sum(X0); + forAll(Y, i) + { + X0[i] /= mTot; + mw += specieData[i].W()*X0[i]; + } + + forAll(Y, i) + { + Y0[i] = X0[i]*specieData[i].W()/mw; + } + } + else // mass fraction + { + forAll(Y, i) + { + const word& name = Y[i].name(); + if (fractions.found(name)) + { + Y0[i] = readScalar(fractions.lookup(name)); + } + } + + scalar invW = 0.0; + const scalar mTot = sum(Y0); + forAll(Y, i) + { + Y0[i] /= mTot; + invW += Y0[i]/specieData[i].W(); + } + const scalar mw = 1.0/invW; + + forAll(Y, i) + { + X0[i] = Y0[i]*mw/specieData[i].W(); + } + } + + scalar hs0 = 0.0; + forAll(Y, i) + { + Y[i] = Y0[i]; + hs0 += Y0[i]*specieData[i].Hs(T0); + } + + hs = dimensionedScalar("hs", dimEnergy/dimMass, hs0); + + thermo.correct(); + + rho = thermo.rho(); + scalar rho0 = rho[0]; + scalar u0 = hs0 - p0/rho0; + scalar R0 = p0/(rho0*T0); + + scalar integratedHeat = 0.0; + diff --git a/applications/solvers/combustion/chemFoam/setDeltaT.H b/applications/solvers/combustion/chemFoam/setDeltaT.H new file mode 100644 index 0000000000..46d9f7bf43 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/setDeltaT.H @@ -0,0 +1,6 @@ +if (adjustTimeStep) +{ + runTime.setDeltaT(min(dtChem, maxDeltaT)); + Info<< "deltaT = " << runTime.deltaT().value() << endl; +} + diff --git a/applications/solvers/combustion/chemFoam/solveChemistry.H b/applications/solvers/combustion/chemFoam/solveChemistry.H new file mode 100644 index 0000000000..daf56309bd --- /dev/null +++ b/applications/solvers/combustion/chemFoam/solveChemistry.H @@ -0,0 +1,7 @@ + dtChem = chemistry.solve + ( + runTime.value() - runTime.deltaT().value(), + runTime.deltaT().value() + ); + scalar Sh = chemistry.Sh()()[0]/rho[0]; + integratedHeat += Sh*runTime.deltaT().value(); diff --git a/applications/test/nearWallDist-wave/Test-WallDist2.C b/applications/test/nearWallDist-wave/Test-WallDist2.C index 364a73279f..45690a33f4 100644 --- a/applications/test/nearWallDist-wave/Test-WallDist2.C +++ b/applications/test/nearWallDist-wave/Test-WallDist2.C @@ -29,7 +29,7 @@ Description #include "fvCFD.H" #include "wallFvPatch.H" -#include "MeshWave.H" +#include "FaceCellWave.H" #include "wallPoint.H" @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) forAll(allCellInfo, cellI) { scalar dist = allCellInfo[cellI].distSqr(); - if (allCellInfo[cellI].valid()) + if (allCellInfo[cellI].valid(wallDistCalc.data())) { wallDistUncorrected[cellI] = Foam::sqrt(dist); } @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) const label meshFaceI = patchField.patch().start() + patchFaceI; scalar dist = allFaceInfo[meshFaceI].distSqr(); - if (allFaceInfo[meshFaceI].valid()) + if (allFaceInfo[meshFaceI].valid(wallDistCalc.data())) { patchField[patchFaceI] = Foam::sqrt(dist); } diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index 827449c02c..8f86a145d5 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCells.C +++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C @@ -299,7 +299,7 @@ label selectOutsideCells mesh, outsideFaces.shrink(), outsideFacesInfo.shrink(), - mesh.globalData().nTotalCells()+1 // max iterations + mesh.globalData().nTotalCells()+1 // max iterations ); // Now regionCalc should hold info on cells that are reachable from diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index a85a4e417f..bd6aafe348 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) blockMesh::verbose(true); IOdictionary meshDict(meshDictIoPtr()); - blockMesh blocks(meshDict); + blockMesh blocks(meshDict, regionName); if (args.optionFound("blockTopology")) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C index 1d926ed93d..c8561a6d67 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTopology.C @@ -147,8 +147,8 @@ Foam::label Foam::checkTopology } } - faceSet oneCells(mesh, "oneInternalFaceCells", mesh.nCells()/100); - faceSet twoCells(mesh, "twoInternalFacesCells", mesh.nCells()/100); + cellSet oneCells(mesh, "oneInternalFaceCells", mesh.nCells()/100); + cellSet twoCells(mesh, "twoInternalFacesCells", mesh.nCells()/100); forAll(nInternalFaces, cellI) { diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C index 5e32cfc084..f64f43b542 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C @@ -321,7 +321,7 @@ void Foam::vtkPV3blockMesh::updateFoamMesh() ) ); - meshPtr_ = new blockMesh(meshDict); + meshPtr_ = new blockMesh(meshDict, polyMesh::defaultRegion); } diff --git a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C index 12704388bb..a8ff42c3f8 100644 --- a/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C +++ b/applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C @@ -83,7 +83,7 @@ PtrList > readFields { Info<< " reading field " << obj.name() << endl; IOField newField(obj); - values.set(fieldI++, new List(newField.xferList())); + values.set(fieldI++, new List(newField.xfer())); break; } } diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index b140bf246b..bc5c81e94d 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -67,13 +67,15 @@ cleanCase() rm -rf forces* > /dev/null 2>&1 rm -rf sets > /dev/null 2>&1 rm -rf system/machines > /dev/null 2>&1 - (cd constant/polyMesh && \ - rm -rf \ - allOwner* cell* face* meshModifiers* \ - owner* neighbour* point* edge* \ - cellLevel* pointLevel* refinementHistory* surfaceIndex* sets \ - > /dev/null 2>&1 \ - ) + if [ -d "constant/polyMesh" ]; then + (cd constant/polyMesh && \ + rm -rf \ + allOwner* cell* face* meshModifiers* \ + owner* neighbour* point* edge* \ + cellLevel* pointLevel* refinementHistory* surfaceIndex* sets \ + > /dev/null 2>&1 \ + ) + fi (cd constant && \ rm -rf \ cellToRegion cellLevel* pointLevel* \ diff --git a/src/Allwmake b/src/Allwmake index 354aee075d..2fd099352d 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -21,16 +21,16 @@ OSspecific/$WM_OSTYPE/Allwmake wmake libso OpenFOAM wmake libso fileFormats +wmake libso triSurface +wmake libso meshTools wmake libso edgeMesh wmake libso surfMesh -wmake libso triSurface # Decomposition methods needed by dummyThirdParty parallel/decompose/AllwmakeLnInclude # dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools dummyThirdParty/Allwmake -wmake libso meshTools wmake libso lagrangian/basic wmake libso finiteVolume wmake libso genericPatchFields diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C index 3a9155614f..453360ebb9 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C +++ b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C @@ -35,75 +35,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template -const Foam::scalar Foam::FaceCellWave::geomTol_ = 1e-6; +template +const Foam::scalar +Foam::FaceCellWave::geomTol_ = 1e-6; -template -Foam::scalar Foam::FaceCellWave::propagationTol_ = 0.01; +template +const Foam::scalar +Foam::FaceCellWave::propagationTol_ = 0.01; -// Write to ostream -template -Foam::Ostream& Foam::FaceCellWave::writeFaces -( - const label nFaces, - const labelList& faceLabels, - const List& faceInfo, - Ostream& os -) -{ - // Write list contents depending on data format - if (os.format() == IOstream::ASCII) - { - os << nFaces; - - for (label i = 0; i < nFaces; i++) - { - os << ' ' << faceLabels[i]; - } - for (label i = 0; i < nFaces; i++) - { - os << ' ' << faceInfo[i]; - } - } - else - { - os << nFaces; - - for (label i = 0; i < nFaces; i++) - { - os << faceLabels[i]; - } - for (label i = 0; i < nFaces; i++) - { - os << faceInfo[i]; - } - } - return os; -} - - -// Read from istream -template -Foam::Istream& Foam::FaceCellWave::readFaces -( - label& nFaces, - labelList& faceLabels, - List& faceInfo, - Istream& is -) -{ - is >> nFaces; - - for (label i = 0; i < nFaces; i++) - { - is >> faceLabels[i]; - } - for (label i = 0; i < nFaces; i++) - { - is >> faceInfo[i]; - } - return is; -} +template +Foam::label Foam::FaceCellWave::dummyTrackData_ = 12345; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -113,8 +54,8 @@ Foam::Istream& Foam::FaceCellWave::readFaces // Updates: // - changedCell_, changedCells_, nChangedCells_, // - statistics: nEvals_, nUnvisitedCells_ -template -bool Foam::FaceCellWave::updateCell +template +bool Foam::FaceCellWave::updateCell ( const label cellI, const label neighbourFaceI, @@ -125,7 +66,7 @@ bool Foam::FaceCellWave::updateCell { nEvals_++; - bool wasValid = cellInfo.valid(); + bool wasValid = cellInfo.valid(td_); bool propagate = cellInfo.updateCell @@ -134,7 +75,8 @@ bool Foam::FaceCellWave::updateCell cellI, neighbourFaceI, neighbourInfo, - tol + tol, + td_ ); if (propagate) @@ -146,7 +88,7 @@ bool Foam::FaceCellWave::updateCell } } - if (!wasValid && cellInfo.valid()) + if (!wasValid && cellInfo.valid(td_)) { --nUnvisitedCells_; } @@ -160,8 +102,8 @@ bool Foam::FaceCellWave::updateCell // Updates: // - changedFace_, changedFaces_, nChangedFaces_, // - statistics: nEvals_, nUnvisitedFaces_ -template -bool Foam::FaceCellWave::updateFace +template +bool Foam::FaceCellWave::updateFace ( const label faceI, const label neighbourCellI, @@ -172,7 +114,7 @@ bool Foam::FaceCellWave::updateFace { nEvals_++; - bool wasValid = faceInfo.valid(); + bool wasValid = faceInfo.valid(td_); bool propagate = faceInfo.updateFace @@ -181,7 +123,8 @@ bool Foam::FaceCellWave::updateFace faceI, neighbourCellI, neighbourInfo, - tol + tol, + td_ ); if (propagate) @@ -193,7 +136,7 @@ bool Foam::FaceCellWave::updateFace } } - if (!wasValid && faceInfo.valid()) + if (!wasValid && faceInfo.valid(td_)) { --nUnvisitedFaces_; } @@ -207,8 +150,8 @@ bool Foam::FaceCellWave::updateFace // Updates: // - changedFace_, changedFaces_, nChangedFaces_, // - statistics: nEvals_, nUnvisitedFaces_ -template -bool Foam::FaceCellWave::updateFace +template +bool Foam::FaceCellWave::updateFace ( const label faceI, const Type& neighbourInfo, @@ -218,7 +161,7 @@ bool Foam::FaceCellWave::updateFace { nEvals_++; - bool wasValid = faceInfo.valid(); + bool wasValid = faceInfo.valid(td_); bool propagate = faceInfo.updateFace @@ -226,7 +169,8 @@ bool Foam::FaceCellWave::updateFace mesh_, faceI, neighbourInfo, - tol + tol, + td_ ); if (propagate) @@ -238,7 +182,7 @@ bool Foam::FaceCellWave::updateFace } } - if (!wasValid && faceInfo.valid()) + if (!wasValid && faceInfo.valid(td_)) { --nUnvisitedFaces_; } @@ -248,8 +192,11 @@ bool Foam::FaceCellWave::updateFace // For debugging: check status on both sides of cyclic -template -void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const +template +void Foam::FaceCellWave::checkCyclic +( + const polyPatch& patch +) const { const cyclicPolyPatch& nbrPatch = refCast(patch).neighbPatch(); @@ -259,10 +206,22 @@ void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const label i1 = patch.start() + patchFaceI; label i2 = nbrPatch.start() + patchFaceI; - if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_)) + if + ( + !allFaceInfo_[i1].sameGeometry + ( + mesh_, + allFaceInfo_[i2], + geomTol_, + td_ + ) + ) { - FatalErrorIn("FaceCellWave::checkCyclic(const polyPatch&)") - << "problem: i:" << i1 << " otheri:" << i2 + FatalErrorIn + ( + "FaceCellWave" + "::checkCyclic(const polyPatch&)" + ) << "problem: i:" << i1 << " otheri:" << i2 << " faceInfo:" << allFaceInfo_[i1] << " otherfaceInfo:" << allFaceInfo_[i2] << abort(FatalError); @@ -270,8 +229,11 @@ void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const if (changedFace_[i1] != changedFace_[i2]) { - FatalErrorIn("FaceCellWave::checkCyclic(const polyPatch&)") - << " problem: i:" << i1 << " otheri:" << i2 + FatalErrorIn + ( + "FaceCellWave" + "::checkCyclic(const polyPatch&)" + ) << " problem: i:" << i1 << " otheri:" << i2 << " faceInfo:" << allFaceInfo_[i1] << " otherfaceInfo:" << allFaceInfo_[i2] << " changedFace:" << changedFace_[i1] @@ -283,8 +245,8 @@ void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const // Check if has cyclic patches -template -bool Foam::FaceCellWave::hasCyclicPatch() const +template +bool Foam::FaceCellWave::hasCyclicPatch() const { forAll(mesh_.boundaryMesh(), patchI) { @@ -298,8 +260,8 @@ bool Foam::FaceCellWave::hasCyclicPatch() const // Copy face information into member data -template -void Foam::FaceCellWave::setFaceInfo +template +void Foam::FaceCellWave::setFaceInfo ( const labelList& changedFaces, const List& changedFacesInfo @@ -309,13 +271,13 @@ void Foam::FaceCellWave::setFaceInfo { label faceI = changedFaces[changedFaceI]; - bool wasValid = allFaceInfo_[faceI].valid(); + bool wasValid = allFaceInfo_[faceI].valid(td_); // Copy info for faceI allFaceInfo_[faceI] = changedFacesInfo[changedFaceI]; // Maintain count of unset faces - if (!wasValid && allFaceInfo_[faceI].valid()) + if (!wasValid && allFaceInfo_[faceI].valid(td_)) { --nUnvisitedFaces_; } @@ -329,8 +291,8 @@ void Foam::FaceCellWave::setFaceInfo // Merge face information into member data -template -void Foam::FaceCellWave::mergeFaceInfo +template +void Foam::FaceCellWave::mergeFaceInfo ( const polyPatch& patch, const label nFaces, @@ -347,7 +309,7 @@ void Foam::FaceCellWave::mergeFaceInfo Type& currentWallInfo = allFaceInfo_[meshFaceI]; - if (currentWallInfo != neighbourWallInfo) + if (!currentWallInfo.equal(neighbourWallInfo, td_)) { updateFace ( @@ -364,8 +326,8 @@ void Foam::FaceCellWave::mergeFaceInfo // Construct compact patchFace change arrays for a (slice of a) single patch. // changedPatchFaces in local patch numbering. // Return length of arrays. -template -Foam::label Foam::FaceCellWave::getChangedPatchFaces +template +Foam::label Foam::FaceCellWave::getChangedPatchFaces ( const polyPatch& patch, const label startFaceI, @@ -394,8 +356,8 @@ Foam::label Foam::FaceCellWave::getChangedPatchFaces // Handle leaving domain. Implementation referred to Type -template -void Foam::FaceCellWave::leaveDomain +template +void Foam::FaceCellWave::leaveDomain ( const polyPatch& patch, const label nFaces, @@ -410,14 +372,14 @@ void Foam::FaceCellWave::leaveDomain label patchFaceI = faceLabels[i]; label meshFaceI = patch.start() + patchFaceI; - faceInfo[i].leaveDomain(mesh_, patch, patchFaceI, fc[meshFaceI]); + faceInfo[i].leaveDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_); } } // Handle entering domain. Implementation referred to Type -template -void Foam::FaceCellWave::enterDomain +template +void Foam::FaceCellWave::enterDomain ( const polyPatch& patch, const label nFaces, @@ -432,14 +394,14 @@ void Foam::FaceCellWave::enterDomain label patchFaceI = faceLabels[i]; label meshFaceI = patch.start() + patchFaceI; - faceInfo[i].enterDomain(mesh_, patch, patchFaceI, fc[meshFaceI]); + faceInfo[i].enterDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_); } } // Transform. Implementation referred to Type -template -void Foam::FaceCellWave::transform +template +void Foam::FaceCellWave::transform ( const tensorField& rotTensor, const label nFaces, @@ -452,22 +414,22 @@ void Foam::FaceCellWave::transform for (label faceI = 0; faceI < nFaces; faceI++) { - faceInfo[faceI].transform(mesh_, T); + faceInfo[faceI].transform(mesh_, T, td_); } } else { for (label faceI = 0; faceI < nFaces; faceI++) { - faceInfo[faceI].transform(mesh_, rotTensor[faceI]); + faceInfo[faceI].transform(mesh_, rotTensor[faceI], td_); } } } // Offset mesh face. Used for transferring from one cyclic half to the other. -template -void Foam::FaceCellWave::offset +template +void Foam::FaceCellWave::offset ( const polyPatch&, const label cycOffset, @@ -483,8 +445,8 @@ void Foam::FaceCellWave::offset // Tranfer all the information to/from neighbouring processors -template -void Foam::FaceCellWave::handleProcPatches() +template +void Foam::FaceCellWave::handleProcPatches() { // Send all @@ -532,7 +494,11 @@ void Foam::FaceCellWave::handleProcPatches() } UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); - writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); + //writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); + toNeighbour + << SubList