Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Sergio Ferraris
2011-10-05 13:37:51 +01:00
150 changed files with 3440 additions and 1677 deletions

View File

@ -39,15 +39,8 @@
#include "compressibleCreatePhi.H"
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("PIMPLE").lookup("rhoMin")
);
dimensionedScalar rhoMax(pimple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(pimple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence

View File

@ -46,10 +46,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;

View File

@ -48,12 +48,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
pimpleControl pimple(mesh);
#include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;

View File

@ -42,17 +42,10 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
setRefCell(p, simple.dict(), pRefCell, pRefValue);
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
);
dimensionedScalar rhoMax(simple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(simple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence

View File

@ -9,13 +9,7 @@
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("SIMPLE").found("nUCorrectors"))
{
nUCorr = readInt
(
mesh.solutionDict().subDict("SIMPLE").lookup("nUCorrectors")
);
}
simple.dict().readIfPresent("nUCorrectors", nUCorr);
if (nUCorr > 0)
{

View File

@ -45,12 +45,13 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "createZones.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;

View File

@ -42,11 +42,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;

View File

@ -41,17 +41,10 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
setRefCell(p, simple.dict(), pRefCell, pRefValue);
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
);
dimensionedScalar rhoMax(simple.dict().lookup("rhoMax"));
dimensionedScalar rhoMin(simple.dict().lookup("rhoMin"));
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::RASModel> turbulence

View File

@ -44,11 +44,12 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;

View File

@ -8,7 +8,9 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/reconstruct/reconstruct/lnInclude
EXE_LIBS = \
-lbasicThermophysicalModels \
@ -19,4 +21,6 @@ EXE_LIBS = \
-lcompressibleLESModels \
-lmeshTools \
-lfiniteVolume \
-lradiationModels
-lradiationModels \
-ldecompose \
-lreconstruct

View File

@ -0,0 +1,84 @@
// Get mapped alpha (surfaceScalarField)
tmp<surfaceScalarField> tallAlpha = procToAllMapper().reconstructFvSurfaceField
(
IOobject
(
"alpha",
allMesh().time().timeName(),
allMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
procAlpha
);
// Get alpha from harmonic interpolation of vol quantities
// (Note: really only needed at internal faces originating patches
// inbetween regions)
tmp<surfaceScalarField> allHarmonicAlpha
(
harmonic(allMesh()).interpolate(allVolAlpha())
);
// Loop over all fluid and solid regions to transfer
// allHarmonicAlpha to allAlpha
surfaceScalarField& allAlpha = tallAlpha();
forAll(boundaryProcAddressing, procI)
{
forAll(boundaryProcAddressing[procI], patchI)
{
if (boundaryProcAddressing[procI][patchI] == -1)
{
// Interface patch
const labelList::subList cp =
procMeshes[procI].boundary()[patchI].patchSlice
(
faceProcAddressing[procI]
);
forAll(cp, faceI)
{
label curF = mag(cp[faceI])-1;
if (curF < allMesh().nInternalFaces())
{
allAlpha[curF] = allHarmonicAlpha()[curF];
}
}
}
}
}
tmp<surfaceScalarField> allPhi
(
procToAllMapper().reconstructFvSurfaceField
(
IOobject
(
"phi",
allMesh().time().timeName(),
allMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
procPhi
)
);
// So we have nNonOrthCorr
//#include "readSolidMultiRegionPIMPLEControls.H"
//for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix hEqn
(
fvm::ddt(allRho(), allh())
+ fvm::div(allPhi(), allh())
- fvm::laplacian(allAlpha, allh())
==
allSource()
);
hEqn.relax();
hEqn.solve(allMesh().solver(allh().select(finalIter)));
}

View File

@ -39,6 +39,11 @@ Description
#include "solidRegionDiffNo.H"
#include "basicSolidThermo.H"
#include "radiationModel.H"
#include "fvFieldReconstructor.H"
#include "mixedFvPatchFields.H"
#include "fvFieldDecomposer.H"
#include "harmonic.H"
#include "rmap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,12 +54,40 @@ int main(int argc, char *argv[])
regionProperties rp(runTime);
const label nAllRegions =
rp.fluidRegionNames().size()
+ rp.solidRegionNames().size();
PtrList<labelIOList> cellProcAddressing(nAllRegions);
PtrList<labelIOList> faceProcAddressing(nAllRegions);
PtrList<labelIOList> boundaryProcAddressing(nAllRegions);
PtrList<fvMesh> procMeshes(nAllRegions);
// Load meshes, fluid first
labelList fluidToProc(identity(rp.fluidRegionNames().size()));
labelList solidToProc(rp.solidRegionNames().size());
forAll(solidToProc, i)
{
solidToProc[i] = fluidToProc.size()+i;
}
// Get the coupled solution flag
#include "readPIMPLEControls.H"
if (temperatureCoupled)
{
Info<< "Solving single enthalpy for all equations" << nl << endl;
}
#include "createFluidMeshes.H"
#include "createSolidMeshes.H"
#include "createFluidFields.H"
#include "createSolidFields.H"
// Temperature solved on single mesh
#include "createAllMesh.H"
#include "createAllFields.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
@ -81,9 +114,10 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
if (nOuterCorr != 1)
{
forAll(fluidRegions, i)
forAll(fluidToProc, i)
{
#include "setRegionFluidFields.H"
#include "storeOldFluidFields.H"
@ -96,25 +130,136 @@ int main(int argc, char *argv[])
{
bool finalIter = oCorr == nOuterCorr-1;
forAll(fluidRegions, i)
if (finalIter)
{
Info<< "\nSolving for fluid region "
<< fluidRegions[i].name() << endl;
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
#include "solveFluid.H"
forAll(procMeshes, procI)
{
procMeshes[procI].data::add("finalIteration", true);
}
}
forAll(solidRegions, i)
PtrList<surfaceScalarField> procPhi(nAllRegions);
PtrList<surfaceScalarField> procAlpha(nAllRegions);
// Solve (uncoupled) or set up (coupled) the temperature equation
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
forAll(solidToProc, i)
{
Info<< "\nSolving for solid region "
<< solidRegions[i].name() << endl;
label procI = solidToProc[i];
Info<< "\nSolving temperature for solid region "
<< procMeshes[procI].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
if (temperatureCoupled)
{
// Map my properties to overall h equation
#include "rmapSolid.H"
}
else
{
#include "solveSolid.H"
}
}
forAll(fluidToProc, i)
{
label procI = fluidToProc[i];
Info<< "\nSolving temperature for fluid region "
<< procMeshes[procI].name() << endl;
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
if (oCorr == 0)
{
#include "rhoEqn.H"
}
if (temperatureCoupled)
{
// Map my properties to overall h equation
#include "rmapFluid.H"
}
else
{
#include "hEqn.H"
}
}
// Solve combined h equation
// ~~~~~~~~~~~~~~~~~~~~~~~~~
if (temperatureCoupled)
{
Info<< "\nSolving single enthalpy for all regions"
<< endl;
// Solve combined h
#include "allhEqn.H"
forAll(solidToProc, i)
{
label procI = solidToProc[i];
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
#include "mapSolid.H"
}
forAll(fluidToProc, i)
{
label procI = fluidToProc[i];
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
#include "mapFluid.H"
}
}
// Update thermos
// ~~~~~~~~~~~~~~
forAll(fluidToProc, i)
{
Info<< "\nUpdating thermo for fluid region "
<< procMeshes[fluidToProc[i]].name() << endl;
#include "setRegionFluidFields.H"
#include "readFluidMultiRegionPIMPLEControls.H"
thermo.correct();
rad.correct();
#include "solvePressureVelocityFluid.H"
}
forAll(solidToProc, i)
{
Info<< "\nUpdating thermo for solid region "
<< procMeshes[solidToProc[i]].name() << endl;
#include "setRegionSolidFields.H"
#include "readSolidMultiRegionPIMPLEControls.H"
thermo.correct();
}
if (finalIter)
{
forAll(procMeshes, procI)
{
procMeshes[procI].data::remove("finalIteration");
}
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -0,0 +1,64 @@
autoPtr<volScalarField> allRho;
autoPtr<volScalarField> allh;
autoPtr<volScalarField> allVolAlpha;
autoPtr<fvScalarMatrix> allSource;
if (temperatureCoupled)
{
allRho.reset
(
new volScalarField
(
IOobject
(
"rho",
runTime.timeName(),
allMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
allMesh(),
dimensionedScalar("rho", dimDensity, 0.0)
)
);
allh.reset
(
new volScalarField
(
IOobject
(
"h",
runTime.timeName(),
allMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
allMesh(),
dimensionedScalar("h", dimEnergy/dimMass, 0.0),
mixedFvPatchScalarField::typeName
)
);
allVolAlpha.reset
(
new volScalarField
(
IOobject
(
"volAlpha",
runTime.timeName(),
allMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
allMesh(),
dimensionedScalar("volAlpha", dimMass/dimLength/dimTime, 0.0)
)
);
allSource.reset
(
new fvMatrix<scalar>(allh(), allh().dimensions()*dimMass/dimTime)
);
}

View File

@ -0,0 +1,63 @@
//
// createAllMesh.H
// ~~~~~~~~~~~~~~~
autoPtr<fvMesh> allMesh;
autoPtr<fvFieldReconstructor> procToAllMapper;
PtrList<fvFieldDecomposer> allToProcMappers;
if (temperatureCoupled)
{
Foam::Info
<< "Create mesh for time = "
<< runTime.timeName() << Foam::nl << Foam::endl;
allMesh.reset
(
new Foam::fvMesh
(
Foam::IOobject
(
Foam::fvMesh::defaultRegion,
runTime.timeName(),
runTime,
Foam::IOobject::MUST_READ
)
)
);
procToAllMapper.reset
(
new fvFieldReconstructor
(
allMesh(),
procMeshes,
faceProcAddressing,
cellProcAddressing,
boundaryProcAddressing
)
);
allToProcMappers.setSize
(
rp.fluidRegionNames().size()
+ rp.solidRegionNames().size()
);
forAll(allToProcMappers, i)
{
allToProcMappers.set
(
i,
new fvFieldDecomposer
(
allMesh(),
procMeshes[i],
faceProcAddressing[i],
cellProcAddressing[i],
boundaryProcAddressing[i]
)
);
}
}

View File

@ -1,12 +1,12 @@
scalar CoNum = -GREAT;
forAll(fluidRegions, regionI)
forAll(fluidToProc, regionI)
{
CoNum = max
(
compressibleCourantNo
(
fluidRegions[regionI],
procMeshes[fluidToProc[regionI]],
runTime,
rhoFluid[regionI],
phiFluid[regionI]

View File

@ -1,30 +1,36 @@
// Initialise fluid field pointer lists
PtrList<basicRhoThermo> thermoFluid(fluidRegions.size());
PtrList<volScalarField> rhoFluid(fluidRegions.size());
PtrList<volScalarField> KFluid(fluidRegions.size());
PtrList<volVectorField> UFluid(fluidRegions.size());
PtrList<surfaceScalarField> phiFluid(fluidRegions.size());
PtrList<uniformDimensionedVectorField> gFluid(fluidRegions.size());
PtrList<compressible::turbulenceModel> turbulence(fluidRegions.size());
PtrList<volScalarField> p_rghFluid(fluidRegions.size());
PtrList<volScalarField> ghFluid(fluidRegions.size());
PtrList<surfaceScalarField> ghfFluid(fluidRegions.size());
PtrList<radiation::radiationModel> radiation(fluidRegions.size());
PtrList<volScalarField> DpDtFluid(fluidRegions.size());
PtrList<basicRhoThermo> thermoFluid(rp.fluidRegionNames().size());
PtrList<volScalarField> rhoFluid(rp.fluidRegionNames().size());
PtrList<volScalarField> KFluid(rp.fluidRegionNames().size());
PtrList<volVectorField> UFluid(rp.fluidRegionNames().size());
PtrList<surfaceScalarField> phiFluid(rp.fluidRegionNames().size());
PtrList<uniformDimensionedVectorField> gFluid(rp.fluidRegionNames().size());
PtrList<compressible::turbulenceModel> turbulence
(
rp.fluidRegionNames().size()
);
PtrList<volScalarField> p_rghFluid(rp.fluidRegionNames().size());
PtrList<volScalarField> ghFluid(rp.fluidRegionNames().size());
PtrList<surfaceScalarField> ghfFluid(rp.fluidRegionNames().size());
PtrList<radiation::radiationModel> radiation(rp.fluidRegionNames().size());
PtrList<volScalarField> DpDtFluid(rp.fluidRegionNames().size());
List<scalar> initialMassFluid(fluidRegions.size());
List<scalar> initialMassFluid(rp.fluidRegionNames().size());
// Populate fluid field pointer lists
forAll(fluidRegions, i)
forAll(rp.fluidRegionNames(), i)
{
Info<< "*** Reading fluid mesh thermophysical properties for region "
<< fluidRegions[i].name() << nl << endl;
<< rp.fluidRegionNames()[i] << nl << endl;
label procI = fluidToProc[i];
Info<< " Adding to thermoFluid\n" << endl;
thermoFluid.set
(
i,
basicRhoThermo::New(fluidRegions[i]).ptr()
basicRhoThermo::New(procMeshes[procI]).ptr()
);
Info<< " Adding to rhoFluid\n" << endl;
@ -37,7 +43,7 @@
(
"rho",
runTime.timeName(),
fluidRegions[i],
procMeshes[procI],
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
@ -55,7 +61,7 @@
(
"K",
runTime.timeName(),
fluidRegions[i],
procMeshes[procI],
IOobject::NO_READ,
IOobject::NO_WRITE
),
@ -73,11 +79,11 @@
(
"U",
runTime.timeName(),
fluidRegions[i],
procMeshes[procI],
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
fluidRegions[i]
procMeshes[procI]
)
);
@ -91,12 +97,12 @@
(
"phi",
runTime.timeName(),
fluidRegions[i],
procMeshes[procI],
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
linearInterpolate(rhoFluid[i]*UFluid[i])
& fluidRegions[i].Sf()
& procMeshes[procI].Sf()
)
);
@ -110,7 +116,7 @@
(
"g",
runTime.constant(),
fluidRegions[i],
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
@ -137,14 +143,14 @@
ghFluid.set
(
i,
new volScalarField("gh", gFluid[i] & fluidRegions[i].C())
new volScalarField("gh", gFluid[i] & procMeshes[procI].C())
);
Info<< " Adding to ghfFluid\n" << endl;
ghfFluid.set
(
i,
new surfaceScalarField("ghf", gFluid[i] & fluidRegions[i].Cf())
new surfaceScalarField("ghf", gFluid[i] & procMeshes[procI].Cf())
);
p_rghFluid.set
@ -156,11 +162,11 @@
(
"p_rgh",
runTime.timeName(),
fluidRegions[i],
procMeshes[procI],
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
fluidRegions[i]
procMeshes[procI]
)
);

View File

@ -1,13 +1,13 @@
PtrList<fvMesh> fluidRegions(rp.fluidRegionNames().size());
forAll(rp.fluidRegionNames(), i)
{
Info<< "Create fluid mesh for region " << rp.fluidRegionNames()[i]
<< " for time = " << runTime.timeName() << nl << endl;
fluidRegions.set
label procI = fluidToProc[i];
procMeshes.set
(
i,
procI,
new fvMesh
(
IOobject
@ -19,4 +19,58 @@
)
)
);
if (temperatureCoupled)
{
cellProcAddressing.set
(
procI,
new labelIOList
(
IOobject
(
"cellRegionAddressing",
procMeshes[procI].facesInstance(),
procMeshes[procI].meshSubDir,
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
faceProcAddressing.set
(
procI,
new labelIOList
(
IOobject
(
"faceRegionAddressing",
procMeshes[procI].facesInstance(),
procMeshes[procI].meshSubDir,
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
boundaryProcAddressing.set
(
procI,
new labelIOList
(
IOobject
(
"boundaryRegionAddressing",
procMeshes[procI].facesInstance(),
procMeshes[procI].meshSubDir,
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
}
}

View File

@ -1 +1 @@
List<scalar> cumulativeContErr(fluidRegions.size(), 0.0);
List<scalar> cumulativeContErr(fluidToProc.size(), 0.0);

View File

@ -0,0 +1,3 @@
h = allToProcMappers[procI].decomposeField(allh(), true);
h.oldTime().timeIndex() = allh().oldTime().timeIndex();
h.correctBoundaryConditions();

View File

@ -0,0 +1,56 @@
// Note:Map rho and rho.oldTime() since fluid rho assigned to at
// end of iteration.
rmap
(
allRho(),
rho,
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
rmap
(
allRho().oldTime(),
rho.oldTime(),
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
// Necessary? Probably only for boundary values since bcs on
// h are not the same as those on allh
rmap
(
allh(),
h,
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
procAlpha.set(procI, fvc::interpolate(turb.alphaEff()));
rmap
(
allVolAlpha(),
turb.alphaEff()(),
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
rmap
(
allSource(),
(DpDt + rad.Sh(thermo))(),
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
procPhi.set
(
procI,
new surfaceScalarField(phi)
);

View File

@ -1,4 +1,4 @@
fvMesh& mesh = fluidRegions[i];
fvMesh& mesh = procMeshes[fluidToProc[i]];
basicRhoThermo& thermo = thermoFluid[i];
volScalarField& rho = rhoFluid[i];

View File

@ -0,0 +1,11 @@
#include "UEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pEqn.H"
}
turb.correct();
rho = thermo.rho();

View File

@ -6,3 +6,6 @@
const int nOuterCorr =
pimple.lookupOrDefault<int>("nOuterCorrectors", 1);
const Switch temperatureCoupled =
pimple.lookupOrDefault<Switch>("temperatureCoupled", false);

View File

@ -0,0 +1,96 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Global
rmap
Description
map field on subset of mesh onto overall field. Rewrites boundary
conditions to be mixed.
The source fields can have different patch types for the same destination
patch. To work around this it attempts to convert all patch fields into
mixed type since this can accomodate anything from fixedValue to
fixedGradient.
SourceFiles
rmap.C
\*---------------------------------------------------------------------------*/
#ifndef rmap_H
#define rmap_H
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Map patchField
template<class Type>
static void rmap
(
fvPatchField<Type>& destBC,
const labelList& reverseAddressing,
const fvPatchField<Type>& sourceBC
);
//- Map volField
template<class Type>
static void rmap
(
GeometricField<Type, fvPatchField, volMesh>& dest,
const GeometricField<Type, fvPatchField, volMesh>& source,
const labelList& faceProcAddressing,
const labelList& cellProcAddressing,
const labelList& boundaryProcAddressing
);
//- Map fvMatrix
template<class Type>
static void rmap
(
fvMatrix<Type>& dest,
const fvMatrix<Type>& source,
const labelList& faceProcAddressing,
const labelList& cellProcAddressing,
const labelList& boundaryProcAddressing
);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "rmapTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,309 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "rmap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
void Foam::rmap
(
fvPatchField<Type>& destBC,
const labelList& reverseAddressing,
const fvPatchField<Type>& sourceBC
)
{
// Assign value
destBC.Field<Type>::rmap(sourceBC, reverseAddressing);
// Assign other properties
if (isA<mixedFvPatchField<Type> >(destBC))
{
mixedFvPatchField<Type>& mp =
refCast<mixedFvPatchField<Type> >(destBC);
if (isA<mixedFvPatchField<Type> >(sourceBC))
{
const mixedFvPatchField<Type>& Tp =
refCast<const mixedFvPatchField<Type> >(sourceBC);
mp.refValue().rmap(Tp.refValue(), reverseAddressing);
mp.refGrad().rmap(Tp.refGrad(), reverseAddressing);
mp.valueFraction().rmap(Tp.valueFraction(), reverseAddressing);
}
else if (isA<fixedGradientFvPatchField<Type> >(sourceBC))
{
const fixedGradientFvPatchField<Type>& Tp =
refCast<const fixedGradientFvPatchField<Type> >
(
sourceBC
);
// Make pure fixedGradient
mp.refValue().rmap(Tp, reverseAddressing); // unused
mp.refGrad().rmap(Tp.gradient(), reverseAddressing);
mp.valueFraction().rmap
(
Field<Type>(reverseAddressing.size(), 0.0),
reverseAddressing
);
}
else if (isA<zeroGradientFvPatchField<Type> >(sourceBC))
{
// Make pure fixedGradient with gradient = 0
mp.refValue().rmap(sourceBC, reverseAddressing); // unused
mp.refGrad().rmap
(
Field<Type>(reverseAddressing.size(), 0.0),
reverseAddressing
);
mp.valueFraction().rmap
(
Field<Type>(reverseAddressing.size(), 0.0),
reverseAddressing
);
}
else if (isA<fixedValueFvPatchField<Type> >(sourceBC))
{
// Make pure fixedValue
mp.refValue().rmap(sourceBC, reverseAddressing);
mp.refGrad().rmap
(
Field<Type>(reverseAddressing.size(), 0.0),
reverseAddressing
); // unused
mp.valueFraction().rmap
(
Field<Type>(reverseAddressing.size(), 1.0),
reverseAddressing
);
}
else if (isA<calculatedFvPatchField<Type> >(sourceBC))
{
// Make pure fixedValue
mp.refValue().rmap(sourceBC, reverseAddressing);
mp.refGrad().rmap
(
Field<Type>(reverseAddressing.size(), 0.0),
reverseAddressing
); // unused
mp.valueFraction().rmap
(
Field<Type>(reverseAddressing.size(), 1.0),
reverseAddressing
);
}
else
{
FatalErrorIn("rmap(..)")
<< "Don't know how to map source bc "
<< sourceBC.type()
<< " into a mixed boundary condition at "
<< destBC.patch().name()
<< exit(FatalError);
}
}
else if (isA<fixedGradientFvPatchField<Type> >(destBC))
{
fixedGradientFvPatchField<Type>& mp =
refCast<fixedGradientFvPatchField<Type> >(destBC);
if (isA<fixedGradientFvPatchField<Type> >(sourceBC))
{
const fixedGradientFvPatchField<Type>& Tp =
refCast<const fixedGradientFvPatchField<Type> >
(
sourceBC
);
mp.gradient().rmap(Tp.gradient(), reverseAddressing);
}
else if (isA<mixedFvPatchField<Type> >(sourceBC))
{
const mixedFvPatchField<Type>& Tp =
refCast<const mixedFvPatchField<Type> >(sourceBC);
mp.gradient().rmap(Tp.snGrad(), reverseAddressing);
}
else if (isA<zeroGradientFvPatchField<Type> >(sourceBC))
{
mp.gradient().rmap
(
Field<Type>(reverseAddressing.size(), 0.0),
reverseAddressing
);
}
else
{
FatalErrorIn("rmap(..)")
<< "Don't know how to map source bc "
<< sourceBC.type()
<< " into a fixedGradient boundary condition at "
<< destBC.patch().name()
<< exit(FatalError);
}
}
}
template<class Type>
void Foam::rmap
(
GeometricField<Type, fvPatchField, volMesh>& dest,
const GeometricField<Type, fvPatchField, volMesh>& source,
const labelList& faceProcAddressing,
const labelList& cellProcAddressing,
const labelList& boundaryProcAddressing
)
{
if (dest.dimensions() != source.dimensions())
{
FatalErrorIn("rmap(..)")
<< "Different dimensions for = for fields " << dest.name()
<< " and " << source.name() << endl
<< " dimensions : " << dest.dimensions()
<< " = " << source.dimensions() << endl
<< exit(FatalError);
}
// Copy internal field
dest.internalField().rmap(source.internalField(), cellProcAddressing);
// Copy boundary properties as mixed
forAll(source.boundaryField(), patchI)
{
label curBPatch = boundaryProcAddressing[patchI];
if (curBPatch == -1)
{
// Unknown patch. Do not change any values.
}
else
{
// Get addressing slice for this patch
const labelList::subList cp =
source.mesh().boundary()[patchI].patchSlice
(
faceProcAddressing
);
const label curPatchStart =
dest.mesh().boundaryMesh()[curBPatch].start();
labelList reverseAddressing(cp.size());
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
if (cp[faceI] <= 0)
{
FatalErrorIn("rmap(..)")
<< "Problem:"
<< " patch:" << source.mesh().boundary()[patchI].name()
<< " field:" << source.name()
<< " local face:" << faceI
<< " mapped to:" << cp[faceI] << exit(FatalError);
}
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
// Map curBPatch from source patch. Is like rmap but also
// copies non-value properties from alike patchFields.
rmap
(
dest.boundaryField()[curBPatch],
reverseAddressing,
source.boundaryField()[patchI]
);
}
}
// Copy timeIndex
dest.timeIndex() = source.timeIndex();
}
template<class Type>
void Foam::rmap
(
fvMatrix<Type>& dest,
const fvMatrix<Type>& source,
const labelList& faceProcAddressing,
const labelList& cellProcAddressing,
const labelList& boundaryProcAddressing
)
{
dest.source().rmap(source.source(), cellProcAddressing);
FieldField<Field, Type>& sourceInternal =
const_cast<fvMatrix<Type>&>(source).internalCoeffs();
FieldField<Field, Type>& sourceBoundary =
const_cast<fvMatrix<Type>&>(source).boundaryCoeffs();
forAll(sourceInternal, patchI)
{
label curBPatch = boundaryProcAddressing[patchI];
if (curBPatch == -1)
{
// Unknown patch. Do not change any values.
}
else
{
// Get addressing slice for this patch
const fvMesh& sourceMesh = source.psi().mesh();
const labelList::subList cp =
sourceMesh.boundary()[patchI].patchSlice
(
faceProcAddressing
);
const label curPatchStart =
dest.psi().mesh().boundaryMesh()[curBPatch].start();
labelList reverseAddressing(cp.size());
forAll(cp, faceI)
{
// Subtract one to take into account offsets for
// face direction.
reverseAddressing[faceI] = cp[faceI] - 1 - curPatchStart;
}
dest.internalCoeffs()[curBPatch].rmap
(
sourceInternal[patchI],
reverseAddressing
);
dest.boundaryCoeffs()[curBPatch].rmap
(
sourceBoundary[patchI],
reverseAddressing
);
}
}
}
// ************************************************************************* //

View File

@ -1,12 +1,36 @@
// Initialise solid field pointer lists
PtrList<basicSolidThermo> thermos(solidRegions.size());
PtrList<basicSolidThermo> thermoSolid(rp.solidRegionNames().size());
PtrList<volScalarField> hSolid(rp.solidRegionNames().size());
// Populate solid field pointer lists
forAll(solidRegions, i)
forAll(rp.solidRegionNames(), i)
{
Info<< "*** Reading solid mesh thermophysical properties for region "
<< solidRegions[i].name() << nl << endl;
<< rp.solidRegionNames()[i] << nl << endl;
Info<< " Adding to thermos\n" << endl;
thermos.set(i, basicSolidThermo::New(solidRegions[i]));
label procI = solidToProc[i];
Info<< " Adding to thermoSolid\n" << endl;
thermoSolid.set(i, basicSolidThermo::New(procMeshes[procI]));
if (temperatureCoupled)
{
Info<< " Adding to hSolid\n" << endl;
hSolid.set
(
i,
new volScalarField
(
IOobject
(
"h",
runTime.timeName(),
procMeshes[procI],
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
procMeshes[procI]
)
);
}
}

View File

@ -1,13 +1,13 @@
PtrList<fvMesh> solidRegions(rp.solidRegionNames().size());
forAll(rp.solidRegionNames(), i)
{
Info<< "Create solid mesh for region " << rp.solidRegionNames()[i]
<< " for time = " << runTime.timeName() << nl << endl;
solidRegions.set
label procI = solidToProc[i];
procMeshes.set
(
i,
procI,
new fvMesh
(
IOobject
@ -20,8 +20,57 @@
)
);
// Force calculation of geometric properties to prevent it being done
// later in e.g. some boundary evaluation
//(void)solidRegions[i].weights();
//(void)solidRegions[i].deltaCoeffs();
if (temperatureCoupled)
{
cellProcAddressing.set
(
procI,
new labelIOList
(
IOobject
(
"cellRegionAddressing",
procMeshes[procI].facesInstance(),
procMeshes[procI].meshSubDir,
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
faceProcAddressing.set
(
procI,
new labelIOList
(
IOobject
(
"faceRegionAddressing",
procMeshes[procI].facesInstance(),
procMeshes[procI].meshSubDir,
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
boundaryProcAddressing.set
(
procI,
new labelIOList
(
IOobject
(
"boundaryRegionAddressing",
procMeshes[procI].facesInstance(),
procMeshes[procI].meshSubDir,
procMeshes[procI],
IOobject::MUST_READ,
IOobject::NO_WRITE
)
)
);
}
}

View File

@ -0,0 +1,15 @@
{
volScalarField& h = hSolid[i];
h = allToProcMappers[procI].decomposeField(allh(), true);
h.oldTime().timeIndex() = allh().oldTime().timeIndex();
T += (h-h.oldTime())/cp;
// Correct T boundary conditions and update h boundary
// conditions accordingly.
volScalarField::GeometricBoundaryField Told = T.boundaryField();
T.correctBoundaryConditions();
h.boundaryField() +=
cp.boundaryField()
* (T.boundaryField()-Told);
}

View File

@ -0,0 +1,90 @@
{
volScalarField& h = hSolid[i];
procPhi.setSize(nAllRegions);
procAlpha.setSize(nAllRegions);
rmap
(
allRho(),
rho,
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
// Necessary? Probably only for boundary values since bcs on
// h are not the same as those on allh
rmap
(
allh(),
h,
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
tmp<volScalarField> Kcp(K/cp);
rmap
(
allVolAlpha(),
Kcp(),
faceProcAddressing[procI],
cellProcAddressing[procI],
boundaryProcAddressing[procI]
);
procAlpha.set(procI, fvc::interpolate(Kcp));
// allSource is initialised to zero already
//rmap
//(
// allSource(),
// volScalarField
// (
// IOobject
// (
// "procSource",
// runTime.timeName(),
// mesh,
// IOobject::NO_READ,
// IOobject::AUTO_WRITE
// ),
// mesh,
// dimensionedScalar
// (
// "procSource",
// allh().dimensions()*dimDensity/dimTime,
// 0.0
// )
// ),
// faceProcAddressing[procI],
// cellProcAddressing[procI],
// boundaryProcAddressing[procI]
//);
procPhi.set
(
procI,
new surfaceScalarField
(
IOobject
(
"phi",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"phi",
dimDensity*dimVelocity*dimArea,
0.0
)
)
);
}

View File

@ -1,5 +1,5 @@
fvMesh& mesh = solidRegions[i];
basicSolidThermo& thermo = thermos[i];
fvMesh& mesh = procMeshes[solidToProc[i]];
basicSolidThermo& thermo = thermoSolid[i];
tmp<volScalarField> trho = thermo.rho();
const volScalarField& rho = trho();

View File

@ -1,6 +1,6 @@
scalar DiNum = -GREAT;
forAll(solidRegions, i)
forAll(solidToProc, i)
{
# include "setRegionSolidFields.H"
@ -8,7 +8,7 @@
(
solidRegionDiffNo
(
solidRegions[i],
procMeshes[solidToProc[i]],
runTime,
rho*cp,
K

View File

@ -1,8 +1,3 @@
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
{
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
@ -17,10 +12,3 @@ if (finalIter)
Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl;
}
thermo.correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}

View File

@ -7,6 +7,11 @@ if (pimple.nCorr() <= 1)
phi = (fvc::interpolate(U) & mesh.Sf());
if (ddtPhiCorr)
{
phi += fvc::ddtPhiCorr(rAU, U, phi);
}
if (p.needReference())
{
fvc::makeRelative(phi, U);

View File

@ -8,3 +8,5 @@
const bool checkMeshCourantNo =
pimpleDict.lookupOrDefault("checkMeshCourantNo", false);
const bool ddtPhiCorr =
pimpleDict.lookupOrDefault("ddtPhiCorr", true);

View File

@ -58,6 +58,9 @@ int main(int argc, char *argv[])
#include "CourantNo.H"
#include "setInitialDeltaT.H"
surfaceScalarField phiAbs("phiAbs", phi);
fvc::makeAbsolute(phiAbs, U);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
@ -67,9 +70,6 @@ int main(int argc, char *argv[])
#include "alphaCourantNo.H"
#include "CourantNo.H"
// Make the fluxes absolute
fvc::makeAbsolute(phi, U);
#include "setDeltaT.H"
runTime++;
@ -78,8 +78,18 @@ int main(int argc, char *argv[])
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
{
// Calculate the relative velocity used to map the relative flux phi
volVectorField Urel("Urel", U);
if (mesh.moving())
{
Urel -= fvc::reconstruct(fvc::meshPhi(U));
}
// Do any mesh changes
mesh.update();
}
if (mesh.changing())
{
@ -96,9 +106,6 @@ int main(int argc, char *argv[])
#include "correctPhi.H"
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
if (mesh.changing() && checkMeshCourantNo)
{
#include "meshCourantNo.H"

View File

@ -3,16 +3,19 @@
surfaceScalarField rAUf(fvc::interpolate(rAU));
U = rAU*UEqn.H();
surfaceScalarField phiU("phiU", (fvc::interpolate(U) & mesh.Sf()));
phiAbs =
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phiAbs);
if (p_rgh.needReference())
{
fvc::makeRelative(phiU, U);
adjustPhi(phiU, U, p_rgh);
fvc::makeAbsolute(phiU, U);
fvc::makeRelative(phiAbs, U);
adjustPhi(phiAbs, U, p_rgh);
fvc::makeAbsolute(phiAbs, U);
}
phi = phiU +
phi = phiAbs +
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
@ -38,11 +41,13 @@
}
}
U += rAU*fvc::reconstruct((phi - phiU)/rAUf);
U += rAU*fvc::reconstruct((phi - phiAbs)/rAUf);
U.correctBoundaryConditions();
#include "continuityErrs.H"
phiAbs = phi;
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -1,3 +1,4 @@
multiphaseEulerFoam.C
multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C
EXE = $(FOAM_APPBIN)/multiphaseEulerFoam

View File

@ -1,6 +1,7 @@
EXE_INC = \
-IphaseModel/lnInclude \
-ImultiphaseSystem/lnInclude \
-ImultiphaseFixedFluxPressure \
/*-IkineticTheoryModels/lnInclude*/ \
-IinterfacialModels/lnInclude \
-I$(LIB_SRC)/transportModels \

View File

@ -1,2 +1,8 @@
MRFZones mrfZones(mesh);
forAllIter(PtrDictionary<phaseModel>, fluid.phases(), iter)
{
mrfZones.correctBoundaryVelocity(iter().U());
}
mrfZones.correctBoundaryVelocity(U);

View File

@ -53,12 +53,12 @@
phase.U() = rAUs[phasei]*UEqns[phasei].H();
mrfZones.absoluteFlux(phase.phi());
phase.phi() =
(
(fvc::interpolate(phase.U()) & mesh.Sf())
+ fvc::ddtPhiCorr(rAUs[phasei], alpha, phase.U(), phase.phi())
);
mrfZones.relativeFlux(phase.phi());
phase.phi() += rAlphaAUfs[phasei]*(g & mesh.Sf());
@ -241,7 +241,6 @@
}
}
phase.U() = fvc::reconstruct(phase.phi());
phase.U().correctBoundaryConditions();
U += alpha*phase.U();

View File

@ -924,6 +924,7 @@ int main(int argc, char *argv[])
#include "addRegionOption.H"
#include "addOverwriteOption.H"
argList::addOption("dict", "name", "specify alternative dictionary");
argList::addBoolOption("AMI", "apply mapped AMI boundary type");
#include "setRootCase.H"
@ -932,18 +933,14 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.optionFound("overwrite");
mappedPatchBase::sampleMode sampleMode = mappedPatchBase::NEARESTPATCHFACE;
if (args.optionFound("AMI"))
{
sampleMode = mappedPatchBase::NEARESTPATCHFACEAMI;
}
const word dictName
(args.optionLookupOrDefault<word>("dict", "extrudeToRegionMeshDict"));
IOdictionary dict
(
IOobject
(
"extrudeToRegionMeshDict",
dictName,
runTime.system(),
runTime,
IOobject::MUST_READ_IF_MODIFIED
@ -963,6 +960,9 @@ int main(int argc, char *argv[])
dict.lookup("faceZonesShadow") >> zoneShadowNames;
}
mappedPatchBase::sampleMode sampleMode =
mappedPatchBase::sampleModeNames_[dict.lookup("sampleMode")];
const Switch oneD(dict.lookup("oneD"));
const Switch adaptMesh(dict.lookup("adaptMesh"));

View File

@ -32,6 +32,9 @@ faceZones (f0);
// mapped patch which might need to be adapted.
adaptMesh true;
// Sample mode for inter-region communication
sampleMode nearestPatchFace;
// Extrude 1D-columns of cells?
oneD false;
@ -45,16 +48,16 @@ oneD false;
extrudeModel linearNormal;
//- Linear extrusion in specified direction
//extrudeModel linearDirection;
// extrudeModel linearDirection;
//- Wedge extrusion. If nLayers is 1 assumes symmetry around plane.
// extrudeModel wedge;
//- Extrudes into sphere around (0 0 0)
//extrudeModel linearRadial;
// extrudeModel linearRadial;
//- Extrudes into sphere with grading according to pressure (atmospherics)
//extrudeModel sigmaRadial;
// extrudeModel sigmaRadial;
nLayers 10;

View File

@ -70,7 +70,7 @@ castellatedMeshControls
// If local number of cells is >= maxLocalCells on any processor
// switches from from refinement followed by balancing
// (current method) to (weighted) balancing before refinement.
maxLocalCells 1000000;
maxLocalCells 100000;
// Overall cell limit (approximately). Refinement will stop immediately
// upon reaching this number so a refinement level might not complete.
@ -311,6 +311,11 @@ addLayersControls
// get used. Up to nRelaxIter it uses the settings in meshQualityControls,
// after nRelaxIter it uses the values in meshQualityControls::relaxed.
nRelaxedIter 20;
// Additional reporting: if there are just a few faces where there
// are mesh errors (after adding the layers) print their face centres.
// This helps in tracking down problematic mesh areas.
//additionalReporting true;
}
// Generic mesh quality settings. At any undoable phase these determine

View File

@ -55,8 +55,10 @@ Description
this if you don't mind having disconnected domains in a single region.
This option requires all cells to be in one (and one only) cellZone.
- Should work in parallel.
cellZones can differ on either side of processor boundaries in which case
the faces get moved from processor patch to directMapped patch. Not
the faces get moved from processor patch to mapped patch. Not
very well tested.
@ -79,6 +81,8 @@ Description
- faceRegionAddressing : ,, face ,, face in
the original mesh + 'turning index'. For a face in the same orientation
this is the original facelabel+1, for a turned face this is -facelabel-1
- boundaryRegionAddressing : for every patch in this region the
patch in the original mesh (or -1 if added patch)
\*---------------------------------------------------------------------------*/
#include "SortableList.H"
@ -1231,6 +1235,36 @@ void createAndWriteRegion
<< " from region" << regionI
<< " cells back to base mesh." << endl;
cellProcAddressing.write();
labelIOList boundaryProcAddressing
(
IOobject
(
"boundaryRegionAddressing",
newMesh().facesInstance(),
newMesh().meshSubDir,
newMesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
labelList(nNewPatches, -1)
);
forAll(oldToNew, i)
{
if (!addedPatches.found(i))
{
label newI = oldToNew[i];
if (newI >= 0 && newI < nNewPatches)
{
boundaryProcAddressing[oldToNew[i]] = i;
}
}
}
Info<< "Writing map " << boundaryProcAddressing.name()
<< " from region" << regionI
<< " boundary back to base mesh." << endl;
boundaryProcAddressing.write();
}

View File

@ -33,24 +33,28 @@ FoamFile
//
// // Select by explicitly providing cell labels
// source labelToCell;
// sourceInfo
// {
// value (12 13 56); // labels of cells
// }
//
// // Copy elements from cellSet
// source cellToCell;
// sourceInfo
// {
// set c1;
// }
//
// // Cells in cell zone
// source zoneToCell;
// sourceInfo
// {
// name ".*Zone"; // Name of cellZone, regular expressions allowed
// }
//
// // Cells on master or slave side of faceZone
// source faceZoneToCell;
// sourceInfo
// {
// name ".*Zone"; // Name of faceZone, regular expressions allowed
// option master; // master/slave
@ -58,6 +62,7 @@ FoamFile
//
// // Select based on faceSet
// source faceToCell;
// sourceInfo
// {
// set f0; // Name of faceSet
//
@ -69,6 +74,7 @@ FoamFile
//
// // Select based on pointSet
// source pointToCell;
// sourceInfo
// {
// set p0;
// option any; // cell with any point in pointSet
@ -77,12 +83,14 @@ FoamFile
//
// // Select based on cellShape
// source shapeToCell;
// sourceInfo
// {
// type hex; // hex/wedge/prism/pyr/tet/tetWedge/splitHex
// }
//
// // Cells with cell centre within box
// source boxToCell;
// sourceInfo
// {
// box (0 0 0) (1 1 1);
// }
@ -90,6 +98,7 @@ FoamFile
// // Cells with cell centre within box
// // Is skewed, rotated box. Given as origin and three spanning vectors.
// source rotatedBoxToCell;
// sourceInfo
// {
// origin (0.2 0.2 -10);
// i (0.2 0.2 0);
@ -99,6 +108,7 @@ FoamFile
//
// // Cells with centre within cylinder
// source cylinderToCell;
// sourceInfo
// {
// p1 (0.2 0.2 -10); // start point on cylinder axis
// p2 (0.2 0.2 0); // end point on cylinder axis
@ -107,6 +117,7 @@ FoamFile
//
// // Cells with centre within sphere
// source sphereToCell;
// sourceInfo
// {
// centre (0.2 0.2 -10);
// radius 5.0;
@ -114,12 +125,14 @@ FoamFile
//
// // Cells with cellCentre nearest to coordinates
// source nearestToCell;
// sourceInfo
// {
// points ((0 0 0) (1 1 1)(2 2 2));
// }
//
// // Select based on surface
// source surfaceToCell;
// sourceInfo
// {
// file "www.avl.com-geometry.stl";
// outsidePoints ((-99 -99 -59)); // definition of outside
@ -135,6 +148,7 @@ FoamFile
//
// // values of field within certain range
// source fieldToCell;
// sourceInfo
// {
// fieldName U; // Note: uses mag(U) since volVectorField
// min 0.1;
@ -143,6 +157,7 @@ FoamFile
//
// // Mesh region (non-face connected part of (subset of)mesh)
// source regionToCell;
// sourceInfo
// {
// set c0; // name of cellSet giving mesh subset
// insidePoint (1 2 3); // point inside region to select
@ -155,12 +170,14 @@ FoamFile
//
// // Copy elements from faceSet
// source faceToFace;
// sourceInfo
// {
// set f1;
// }
//
// // Select based on cellSet
// source cellToFace;
// sourceInfo
// {
// set c0;
// option all; // All faces of cells
@ -169,6 +186,7 @@ FoamFile
//
// // Select based on pointSet
// source pointToFace;
// sourceInfo
// {
// set p0;
// option any; // Faces using any point in pointSet
@ -177,30 +195,35 @@ FoamFile
//
// // Select by explicitly providing face labels
// source labelToFace;
// sourceInfo
// {
// value (12 13 56); // labels of faces
// }
//
// // All faces of patch
// source patchToFace;
// sourceInfo
// {
// name ".*Wall"; // Name of patch, regular expressions allowed
// }
//
// // All faces of faceZone
// source zoneToFace;
// sourceInfo
// {
// name ".*Zone1"; // Name of faceZone, regular expressions allowed
// }
//
// // Faces with face centre within box
// source boxToFace;
// sourceInfo
// {
// box (0 0 0) (1 1 1);
// }
//
// // Faces with normal to within certain angle aligned with vector.
// source normalToFace;
// sourceInfo
// {
// normal (0 0 1); // Vector
// cos 0.01; // Tolerance (max cos of angle)
@ -213,12 +236,14 @@ FoamFile
//
// // Copy elements from pointSet
// source pointToPoint;
// sourceInfo
// {
// set p1;
// }
//
// // Select based on cellSet
// source cellToPoint;
// sourceInfo
// {
// set c0;
// option all; // all points of cell
@ -226,6 +251,7 @@ FoamFile
//
// // Select based on faceSet
// source faceToPoint;
// sourceInfo
// {
// set f0; // name of faceSet
// option all; // all points of face
@ -233,30 +259,35 @@ FoamFile
//
// // Select by explicitly providing point labels
// source labelToPoint;
// sourceInfo
// {
// value (12 13 56); // labels of points
// }
//
// // All points in pointzone
// source zoneToPoint;
// sourceInfo
// {
// name ".*Zone"; // name of pointZone, regular expressions allowed
// }
//
// // Points nearest to coordinates
// source nearestToPoint;
// sourceInfo
// {
// points ((0 0 0) (1 1 1));
// }
//
// // Points with coordinate within box
// source boxToPoint;
// sourceInfo
// {
// box (0 0 0) (1 1 1);
// }
//
// // Select based on surface
// source surfaceToPoint;
// sourceInfo
// {
// file "www.avl.com-geometry.stl";
// nearDistance 0.1; // points near to surface
@ -275,6 +306,7 @@ FoamFile
//
// // Select based on cellSet
// source setToCellZone;
// sourceInfo
// {
// set c0; // name of cellSet
// }
@ -285,12 +317,14 @@ FoamFile
// ~~~~~~~~~~~
// // Select based on faceSet without orientation
// source setToFaceZone;
// sourceInfo
// {
// set f0; // name of faceSet
// }
//
// // Select based on faceSet, using cellSet to determine orientation
// source setsToFaceZone;
// sourceInfo
// {
// faceSet f0; // name of faceSet
// cellSet c0; // name of cellSet of slave side

View File

@ -3,7 +3,6 @@ domainDecomposition.C
domainDecompositionMesh.C
domainDecompositionDistribute.C
dimFieldDecomposer.C
fvFieldDecomposer.C
pointFieldDecomposer.C
lagrangianFieldDecomposer.C

View File

@ -1,4 +1,5 @@
EXE_INC = \
-I$(LIB_SRC)/parallel/decompose/decompose/lnInclude \
-I$(LIB_SRC)/parallel/decompose/decompositionMethods/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
@ -6,6 +7,7 @@ EXE_INC = \
EXE_LIBS = \
-lfiniteVolume \
-ldecompose \
-lgenericPatchFields \
-ldecompositionMethods -L$(FOAM_LIBBIN)/dummy -lmetisDecomp -lscotchDecomp \
-llagrangian \

View File

@ -43,6 +43,7 @@ Description
int main(int argc, char *argv[])
{
Foam::timeSelector::addOptions();
# include "addRegionOption.H"
Foam::argList::addBoolOption
(
"noWrite",
@ -74,7 +75,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args);
# include "createMesh.H"
# include "createNamedMesh.H"
utility().tryPreCalc(args, runTime, mesh);

View File

@ -37,6 +37,11 @@ Description
#include "calc.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "pointFields.H"
#include "ReadFields.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
@ -84,6 +89,70 @@ namespace Foam
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
if (args.optionFound("noFlow"))
{
Info<< " Operating in no-flow mode; no models will be loaded."
<< " All vol, surface and point fields will be loaded." << endl;
// Read objects in time directory
IOobjectList objects(mesh, runTime.timeName());
// Read vol fields.
PtrList<volScalarField> vsFlds;
ReadFields(mesh, objects, vsFlds);
PtrList<volVectorField> vvFlds;
ReadFields(mesh, objects, vvFlds);
PtrList<volSphericalTensorField> vstFlds;
ReadFields(mesh, objects, vstFlds);
PtrList<volSymmTensorField> vsymtFlds;
ReadFields(mesh, objects, vsymtFlds);
PtrList<volTensorField> vtFlds;
ReadFields(mesh, objects, vtFlds);
// Read surface fields.
PtrList<surfaceScalarField> ssFlds;
ReadFields(mesh, objects, ssFlds);
PtrList<surfaceVectorField> svFlds;
ReadFields(mesh, objects, svFlds);
PtrList<surfaceSphericalTensorField> sstFlds;
ReadFields(mesh, objects, sstFlds);
PtrList<surfaceSymmTensorField> ssymtFlds;
ReadFields(mesh, objects, ssymtFlds);
PtrList<surfaceTensorField> stFlds;
ReadFields(mesh, objects, stFlds);
// Read point fields.
const pointMesh& pMesh = pointMesh::New(mesh);
PtrList<pointScalarField> psFlds;
ReadFields(pMesh, objects, psFlds);
PtrList<pointVectorField> pvFlds;
ReadFields(pMesh, objects, pvFlds);
PtrList<pointSphericalTensorField> pstFlds;
ReadFields(pMesh, objects, pstFlds);
PtrList<pointSymmTensorField> psymtFlds;
ReadFields(pMesh, objects, psymtFlds);
PtrList<pointTensorField> ptFlds;
ReadFields(pMesh, objects, ptFlds);
execFlowFunctionObjects(args, runTime);
}
else
{
Info<< " Reading phi" << endl;
surfaceScalarField phi
(
@ -282,6 +351,7 @@ void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
<< "Incorrect dimensions of phi: " << phi.dimensions()
<< nl << exit(FatalError);
}
}
}

View File

@ -188,8 +188,25 @@ surfaces
// cell, can be arbitrarily far away.
type patchInternalField;
patches ( ".*Wall.*" );
distance 0.0001;
interpolate true;
// Optional: specify how to obtain sampling points from the patch
// face centres (default is 'normal')
//
// //- Specify distance to offset in normal direction
offsetMode normal;
distance 0.1;
//
// //- Specify single uniform offset
// offsetMode uniform;
// offset (0 0 0.0001);
//
// //- Specify offset per patch face
// offsetMode nonuniform;
// offsets ((0 0 0.0001) (0 0 0.0002));
// Optional: whether to leave as faces (=default) or triangulate
// triangulate false;
}
@ -255,6 +272,7 @@ surfaces
distance 0.0;
interpolate false;
regularise false; // Optional: do not simplify
// mergeTol 1e-10; // Optional: fraction of mesh bounding box
// to merge points (default=1e-6)
}

View File

@ -42,13 +42,14 @@ Description
int main(int argc, char *argv[])
{
timeSelector::addOptions();
# include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMeshNoClear.H"
# include "createNamedMesh.H"
pointMesh pMesh(mesh);

View File

@ -486,6 +486,14 @@ case QSMPI:
_foamAddLib $MPI_ARCH_PATH/lib
breaksw
case SGIMPI:
setenv FOAM_MPI ${MPI_ROOT##*/}
setenv MPI_ARCH_PATH $MPI_ROOT
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
breaksw
default:
setenv FOAM_MPI dummy
breaksw

View File

@ -510,6 +510,14 @@ QSMPI)
_foamAddLib $MPI_ARCH_PATH/lib
;;
SGIMPI)
export FOAM_MPI=${MPI_ROOT##*/}
export MPI_ARCH_PATH=$MPI_ROOT
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
;;
*)
export FOAM_MPI=dummy
;;

View File

@ -37,6 +37,18 @@ void Foam::OutputFilterFunctionObject<OutputFilter>::readDict()
dict_.readIfPresent("dictionary", dictName_);
dict_.readIfPresent("enabled", enabled_);
dict_.readIfPresent("storeFilter", storeFilter_);
dict_.readIfPresent("timeStart", timeStart_);
dict_.readIfPresent("timeEnd", timeEnd_);
}
template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
{
return
enabled_
&& time_.value() >= timeStart_
&& time_.value() <= timeEnd_;
}
@ -94,6 +106,8 @@ Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
dictName_(),
enabled_(true),
storeFilter_(true),
timeStart_(-VGREAT),
timeEnd_(VGREAT),
outputControl_(t, dict)
{
readDict();
@ -121,7 +135,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::start()
{
readDict();
if (enabled_&&storeFilter_)
if (enabled_ && storeFilter_)
{
allocateFilter();
}
@ -136,7 +150,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
const bool forceWrite
)
{
if (enabled_)
if (active())
{
if (!storeFilter_)
{
@ -163,7 +177,7 @@ bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
template<class OutputFilter>
bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
{
if (enabled_)
if (active())
{
if (!storeFilter_)
{

View File

@ -68,19 +68,29 @@ class OutputFilterFunctionObject
//- Input dictionary
dictionary dict_;
//- Name of region
// Optional user inputs
//- Name of region - defaults to name of polyMesh::defaultRegion
word regionName_;
//- Optional dictionary name to supply required inputs
//- Dictionary name to supply required inputs
word dictName_;
//- Switch for the execution of the functionObject
//- Switch for the execution - defaults to 'yes/on'
bool enabled_;
//- Switch to store filter in between writes or use on-the-fly
// construction
// construction - defaults to true
bool storeFilter_;
//- Activation time - defaults to -VGREAT
scalar timeStart_;
//- De-activation time - defaults to VGREAT
scalar timeEnd_;
//- Output controls
outputFilterOutputControl outputControl_;
@ -99,6 +109,9 @@ class OutputFilterFunctionObject
//- Destroys most of the data associated with this object.
void destroyFilter();
//- Returns true if active (enabled and within time bounds)
bool active() const;
//- Disallow default bitwise copy construct
OutputFilterFunctionObject(const OutputFilterFunctionObject&);

View File

@ -40,7 +40,7 @@ Foam::Field<Type> Foam::interpolateSplineXY
forAll(xNew, i)
{
yNew[i] = interpolateSmoothXY(xNew[i], xOld, yOld);
yNew[i] = interpolateSplineXY(xNew[i], xOld, yOld);
}
return yNew;

View File

@ -514,7 +514,8 @@ Foam::label Foam::polyBoundaryMesh::whichPatch(const label faceIndex) const
FatalErrorIn
(
"polyBoundaryMesh::whichPatch(const label faceIndex) const"
) << "given label greater than the number of geometric faces"
) << "given label " << faceIndex
<< " greater than the number of geometric faces " << mesh().nFaces()
<< abort(FatalError);
}

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "STARCDMeshReader.H"
#include "cyclicPolyPatch.H"
#include "oldCyclicPolyPatch.H"
#include "emptyPolyPatch.H"
#include "wallPolyPatch.H"
#include "symmetryPolyPatch.H"
@ -950,7 +950,7 @@ void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName)
{
// incorrect. should be cyclicPatch but this
// requires info on connected faces.
patchTypes_[patchI] = cyclicPolyPatch::typeName;
patchTypes_[patchI] = oldCyclicPolyPatch::typeName;
patchPhysicalTypes_[patchI] = patchTypes_[patchI];
}
else if (origType == "baffle")

View File

@ -186,7 +186,16 @@ void Foam::dynamicRefineFvMesh::readDict()
).subDict(typeName + "Coeffs")
);
correctFluxes_ = List<Pair<word> >(refineDict.lookup("correctFluxes"));
List<Pair<word> > fluxVelocities = List<Pair<word> >
(
refineDict.lookup("correctFluxes")
);
// Rework into hashtable.
correctFluxes_.resize(fluxVelocities.size());
forAll(fluxVelocities, i)
{
correctFluxes_.insert(fluxVelocities[i][0], fluxVelocities[i][1]);
}
dumpLevel_ = Switch(refineDict.lookup("dumpLevel"));
}
@ -289,23 +298,46 @@ Foam::dynamicRefineFvMesh::refine
<< " split faces " << endl;
}
forAll(correctFluxes_, i)
HashTable<const surfaceScalarField*> fluxes
(
lookupClass<surfaceScalarField>()
);
forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter)
{
if (!correctFluxes_.found(iter.key()))
{
WarningIn("dynamicRefineFvMesh::refine(const labelList&)")
<< "Cannot find surfaceScalarField " << iter.key()
<< " in user-provided flux mapping table "
<< correctFluxes_ << endl
<< " The flux mapping table is used to recreate the"
<< " flux on newly created faces." << endl
<< " Either add the entry if it is a flux or use ("
<< iter.key() << " none) to suppress this warning."
<< endl;
continue;
}
const word& UName = correctFluxes_[iter.key()];
if (UName == "none")
{
continue;
}
if (debug)
{
Info<< "Mapping flux " << correctFluxes_[i][0]
<< " using interpolated flux " << correctFluxes_[i][1]
Info<< "Mapping flux " << iter.key()
<< " using interpolated flux " << UName
<< endl;
}
surfaceScalarField& phi = const_cast<surfaceScalarField&>
(
lookupObject<surfaceScalarField>(correctFluxes_[i][0])
);
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
const surfaceScalarField phiU
(
fvc::interpolate
(
lookupObject<volVectorField>(correctFluxes_[i][1])
lookupObject<volVectorField>(UName)
)
& Sf()
);
@ -482,27 +514,51 @@ Foam::dynamicRefineFvMesh::unrefine
const labelList& reversePointMap = map().reversePointMap();
const labelList& reverseFaceMap = map().reverseFaceMap();
forAll(correctFluxes_, i)
HashTable<const surfaceScalarField*> fluxes
(
lookupClass<surfaceScalarField>()
);
forAllConstIter(HashTable<const surfaceScalarField*>, fluxes, iter)
{
if (!correctFluxes_.found(iter.key()))
{
WarningIn("dynamicRefineFvMesh::refine(const labelList&)")
<< "Cannot find surfaceScalarField " << iter.key()
<< " in user-provided flux mapping table "
<< correctFluxes_ << endl
<< " The flux mapping table is used to recreate the"
<< " flux on newly created faces." << endl
<< " Either add the entry if it is a flux or use ("
<< iter.key() << " none) to suppress this warning."
<< endl;
continue;
}
const word& UName = correctFluxes_[iter.key()];
if (UName == "none")
{
continue;
}
if (debug)
{
Info<< "Mapping flux " << correctFluxes_[i][0]
<< " using interpolated flux " << correctFluxes_[i][1]
Info<< "Mapping flux " << iter.key()
<< " using interpolated flux " << UName
<< endl;
}
surfaceScalarField& phi = const_cast<surfaceScalarField&>
(
lookupObject<surfaceScalarField>(correctFluxes_[i][0])
);
surfaceScalarField phiU
surfaceScalarField& phi = const_cast<surfaceScalarField&>(*iter());
const surfaceScalarField phiU
(
fvc::interpolate
(
lookupObject<volVectorField>(correctFluxes_[i][1])
lookupObject<volVectorField>(UName)
)
& Sf()
);
forAllConstIter(Map<label>, faceToSplitPoint, iter)
{
label oldFaceI = iter.key();

View File

@ -64,7 +64,7 @@ protected:
Switch dumpLevel_;
//- Fluxes to map
List<Pair<word> > correctFluxes_;
HashTable<word> correctFluxes_;
//- Number of refinement/unrefinement steps done so far.
label nRefinementIterations_;

View File

@ -127,7 +127,6 @@ $(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/fanPressure/fanPressureFvPatchScalarField.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/multiphaseFixedFluxPressure/multiphaseFixedFluxPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C

View File

@ -107,7 +107,7 @@ bool Foam::adjustPhi
{
massCorr = (massIn - fixedMassOut)/adjustableMassOut;
}
else if (mag(fixedMassOut - massIn)/totalFlux > 1e-10)
else if (mag(fixedMassOut - massIn)/totalFlux > 1e-8)
{
FatalErrorIn
(

View File

@ -59,7 +59,7 @@ addRadialActuationDiskAxialInertialResistance
const Field<scalar> zoneCellVolumes(mesh().cellVolumes(), cells);
const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V();
const scalar maxR = mag(max(zoneCellCentres - avgCentre));
const scalar maxR = gMax(mag(zoneCellCentres - avgCentre));
scalar intCoeffs =
coeffs_[0]

View File

@ -59,36 +59,37 @@ bool Foam::pimpleControl::criteriaSatisfied()
bool firstIter = corr_ == 1;
bool achieved = true;
const dictionary& solverDict = mesh_.solverPerformanceDict();
bool checked = false; // safety that some checks were indeed performed
const dictionary& solverDict = mesh_.solverPerformanceDict();
forAllConstIter(dictionary, solverDict, iter)
{
const word& variableName = iter().keyword();
label fieldI = applyToField(variableName);
const label fieldI = applyToField(variableName);
if (fieldI != -1)
{
const List<lduMatrix::solverPerformance> sp(iter().stream());
const scalar residual = sp.last().initialResidual();
checked = true;
if (firstIter)
{
residualControl_[fieldI].initialResidual =
sp.first().initialResidual();
}
bool absCheck = residual < residualControl_[fieldI].absTol;
const bool absCheck = residual < residualControl_[fieldI].absTol;
bool relCheck = false;
scalar relative = 0.0;
if (!firstIter)
{
scalar iniRes =
const scalar iniRes =
residualControl_[fieldI].initialResidual
+ ROOTVSMALL;
relative = residual/iniRes;
relCheck = relative < residualControl_[fieldI].relTol;
}
@ -110,7 +111,7 @@ bool Foam::pimpleControl::criteriaSatisfied()
}
}
return achieved;
return checked && achieved;
}
@ -129,7 +130,13 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
if (nOuterCorr_ > 1)
{
Info<< nl;
if (!residualControl_.empty())
if (residualControl_.empty())
{
Info<< algorithmName_ << ": no residual control data found. "
<< "Calculations will employ " << nOuterCorr_
<< " corrector loops" << nl << endl;
}
else
{
Info<< algorithmName_ << ": max iterations = " << nOuterCorr_
<< endl;
@ -142,12 +149,6 @@ Foam::pimpleControl::pimpleControl(fvMesh& mesh)
}
Info<< endl;
}
else
{
Info<< algorithmName_ << ": no residual control data found. " << nl
<< "Calculations will employ " << nOuterCorr_
<< " corrector loops" << nl << endl;
}
}
else
{

View File

@ -69,10 +69,10 @@ protected:
// Protected Member Functions
//- Read constrols from fvSolution dictionary
//- Read controls from fvSolution dictionary
virtual void read();
//- Return true if all convergence checks are satified
//- Return true if all convergence checks are satisfied
virtual bool criteriaSatisfied();
//- Disallow default bitwise copy construct

View File

@ -50,17 +50,20 @@ bool Foam::simpleControl::criteriaSatisfied()
}
bool achieved = true;
const dictionary& solverDict = mesh_.solverPerformanceDict();
bool checked = false; // safety that some checks were indeed performed
const dictionary& solverDict = mesh_.solverPerformanceDict();
forAllConstIter(dictionary, solverDict, iter)
{
const word& variableName = iter().keyword();
label fieldI = applyToField(variableName);
const label fieldI = applyToField(variableName);
if (fieldI != -1)
{
const List<lduMatrix::solverPerformance> sp(iter().stream());
const scalar residual = sp.first().initialResidual();
checked = true;
bool absCheck = residual < residualControl_[fieldI].absTol;
achieved = achieved && absCheck;
@ -75,7 +78,7 @@ bool Foam::simpleControl::criteriaSatisfied()
}
}
return achieved;
return checked && achieved;
}
@ -90,7 +93,13 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
Info<< nl;
if (residualControl_.size() > 0)
if (residualControl_.empty())
{
Info<< algorithmName_ << ": no convergence criteria found. "
<< "Calculations will run for " << mesh_.time().endTime().value()
<< " steps." << nl << endl;
}
else
{
Info<< algorithmName_ << ": convergence criteria" << nl;
forAll(residualControl_, i)
@ -101,12 +110,6 @@ Foam::simpleControl::simpleControl(fvMesh& mesh)
}
Info<< endl;
}
else
{
Info<< algorithmName_ << ": no convergence criteria found. "
<< "Calculations will run for " << mesh_.time().endTime().value()
<< " steps." << nl << endl;
}
}

View File

@ -59,10 +59,10 @@ protected:
// Protected Member Functions
//- Read constrols from fvSolution dictionary
//- Read controls from fvSolution dictionary
void read();
//- Return true if all convergence checks are satified
//- Return true if all convergence checks are satisfied
bool criteriaSatisfied();
//- Disallow default bitwise copy construct

View File

@ -76,7 +76,8 @@ void Foam::solutionControl::read(const bool absTolOnly)
{
FatalErrorIn("bool Foam::solutionControl::read()")
<< "Residual data for " << iter().keyword()
<< " must be specified as a dictionary";
<< " must be specified as a dictionary"
<< exit(FatalError);
}
}

View File

@ -78,19 +78,19 @@ protected:
//- Flag to indicate to solve for momentum
bool momentumPredictor_;
//- Flag to indictae to solve using transonic algorithm
//- Flag to indicate to solve using transonic algorithm
bool transonic_;
// Protected Member Functions
//- Read constrols from fvSolution dictionary
//- Read controls from fvSolution dictionary
virtual void read(const bool absTolOnly);
//- Return index of field in residualControl_ if present
virtual label applyToField(const word& fieldName) const;
//- Return true if all convergence checks are satified
//- Return true if all convergence checks are satisfied
virtual bool criteriaSatisfied() = 0;
//- Store previous iteration fields
@ -142,7 +142,7 @@ public:
//- Flag to indicate to solve for momentum
inline bool momentumPredictor() const;
//- Flag to indictae to solve using transonic algorithm
//- Flag to indicate to solve using transonic algorithm
inline bool transonic() const;
};

View File

@ -204,14 +204,13 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
{
case NEARESTCELL:
{
const mapDistribute& distMap = mappedPatchBase::map();
newValues = sampleField();
distMap.distribute(newValues);
this->distribute(newValues);
break;
}
case NEARESTPATCHFACE:
case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
@ -228,36 +227,8 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
const fieldType& nbrField = sampleField();
const mapDistribute& distMap = mappedPatchBase::map();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case mappedPatchBase::NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << samplePatch()
<< " in region " << sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
// const fieldType& nbrField = sampleField();
// newValues = mpp.AMI().interpolateToSource(nbrField);
notImplemented
(
"void mappedFieldFvPatchField<Type>::updateCoeffs() "
"with mappedPatchBase::NEARESTPATCHFACEAMI"
);
this->distribute(newValues);
break;
}
@ -279,9 +250,7 @@ void mappedFieldFvPatchField<Type>::updateCoeffs()
}
}
const mapDistribute& distMap = mappedPatchBase::map();
distMap.distribute(allValues);
this->distribute(allValues);
newValues.transfer(allValues);
break;

View File

@ -114,42 +114,65 @@ void Foam::mappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
const mappedPatchBase& mpp =
refCast<const mappedPatchBase>(this->patch().patch());
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch = nbrMesh.boundary()[samplePatchI];
// Retrieve the neighbour field
const fvPatchField<Type>& nbrField =
nbrPatch.template lookupPatchField<FieldType, Type>
(
this->dimensionedInternalField().name()
);
// Retrieve the neighbour patch internal field
Field<Type> nbrIntFld(nbrField.patchInternalField());
Field<Type> nbrIntFld;
switch (mpp.mode())
{
case (mappedPatchBase::NEARESTPATCHFACEAMI):
case mappedPatchBase::NEARESTCELL:
{
// Retrieve the neighbour patch internal field
nbrIntFld = mpp.AMI().interpolateToSource(nbrIntFld);
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
) << "Cannot apply "
<< mappedPatchBase::sampleModeNames_
[
mappedPatchBase::NEARESTCELL
]
<< " mapping mode for patch " << this->patch().name()
<< exit(FatalError);
break;
}
case mappedPatchBase::NEARESTPATCHFACE:
{
const label samplePatchI = mpp.samplePolyPatch().index();
const fvPatchField<Type>& nbrPatchField =
this->sampleField().boundaryField()[samplePatchI];
nbrIntFld = nbrPatchField.patchInternalField();
mpp.distribute(nbrIntFld);
break;
}
case mappedPatchBase::NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const FieldType& nbrField = this->sampleField();
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf = nbrField.boundaryField()[patchI];
const Field<Type> pif(pf.patchInternalField());
label faceStart = pf.patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pif[faceI];
}
}
mpp.distribute(allValues);
nbrIntFld.transfer(allValues);
break;
}
default:
{
const mapDistribute& distMap = mpp.map();
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(), // what to send
distMap.constructMap(), // what to receive
nbrIntFld
);
break;
FatalErrorIn("mappedFixedValueFvPatchField<Type>::updateCoeffs()")
<< "Unknown sampling mode: " << mpp.mode()
<< abort(FatalError);
}
}

View File

@ -283,30 +283,6 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
break;
}
case mappedPatchBase::NEARESTPATCHFACE:
{
const mapDistribute& distMap = mpp.map();
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void mappedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unable to find sample patch " << mpp.samplePatch()
<< " in region " << mpp.sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
break;
}
case mappedPatchBase::NEARESTPATCHFACEAMI:
{
const label nbrPatchID =
@ -324,9 +300,9 @@ void mappedFixedValueFvPatchField<Type>::updateCoeffs()
}
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
newValues = mpp.AMI().interpolateToSource(newValues);
newValues = nbrField.boundaryField()[nbrPatchID];
mpp.distribute(newValues);
break;
}

View File

@ -71,7 +71,10 @@ class mappedFixedValueFvPatchField
:
public fixedValueFvPatchField<Type>
{
// Private data
protected:
// Protected data
//- Name of field to sample - defaults to field associated with this
// patchField if not specified
@ -90,7 +93,7 @@ class mappedFixedValueFvPatchField
mutable autoPtr<interpolation<Type> > interpolator_;
// Private Member Functions
// Protected Member Functions
//- Field to sample. Either on my or nbr mesh
const GeometricField<Type, fvPatchField, volMesh>& sampleField() const;

View File

@ -28,7 +28,6 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "mappedPatchBase.H"
#include "mapDistribute.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -128,7 +127,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
scalarList phi =
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_);
mpp.map().distribute(phi);
mpp.distribute(phi);
const surfaceScalarField& phiName =

View File

@ -176,13 +176,10 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
(
mappedVelocityFluxFixedValueFvPatchField::patch().patch()
);
const mapDistribute& distMap = mpp.map();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
const word& fieldName = dimensionedInternalField().name();
const volVectorField& UField = nbrMesh.lookupObject<volVectorField>
(
fieldName
);
const volVectorField& UField =
nbrMesh.lookupObject<volVectorField>(fieldName);
surfaceScalarField& phiField = const_cast<surfaceScalarField&>
(
@ -213,26 +210,25 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
}
}
distMap.distribute(allUValues);
mpp.distribute(allUValues);
newUValues.transfer(allUValues);
distMap.distribute(allPhiValues);
mpp.distribute(allPhiValues);
newPhiValues.transfer(allPhiValues);
break;
}
case mappedPolyPatch::NEARESTPATCHFACE:
case mappedPolyPatch::NEARESTPATCHFACEAMI:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
mpp.samplePatch()
);
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
newUValues = UField.boundaryField()[nbrPatchID];
distMap.distribute(newUValues);
mpp.distribute(newUValues);
newPhiValues = phiField.boundaryField()[nbrPatchID];
distMap.distribute(newPhiValues);
mpp.distribute(newPhiValues);
break;
}
@ -242,8 +238,9 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs()
(
"mappedVelocityFluxFixedValueFvPatchField::"
"updateCoeffs()"
) << "patch can only be used in NEARESTPATCHFACE or NEARESTFACE "
<< "mode" << nl << abort(FatalError);
) << "patch can only be used in NEARESTPATCHFACE, "
<< "NEARESTPATCHFACEAMI or NEARESTFACE mode" << nl
<< abort(FatalError);
}
}

View File

@ -1,177 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "multiphaseFixedFluxPressureFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_("U"),
phiName_("phi"),
rhoName_("rho")
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
UName_(ptf.UName_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedGradientFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{
if (dict.found("gradient"))
{
gradient() = scalarField("gradient", dict, p.size());
fixedGradientFvPatchScalarField::updateCoeffs();
fixedGradientFvPatchScalarField::evaluate();
}
else
{
fvPatchField<scalar>::operator=(patchInternalField());
gradient() = 0.0;
}
}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf
)
:
fixedGradientFvPatchScalarField(wbppsf),
UName_(wbppsf.UName_),
phiName_(wbppsf.phiName_),
rhoName_(wbppsf.rhoName_)
{}
Foam::multiphaseFixedFluxPressureFvPatchScalarField::
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField& wbppsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedGradientFvPatchScalarField(wbppsf, iF),
UName_(wbppsf.UName_),
phiName_(wbppsf.phiName_),
rhoName_(wbppsf.rhoName_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>(UName_);
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>(phiName_);
fvsPatchField<scalar> phip =
patch().patchField<surfaceScalarField, scalar>(phi);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
phip /= rhop;
}
const fvsPatchField<scalar>& Dpp =
patch().lookupPatchField<surfaceScalarField, scalar>("Dp");
gradient() = (phip - (patch().Sf() & Up))/patch().magSf()/Dpp;
fixedGradientFvPatchScalarField::updateCoeffs();
}
void Foam::multiphaseFixedFluxPressureFvPatchScalarField::write
(
Ostream& os
) const
{
fvPatchScalarField::write(os);
writeEntryIfDifferent<word>(os, "U", "U", UName_);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
gradient().writeEntry("gradient", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchScalarField,
multiphaseFixedFluxPressureFvPatchScalarField
);
}
// ************************************************************************* //

View File

@ -1,154 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::multiphaseFixedFluxPressureFvPatchScalarField
Description
Foam::multiphaseFixedFluxPressureFvPatchScalarField
SourceFiles
multiphaseFixedFluxPressureFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef multiphaseFixedFluxPressureFvPatchScalarFields_H
#define multiphaseFixedFluxPressureFvPatchScalarFields_H
#include "fvPatchFields.H"
#include "fixedGradientFvPatchFields.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiphaseFixedFluxPressureFvPatch Declaration
\*---------------------------------------------------------------------------*/
class multiphaseFixedFluxPressureFvPatchScalarField
:
public fixedGradientFvPatchScalarField
{
// Private data
//- Name of the velocity field
word UName_;
//- Name of the flux transporting the field
word phiName_;
//- Name of the density field used to normalise the mass flux
// if neccessary
word rhoName_;
public:
//- Runtime type information
TypeName("multiphaseFixedFluxPressure");
// Constructors
//- Construct from patch and internal field
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
multiphaseFixedFluxPressureFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// multiphaseFixedFluxPressureFvPatchScalarField onto a new patch
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new multiphaseFixedFluxPressureFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
multiphaseFixedFluxPressureFvPatchScalarField
(
const multiphaseFixedFluxPressureFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new multiphaseFixedFluxPressureFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -229,7 +229,6 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fvMesh& thisMesh = this->patch().boundaryMesh().mesh();
const fvMesh& nbrMesh = refCast<const fvMesh>(sampleMesh());
const mapDistribute& distMap = mappedPatchBase::map();
// Result of obtaining remote values
Field<Type> newValues;
@ -238,6 +237,8 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
{
case NEARESTCELL:
{
const mapDistribute& distMap = mappedPatchBase::map();
if (interpolationScheme_ != interpolationCell<Type>::typeName)
{
// Need to do interpolation so need cells to sample.
@ -275,12 +276,10 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
break;
}
case NEARESTPATCHFACE:
case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI:
{
const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID
(
samplePatch()
);
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
@ -297,7 +296,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
const fieldType& nbrField = sampleField();
newValues = nbrField.boundaryField()[nbrPatchID];
distMap.distribute(newValues);
this->distribute(newValues);
break;
}
@ -319,7 +318,7 @@ void selfContainedMappedFixedValueFvPatchField<Type>::updateCoeffs()
}
}
distMap.distribute(allValues);
this->distribute(allValues);
newValues.transfer(allValues);

View File

@ -324,6 +324,8 @@ bool Foam::KinematicParcel<ParcelType>::move
}
p.age() += dt;
td.cloud().functions().postMove(p, cellI, dt);
}
return td.keepParticle;

View File

@ -31,6 +31,7 @@ License
#include "FacePostProcessing.H"
#include "ParticleTracks.H"
#include "PatchPostProcessing.H"
#include "VoidFraction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +41,8 @@ License
\
makeCloudFunctionObjectType(FacePostProcessing, CloudType); \
makeCloudFunctionObjectType(ParticleTracks, CloudType); \
makeCloudFunctionObjectType(PatchPostProcessing, CloudType);
makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \
makeCloudFunctionObjectType(VoidFraction, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -91,6 +91,18 @@ void Foam::CloudFunctionObject<CloudType>::postEvolve()
}
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postMove
(
const typename CloudType::parcelType&,
const label,
const scalar
)
{
// do nothing
}
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postPatch
(
@ -98,14 +110,7 @@ void Foam::CloudFunctionObject<CloudType>::postPatch
const label
)
{
notImplemented
(
"void Foam::CloudFunctionObject<CloudType>::postPatch"
"("
"const typename CloudType::parcelType&,"
"const label"
")"
);
// do nothing
}
@ -115,13 +120,7 @@ void Foam::CloudFunctionObject<CloudType>::postFace
const typename CloudType::parcelType&
)
{
notImplemented
(
"void Foam::CloudFunctionObject<CloudType>::postFace"
"("
"const typename CloudType::parcelType&"
")"
);
// do nothing
}

View File

@ -129,6 +129,14 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Post-move hook
virtual void postMove
(
const typename CloudType::parcelType& p,
const label cellI,
const scalar dt
);
//- Post-patch hook
virtual void postPatch
(

View File

@ -127,6 +127,21 @@ void Foam::CloudFunctionObjectList<CloudType>::postEvolve()
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postMove
(
const typename CloudType::parcelType& p,
const label cellI,
const scalar dt
)
{
forAll(*this, i)
{
this->operator[](i).postMove(p, cellI, dt);
}
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postPatch
(

View File

@ -109,6 +109,14 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Post-move hook
virtual void postMove
(
const typename CloudType::parcelType& p,
const label cellI,
const scalar dt
);
//- Post-patch hook
virtual void postPatch
(

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "VoidFraction.H"
#
// * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * //
template<class CloudType>
void Foam::VoidFraction<CloudType>::write()
{
if (thetaPtr_.valid())
{
thetaPtr_->write();
}
else
{
FatalErrorIn("void Foam::VoidFraction<CloudType>::write()")
<< "thetaPtr not valid" << abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::VoidFraction<CloudType>::VoidFraction
(
const dictionary& dict,
CloudType& owner
)
:
CloudFunctionObject<CloudType>(owner),
thetaPtr_(NULL)
{}
template<class CloudType>
Foam::VoidFraction<CloudType>::VoidFraction
(
const VoidFraction<CloudType>& vf
)
:
CloudFunctionObject<CloudType>(vf),
thetaPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::VoidFraction<CloudType>::~VoidFraction()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::VoidFraction<CloudType>::preEvolve()
{
if (thetaPtr_.valid())
{
thetaPtr_->internalField() = 0.0;
}
else
{
const fvMesh& mesh = this->owner().mesh();
thetaPtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + "Theta",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimless, 0.0)
)
);
}
}
template<class CloudType>
void Foam::VoidFraction<CloudType>::postEvolve()
{
volScalarField& theta = thetaPtr_();
const fvMesh& mesh = this->owner().mesh();
theta.internalField() /= mesh.time().deltaTValue()*mesh.V();
CloudFunctionObject<CloudType>::postEvolve();
}
template<class CloudType>
void Foam::VoidFraction<CloudType>::postMove
(
const parcelType& p,
const label cellI,
const scalar dt
)
{
volScalarField& theta = thetaPtr_();
theta[cellI] += dt*p.nParticle()*p.volume();
}
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ 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 <http://www.gnu.org/licenses/>.
Class
Foam::VoidFraction
Description
Creates particle void fraction field on carrier phase
SourceFiles
VoidFraction.C
\*---------------------------------------------------------------------------*/
#ifndef VoidFraction_H
#define VoidFraction_H
#include "CloudFunctionObject.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class VoidFraction Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class VoidFraction
:
public CloudFunctionObject<CloudType>
{
// Private Data
// Typedefs
//- Convenience typedef for parcel type
typedef typename CloudType::parcelType parcelType;
//- Void fraction field
autoPtr<volScalarField> thetaPtr_;
protected:
// Protected Member Functions
//- Write post-processing info
virtual void write();
public:
//- Runtime type information
TypeName("voidFraction");
// Constructors
//- Construct from dictionary
VoidFraction(const dictionary& dict, CloudType& owner);
//- Construct copy
VoidFraction(const VoidFraction<CloudType>& vf);
//- Construct and return a clone
virtual autoPtr<CloudFunctionObject<CloudType> > clone() const
{
return autoPtr<CloudFunctionObject<CloudType> >
(
new VoidFraction<CloudType>(*this)
);
}
//- Destructor
virtual ~VoidFraction();
// Member Functions
// Evaluation
//- Pre-evolve hook
virtual void preEvolve();
//- Post-evolve hook
virtual void postEvolve();
//- Post-move hook
virtual void postMove
(
const parcelType& p,
const label cellI,
const scalar dt
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "VoidFraction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -220,11 +220,14 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
:
InjectionModel<CloudType>(im),
injectionMethod_(im.injectionMethod_),
flowType_(im.flowType_),
outerDiameter_(im.outerDiameter_),
innerDiameter_(im.innerDiameter_),
duration_(im.duration_),
position_(im.position_),
injectorCell_(im.injectorCell_),
tetFaceI_(im.tetFaceI_),
tetPtI_(im.tetPtI_),
direction_(im.direction_),
parcelsPerSecond_(im.parcelsPerSecond_),
flowRateProfile_(im.flowRateProfile_().clone().ptr()),
@ -235,9 +238,18 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
tanVec2_(im.tanVec1_),
normal_(im.normal_),
UMag_(im.UMag_),
Cd_(im.Cd_().clone().ptr()),
Pinj_(im.Pinj_().clone().ptr())
{}
Cd_(NULL),
Pinj_(NULL)
{
if (im.Cd_.valid())
{
Cd_.reset(im.Cd_().clone().ptr());
}
if (im.Pinj_.valid())
{
Pinj_.reset(im.Pinj_().clone().ptr());
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -114,8 +114,8 @@ bool Foam::SurfaceFilmModel<CloudType>::transferParcel
"bool Foam::SurfaceFilmModel<CloudType>::transferParcel"
"("
"parcelType&, "
"const label, "
"const bool&"
"const polyPatch&, "
"bool&"
")"
);
@ -156,11 +156,9 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
const label filmPatchI = filmPatches[i];
const label primaryPatchI = primaryPatches[i];
const mappedPatchBase& mapPatch = filmModel.mappedPatches()[filmPatchI];
const labelList& injectorCellsPatch = pbm[primaryPatchI].faceCells();
cacheFilmFields(filmPatchI, primaryPatchI, mapPatch, filmModel);
cacheFilmFields(filmPatchI, primaryPatchI, filmModel);
const vectorField& Cf = mesh.C().boundaryField()[primaryPatchI];
const vectorField& Sf = mesh.Sf().boundaryField()[primaryPatchI];
@ -172,13 +170,11 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
{
const label cellI = injectorCellsPatch[j];
// The position is at the cell centre, which could be
// in any tet of the decomposed cell, so arbitrarily
// choose the first face of the cell as the tetFace
// and the first point on the face after the base
// point as the tetPt. The tracking will
// pick the cell consistent with the motion in the
// first tracking step.
// The position could bein any tet of the decomposed cell,
// so arbitrarily choose the first face of the cell as the
// tetFace and the first point on the face after the base
// point as the tetPt. The tracking will pick the cell
// consistent with the motion in the first tracking step.
const label tetFaceI = this->owner().mesh().cells()[cellI][0];
const label tetPtI = 1;
@ -208,8 +204,10 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
setParcelProperties(*pPtr, j);
if (pPtr->nParticle() > 0.001)
{
// Check new parcel properties
// td.cloud().checkParcelProperties(*pPtr, 0.0, true);
// td.cloud().checkParcelProperties(*pPtr, 0.0, true);
td.cloud().checkParcelProperties(*pPtr, 0.0, false);
// Add the new parcel to the cloud
@ -217,6 +215,12 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
nParcelsInjected_++;
}
else
{
// TODO: cache mass and re-distribute?
delete pPtr;
}
}
}
}
}
@ -227,26 +231,25 @@ void Foam::SurfaceFilmModel<CloudType>::cacheFilmFields
(
const label filmPatchI,
const label primaryPatchI,
const mappedPatchBase& mapPatch,
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
)
{
massParcelPatch_ = filmModel.cloudMassTrans().boundaryField()[filmPatchI];
mapPatch.distribute(massParcelPatch_);
filmModel.toPrimary(filmPatchI, massParcelPatch_);
diameterParcelPatch_ =
filmModel.cloudDiameterTrans().boundaryField()[filmPatchI];
mapPatch.distribute(diameterParcelPatch_);
filmModel.toPrimary(filmPatchI, diameterParcelPatch_);
UFilmPatch_ = filmModel.Us().boundaryField()[filmPatchI];
mapPatch.distribute(UFilmPatch_);
filmModel.toPrimary(filmPatchI, UFilmPatch_);
rhoFilmPatch_ = filmModel.rho().boundaryField()[filmPatchI];
mapPatch.distribute(rhoFilmPatch_);
filmModel.toPrimary(filmPatchI, rhoFilmPatch_);
deltaFilmPatch_[primaryPatchI] =
filmModel.delta().boundaryField()[filmPatchI];
mapPatch.distribute(deltaFilmPatch_[primaryPatchI]);
filmModel.toPrimary(filmPatchI, deltaFilmPatch_[primaryPatchI]);
}

View File

@ -116,7 +116,6 @@ protected:
(
const label filmPatchI,
const label primaryPatchI,
const mappedPatchBase& mapPatch,
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
);

View File

@ -643,7 +643,6 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
(
const label filmPatchI,
const label primaryPatchI,
const mappedPatchBase& mapPatch,
const regionModels::surfaceFilmModels::surfaceFilmModel& filmModel
)
{
@ -651,15 +650,14 @@ void Foam::ThermoSurfaceFilm<CloudType>::cacheFilmFields
(
filmPatchI,
primaryPatchI,
mapPatch,
filmModel
);
TFilmPatch_ = filmModel.Ts().boundaryField()[filmPatchI];
mapPatch.distribute(TFilmPatch_);
filmModel.toPrimary(filmPatchI, TFilmPatch_);
CpFilmPatch_ = filmModel.Cp().boundaryField()[filmPatchI];
mapPatch.distribute(CpFilmPatch_);
filmModel.toPrimary(filmPatchI, CpFilmPatch_);
}

View File

@ -227,7 +227,6 @@ protected:
(
const label filmPatchI,
const label primaryPatchI,
const mappedPatchBase& distMap,
const regionModels::surfaceFilmModels::surfaceFilmModel&
filmModel
);

View File

@ -110,6 +110,11 @@ Foam::SprayCloud<CloudType>::SprayCloud
Info << "Average parcel mass: " << averageParcelMass_ << endl;
}
if (this->solution().resetSourcesOnStartup())
{
CloudType::resetSourceTerms();
}
}

View File

@ -46,6 +46,7 @@ Description
#include "combineFaces.H"
#include "IOmanip.H"
#include "globalIndex.H"
#include "DynamicField.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -1990,6 +1991,7 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark
(
const addPatchCellLayer& addLayer,
const dictionary& meshQualityDict,
const bool additionalReporting,
const List<labelPair>& baffles,
const indirectPrimitivePatch& pp,
const fvMesh& newMesh,
@ -2032,6 +2034,12 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark
);
// Check if any of the faces in error uses any face of an added cell
// - if additionalReporting print the few remaining areas for ease of
// finding out where the problems are.
const label nReportMax = 10;
DynamicField<point> disabledFaceCentres(nReportMax);
forAll(addedCells, oldPatchFaceI)
{
// Get the cells (in newMesh labels) per old patch face (in mesh
@ -2052,12 +2060,58 @@ Foam::label Foam::autoLayerDriver::checkAndUnmark
)
)
{
if (additionalReporting && (nChanged < nReportMax))
{
disabledFaceCentres.append
(
pp.faceCentres()[oldPatchFaceI]
);
}
nChanged++;
}
}
}
return returnReduce(nChanged, sumOp<label>());
label nChangedTotal = returnReduce(nChanged, sumOp<label>());
if (additionalReporting)
{
// Limit the number of points to be printed so that
// not too many points are reported when running in parallel
// Not accurate, i.e. not always nReportMax points are written,
// but this estimation avoid some communication here.
// The important thing, however, is that when only a few faces
// are disabled, their coordinates are printed, and this should be
// the case
label nReportLocal =
min
(
max(nChangedTotal / Pstream::nProcs(), 1),
min
(
nChanged,
max(nReportMax / Pstream::nProcs(), 1)
)
);
Pout<< "Checked mesh with layers. Disabled extrusion at " << endl;
for (label i=0; i < nReportLocal; i++)
{
Pout<< " " << disabledFaceCentres[i] << endl;
}
label nReportTotal = returnReduce(nReportLocal, sumOp<label>());
if (nReportTotal < nChangedTotal)
{
Info<< "Suppressed disabled extrusion message for other "
<< nChangedTotal - nReportTotal << " faces." << endl;
}
}
return nChangedTotal;
}
@ -2858,6 +2912,7 @@ void Foam::autoLayerDriver::addLayers
(
addLayer,
meshQualityDict,
layerParams.additionalReporting(),
newMeshBaffles,
pp(),
newMesh,

View File

@ -331,6 +331,7 @@ class autoLayerDriver
(
const addPatchCellLayer& addLayer,
const dictionary& motionDict,
const bool additionalReporting,
const List<labelPair>& baffles,
const indirectPrimitivePatch& pp,
const fvMesh&,

View File

@ -137,98 +137,98 @@ Foam::labelList Foam::layerParameters::readNumLayers
// * * * * * * * * * * * * * * * * 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
//(
// 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
@ -289,7 +289,8 @@ Foam::layerParameters::layerParameters
),
nSnap_(readLabel(dict.lookup("nRelaxIter"))),
nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
nRelaxedIter_(labelMax)
nRelaxedIter_(labelMax),
additionalReporting_(dict.lookupOrDefault("additionalReporting", false))
{
if (nGrow_ > 0)
{

View File

@ -105,6 +105,7 @@ class layerParameters
label nRelaxedIter_;
Switch additionalReporting_;
// Private Member Functions
@ -128,15 +129,15 @@ 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 - old syntax
//layerParameters
//(
// const PtrList<dictionary>& surfaceDicts,
// const refinementSurfaces& refineSurfaces,
// const labelList& globalToPatch,
// const dictionary& dict,
// const polyBoundaryMesh& boundaryMesh
//);
//- Construct from dictionary - new syntax
layerParameters(const dictionary& dict, const polyBoundaryMesh&);
@ -259,6 +260,12 @@ public:
return nSnap_;
}
const Switch& additionalReporting() const
{
return additionalReporting_;
}
// Overall
//- Number of overall layer addition iterations

View File

@ -97,9 +97,10 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints());
boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints());
bbTgt.inflate(maxBoundsError);
boundBox bbTgtInf(bbTgt);
bbTgtInf.inflate(maxBoundsError);
if (!bbTgt.contains(bbSrc))
if (!bbTgtInf.contains(bbSrc))
{
WarningIn
(
@ -109,14 +110,46 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::checkPatches
"const primitivePatch&"
")"
) << "Source and target patch bounding boxes are not similar" << nl
<< " src span : " << bbSrc.span() << nl
<< " tgt span : " << bbTgt.span() << nl
<< " source: " << bbSrc << nl
<< " target: " << bbTgt << endl;
<< " source box span : " << bbSrc.span() << nl
<< " target box span : " << bbTgt.span() << nl
<< " source box : " << bbSrc << nl
<< " target box : " << bbTgt << nl
<< " inflated target box : " << bbTgtInf << endl;
}
}
template<class SourcePatch, class TargetPatch>
bool Foam::AMIInterpolation<SourcePatch, TargetPatch>::distributed
(
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
)
{
if (Pstream::parRun())
{
List<label> facesPresentOnProc(Pstream::nProcs(), 0);
if ((srcPatch.size() > 0) || (tgtPatch.size() > 0))
{
facesPresentOnProc[Pstream::myProcNo()] = 1;
}
else
{
facesPresentOnProc[Pstream::myProcNo()] = 0;
}
Pstream::gatherList(facesPresentOnProc);
Pstream::scatterList(facesPresentOnProc);
if (sum(facesPresentOnProc) > 1)
{
return true;
}
}
return false;
}
template<class SourcePatch, class TargetPatch>
Foam::label
Foam::AMIInterpolation<SourcePatch, TargetPatch>::calcOverlappingProcs
@ -1158,7 +1191,7 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
{
static label patchI = 0;
if (Pstream::parRun())
if (Pstream::parRun() && distributed(srcPatch, tgtPatch))
{
// convert local addressing to global addressing
globalIndex globalSrcFaces(srcPatch.size());

View File

@ -167,6 +167,13 @@ class AMIInterpolation
// Parallel functionality
//- Return true if faces are spread over multiple domains
bool distributed
(
const primitivePatch& srcPatch,
const primitivePatch& tgtPatch
);
label calcOverlappingProcs
(
const List<treeBoundBoxList>& procBb,

View File

@ -112,6 +112,10 @@ public:
NORMAL // use face normal + distance
};
static const NamedEnum<sampleMode, 4> sampleModeNames_;
static const NamedEnum<offsetMode, 3> offsetModeNames_;
//- Helper class for finding nearest
// Nearest:
@ -142,13 +146,9 @@ public:
};
private:
protected:
// Private data
static const NamedEnum<sampleMode, 4> sampleModeNames_;
static const NamedEnum<offsetMode, 3> offsetModeNames_;
// Protected data
//- Patch to sample
const polyPatch& patch_;
@ -199,7 +199,7 @@ private:
dictionary surfDict_;
// Private Member Functions
// Protected Member Functions
//- Collect single list of samples and originating processor+face.
void collectSamples
@ -339,6 +339,26 @@ public:
}
//- Wrapper around map/interpolate data distribution
template<class Type>
void reverseDistribute(List<Type>& lst) const
{
switch (mode_)
{
case NEARESTPATCHFACEAMI:
{
lst = AMI().interpolateToTarget(Field<Type>(lst.xfer()));
break;
}
default:
{
label cSize = patch_.size();
map().reverseDistribute(cSize, lst);
}
}
}
//- Return reference to the parallel distribution map
const mapDistribute& map() const
{

View File

@ -53,4 +53,6 @@ fi
wmake $makeType decompositionMethods
wmake $makeType decompose
# ----------------------------------------------------------------- end-of-file

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