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

This commit is contained in:
mattijs
2009-06-12 16:41:28 +01:00
464 changed files with 17423 additions and 3843 deletions

3
.gitignore vendored
View File

@ -7,6 +7,7 @@
*.orig *.orig
*.bak *.bak
\#*\# \#*\#
.directory
# CVS recovered versions - anywhere # CVS recovered versions - anywhere
.#* .#*
@ -47,7 +48,9 @@ doc/[Dd]oxygen/man
# source packages - anywhere # source packages - anywhere
*.tar.bz2 *.tar.bz2
*.tar.gz *.tar.gz
*.tar
*.tgz *.tgz
*.gtgz
# ignore the persistent .build tag in the main directory # ignore the persistent .build tag in the main directory
/.build /.build

View File

@ -1,40 +0,0 @@
Info << "\nConstructing gas properties" << endl;
/*
PtrList<specieConstProperties> gasProperties(Y.size());
forAll(gasProperties, i)
{
gasProperties.set
(
i,
new specieConstProperties
(
dynamic_cast<const multiComponentMixture<constTransport<
specieThermo<hConstThermo<perfectGas> > > >&>
(thermo()).speciesData()[i]
)
);
}
*/
PtrList<specieReactingProperties> gasProperties(Y.size());
forAll(gasProperties, i)
{
gasProperties.set
(
i,
new specieReactingProperties
(
dynamic_cast<const reactingMixture&>(thermo()).speciesData()[i]
)
);
}
Info<< "\nConstructing reacting cloud" << endl;
basicReactingCloud parcels
(
"reactingCloud1",
rho,
U,
g,
thermo(),
gasProperties
);

View File

@ -19,7 +19,6 @@ EXE_INC = \
-I$(LIB_SRC)/ODE/lnInclude -I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools \ -lmeshTools \
-lcompressibleRASModels \ -lcompressibleRASModels \

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,11 +35,11 @@ Description
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicThermoCloud.H" #include "basicThermoCloud.H"
#include "coalCloud.H" #include "CoalCloud.H"
#include "chemistryModel.H" #include "chemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "ReactingCloudThermoTypes.H" #include "reactingThermoTypes.H"
#include "timeActivatedExplicitSource.H" #include "timeActivatedExplicitCellSource.H"
#include "radiationModel.H" #include "radiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -113,8 +113,6 @@ int main(int argc, char *argv[])
turbulence->correct(); turbulence->correct();
enthalpySource.update();
rho = thermo->rho(); rho = thermo->rho();
if (runTime.write()) if (runTime.write())

View File

@ -1,44 +1,11 @@
Info<< "\nConstructing interpolation" << endl;
Info << "\nConstructing gas properties" << endl;
/*
PtrList<specieConstProperties> gasProperties(Y.size());
forAll(gasProperties, i)
{
gasProperties.set
(
i,
new specieConstProperties
(
dynamic_cast<const multiComponentMixture<constTransport<
specieThermo<hConstThermo<perfectGas> > > >&>
(thermo()).speciesData()[i]
)
);
}
*/
PtrList<specieReactingProperties> gasProperties(Y.size());
forAll(gasProperties, i)
{
gasProperties.set
(
i,
new specieReactingProperties
(
dynamic_cast<const reactingMixture&>(thermo()).speciesData()[i]
)
);
}
Info<< "\nConstructing coal cloud" << endl; Info<< "\nConstructing coal cloud" << endl;
coalCloud coalParcels CoalCloud<specieReactingProperties> coalParcels
( (
"coalCloud1", "coalCloud1",
rho, rho,
U, U,
g, g,
thermo(), thermo()
gasProperties
); );
Info<< "\nConstructing limestone cloud" << endl; Info<< "\nConstructing limestone cloud" << endl;

View File

@ -105,8 +105,8 @@
volScalarField DpDt = volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info<< "\nConstructing explicit enthalpy source" << endl; Info<< "\nConstructing explicit enthalpy cell source" << endl;
timeActivatedExplicitSource enthalpySource timeActivatedExplicitCellSource enthalpySource
( (
"enthalpySource", "enthalpySource",
mesh, mesh,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -15,12 +15,10 @@
( (
UEqn UEqn
== ==
-fvc::reconstruct fvc::reconstruct
( (
( fvc::interpolate(rho)*(g & mesh.Sf())
fvc::snGrad(pd) - fvc::snGrad(p)*mesh.magSf()
+ ghf*fvc::snGrad(rho)
) * mesh.magSf()
) )
); );
} }

View File

@ -59,27 +59,6 @@
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p) fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
); );
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef"));
Info<< "Creating field pd\n" << endl;
volScalarField pd
(
IOobject
(
"pd",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
p = pd + rho*gh + pRef;
thermo->correct(); thermo->correct();
dimensionedScalar initialMass = fvc::domainIntegrate(rho); dimensionedScalar initialMass = fvc::domainIntegrate(rho);

View File

@ -1,5 +1,5 @@
{ {
bool closedVolume = pd.needReference(); bool closedVolume = p.needReference();
rho = thermo->rho(); rho = thermo->rho();
@ -17,38 +17,35 @@
) )
); );
phi = phiU - ghf*fvc::snGrad(rho)*rhorUAf*mesh.magSf(); phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pdEqn fvScalarMatrix pEqn
( (
fvm::ddt(psi, pd) fvm::ddt(psi, p)
+ fvc::ddt(psi)*pRef
+ fvc::ddt(psi, rho)*gh
+ fvc::div(phi) + fvc::div(phi)
- fvm::laplacian(rhorUAf, pd) - fvm::laplacian(rhorUAf, p)
); );
if (corr == nCorr-1 && nonOrth == nNonOrthCorr) if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{ {
pdEqn.solve(mesh.solver(pd.name() + "Final")); pEqn.solve(mesh.solver(p.name() + "Final"));
} }
else else
{ {
pdEqn.solve(mesh.solver(pd.name())); pEqn.solve(mesh.solver(p.name()));
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi += pdEqn.flux(); phi += pEqn.flux();
} }
} }
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf); U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
p == pd + rho*gh + pRef;
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
#include "rhoEqn.H" #include "rhoEqn.H"
@ -62,6 +59,4 @@
/fvc::domainIntegrate(thermo->psi()); /fvc::domainIntegrate(thermo->psi());
rho = thermo->rho(); rho = thermo->rho();
} }
pd == p - (rho*gh + pRef);
} }

View File

@ -13,14 +13,11 @@
( (
UEqn() UEqn()
== ==
-fvc::reconstruct fvc::reconstruct
( (
( fvc::interpolate(rho)*(g & mesh.Sf())
fvc::snGrad(pd) - fvc::snGrad(p)*mesh.magSf()
+ ghf*fvc::snGrad(rho)
) * mesh.magSf()
) )
).initialResidual(); ).initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);

View File

@ -39,15 +39,14 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readEnvironmentalProperties.H"
#include "createFields.H"
#include "initContinuityErrs.H"
# include "setRootCase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
# include "createTime.H"
# include "createMesh.H"
# include "readEnvironmentalProperties.H"
# include "createFields.H"
# include "initContinuityErrs.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -55,17 +54,17 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H" #include "readSIMPLEControls.H"
# include "initConvergenceCheck.H" #include "initConvergenceCheck.H"
pd.storePrevIter(); p.storePrevIter();
rho.storePrevIter(); rho.storePrevIter();
// Pressure-velocity SIMPLE corrector // Pressure-velocity SIMPLE corrector
{ {
# include "UEqn.H" #include "UEqn.H"
# include "hEqn.H" #include "hEqn.H"
# include "pEqn.H" #include "pEqn.H"
} }
turbulence->correct(); turbulence->correct();
@ -76,7 +75,7 @@ int main(int argc, char *argv[])
<< " ClockTime = " << runTime.elapsedClockTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl; << nl << endl;
# include "convergenceCheck.H" #include "convergenceCheck.H"
} }
Info<< "End\n" << endl; Info<< "End\n" << endl;

View File

@ -51,38 +51,16 @@
) )
); );
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
dimensionedScalar pRef("pRef", p.dimensions(), thermo->lookup("pRef"));
Info<< "Creating field pd\n" << endl;
volScalarField pd
(
IOobject
(
"pd",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
p = pd + rho*gh + pRef;
thermo->correct(); thermo->correct();
label pRefCell = 0;
label pdRefCell = 0; scalar pRefValue = 0.0;
scalar pdRefValue = 0.0;
setRefCell setRefCell
( (
pd, p,
mesh.solutionDict().subDict("SIMPLE"), mesh.solutionDict().subDict("SIMPLE"),
pdRefCell, pRefCell,
pdRefValue pRefValue
); );

View File

@ -1,4 +1,6 @@
{ {
rho = thermo->rho();
volScalarField rUA = 1.0/UEqn().A(); volScalarField rUA = 1.0/UEqn().A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA)); surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
@ -7,60 +9,57 @@
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf()); phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
bool closedVolume = adjustPhi(phi, U, p); bool closedVolume = adjustPhi(phi, U, p);
surfaceScalarField buoyancyPhi = ghf*fvc::snGrad(rho)*rhorUAf*mesh.magSf(); surfaceScalarField buoyancyPhi =
phi -= buoyancyPhi; rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pdEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rhorUAf, pd) == fvc::div(phi) fvm::laplacian(rhorUAf, p) == fvc::div(phi)
); );
pdEqn.setReference(pdRefCell, pdRefValue); pEqn.setReference(pRefCell, p[pRefCell]);
// retain the residual from the first iteration // retain the residual from the first iteration
if (nonOrth == 0) if (nonOrth == 0)
{ {
eqnResidual = pdEqn.solve().initialResidual(); eqnResidual = pEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual); maxResidual = max(eqnResidual, maxResidual);
} }
else else
{ {
pdEqn.solve(); pEqn.solve();
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p))
/fvc::domainIntegrate(thermo->psi());
}
// Calculate the conservative fluxes // Calculate the conservative fluxes
phi -= pdEqn.flux(); phi -= pEqn.flux();
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
pd.relax(); p.relax();
// Correct the momentum source with the pressure gradient flux // Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure // calculated from the relaxed pressure
U -= rUA*fvc::reconstruct((buoyancyPhi + pdEqn.flux())/rhorUAf); U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
} }
#include "continuityErrs.H" #include "continuityErrs.H"
p == pd + rho*gh + pRef;
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(thermo->psi()*p))
/fvc::domainIntegrate(thermo->psi());
}
rho = thermo->rho(); rho = thermo->rho();
rho.relax(); rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
<< endl; << endl;
pd == p - (rho*gh + pRef);
} }

View File

@ -0,0 +1,3 @@
reactingParcelFoam.C
EXE = $(FOAM_APPBIN)/reactingParcelFoam

View File

@ -0,0 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl;
BasicReactingCloud<specieReactingProperties> parcels
(
"reactingCloud1",
rho,
U,
g,
thermo()
);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,10 +34,10 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "hCombustionThermo.H" #include "hCombustionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "basicReactingCloud.H" #include "BasicReactingCloud.H"
#include "chemistryModel.H" #include "chemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "ReactingCloudThermoTypes.H" #include "reactingThermoTypes.H"
#include "radiationModel.H" #include "radiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -0,0 +1,3 @@
trackedReactingParcelFoam.C
EXE = $(FOAM_APPBIN)/trackedReactingParcelFoam

View File

@ -0,0 +1,38 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I${LIB_SRC}/meshTools/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/lagrangian/coalCombustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lcompressibleRASModels \
-lcompressibleLESModels \
-llagrangian \
-llagrangianIntermediate \
-lspecie \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lthermophysicalFunctions \
-lcombustionThermophysicalModels \
-lchemistryModel \
-lradiation \
-lODE

View File

@ -0,0 +1,47 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
rho.dimensionedInternalField()*g
+ reactingParcels.SU()
);
UEqn.relax();
tmp<volScalarField> trAU;
tmp<volTensorField> trTU;
if (pressureImplicitPorosity)
{
tmp<volTensorField> tTU = tensor(I)*UEqn.A();
pZones.addResistance(UEqn, tTU());
trTU = inv(tTU());
trTU().rename("rAU");
volVectorField gradp = fvc::grad(p);
for (int UCorr=0; UCorr<nUCorr; UCorr++)
{
U = trTU() & (UEqn.H() - gradp);
}
U.correctBoundaryConditions();
}
else
{
pZones.addResistance(UEqn);
solve
(
UEqn == -fvc::grad(p)
);
trAU = 1.0/UEqn.A();
trAU().rename("rAU");
}
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View File

@ -0,0 +1,46 @@
tmp<fv::convectionScheme<scalar> > mvConvection
(
fv::convectionScheme<scalar>::New
(
mesh,
fields,
phi,
mesh.divScheme("div(phi,Yi_h)")
)
);
{
label inertIndex = -1;
volScalarField Yt = 0.0*Y[0];
for (label i=0; i<Y.size(); i++)
{
if (Y[i].name() != inertSpecie)
{
volScalarField& Yi = Y[i];
solve
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(turbulence->muEff(), Yi)
==
reactingParcels.Srho(i)
+ kappa*chemistry.RR(i)().dimensionedInternalField()
+ pointMassSources.Su(i)
);
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
}

View File

@ -0,0 +1,48 @@
{
tmp<volScalarField> tdQ
(
new volScalarField
(
IOobject
(
"dQ",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"zero",
dimensionSet(1, -3, -1, 0, 0, 0, 0),
0.0
)
)
);
scalarField& dQ = tdQ();
scalarField cp(dQ.size(), 0.0);
forAll(Y, i)
{
volScalarField RRi = chemistry.RR(i);
forAll(h, celli)
{
scalar Ti = T[celli];
cp[celli] += Y[i][celli]*chemistry.specieThermo()[i].Cp(Ti);
scalar hi = chemistry.specieThermo()[i].h(Ti);
scalar RR = RRi[celli];
dQ[celli] -= hi*RR;
}
}
forAll(dQ, celli)
{
dQ[celli] /= cp[celli];
}
tdQ().write();
}

View File

@ -0,0 +1,25 @@
{
Info << "Solving chemistry" << endl;
chemistry.solve
(
runTime.value() - runTime.deltaT().value(),
runTime.deltaT().value()
);
// turbulent time scale
if (turbulentReaction)
{
DimensionedField<scalar, volMesh> tk =
Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon());
DimensionedField<scalar, volMesh> tc =
chemistry.tc()().dimensionedInternalField();
// Chalmers PaSR model
kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
}
else
{
kappa = 1.0;
}
}

View File

@ -0,0 +1,9 @@
Info<< "\nConstructing reacting cloud" << endl;
BasicTrackedReactingCloud<specieReactingProperties> reactingParcels
(
"reactingCloud1",
rho,
U,
g,
thermo()
);

View File

@ -0,0 +1,111 @@
Info<< "Reading thermophysical properties" << nl << endl;
autoPtr<hCombustionThermo> thermo
(
hCombustionThermo::New(mesh)
);
combustionMixture& composition = thermo->composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo->lookup("inertSpecie"));
volScalarField& p = thermo->p();
volScalarField& h = thermo->h();
const volScalarField& T = thermo->T();
const volScalarField& psi = thermo->psi();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
);
Info<< "Reading field U" << nl << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "compressibleCreatePhi.H"
DimensionedField<scalar, volMesh> kappa
(
IOobject
(
"kappa",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimless, 0.0)
);
Info<< "Creating turbulence model" << nl << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
)
);
Info<< "Creating field DpDt" << nl << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info << "Constructing chemical mechanism" << nl << endl;
chemistryModel chemistry
(
thermo(),
rho
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll (Y, i)
{
fields.add(Y[i]);
}
fields.add(h);
Info<< "Creating porous zones" << nl << endl;
porousZones pZones(mesh);
Switch pressureImplicitPorosity(false);
label nUCorr = 0;
if (pZones.size())
{
// nUCorrectors for pressureImplicitPorosity
if (mesh.solutionDict().subDict("PISO").found("nUCorrectors"))
{
mesh.solutionDict().subDict("PISO").lookup("nUCorrectors")
>> nUCorr;
}
if (nUCorr > 0)
{
pressureImplicitPorosity = true;
}
}

View File

@ -0,0 +1,8 @@
Info<< "\nConstructing multi-component mass flow rate point sources" << endl;
timeActivatedExplicitMulticomponentPointSource pointMassSources
(
"pointMassSources",
mesh,
Y,
dimMass/dimVolume/dimTime
);

View File

@ -0,0 +1,20 @@
{
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
+ reactingParcels.Sh()
+ radiation->Sh(thermo())
);
hEqn.relax();
hEqn.solve();
thermo->correct();
radiation->correct();
}

View File

@ -0,0 +1,110 @@
rho = thermo->rho();
if (pressureImplicitPorosity)
{
U = trTU()&UEqn.H();
}
else
{
U = trAU()*UEqn.H();
}
if (transonic)
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(thermo->psi())
*(
(fvc::interpolate(U) & mesh.Sf())
// + fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> lapTerm;
if (pressureImplicitPorosity)
{
lapTerm = fvm::laplacian(rho*trTU(), p);
}
else
{
lapTerm = fvm::laplacian(rho*trAU(), p);
}
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- lapTerm()
==
reactingParcels.Srho()
+ pointMassSources.Su()
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi == pEqn.flux();
}
}
}
else
{
phi =
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(trAU(), rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
tmp<fvScalarMatrix> lapTerm;
if (pressureImplicitPorosity)
{
lapTerm = fvm::laplacian(rho*trTU(), p);
}
else
{
lapTerm = fvm::laplacian(rho*trAU(), p);
}
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- lapTerm()
==
reactingParcels.Srho()
+ pointMassSources.Su()
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
if (pressureImplicitPorosity)
{
U -= trTU()&fvc::grad(p);
}
else
{
U -= trAU()*fvc::grad(p);
}
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -0,0 +1,22 @@
Info<< "Reading chemistry properties\n" << endl;
IOdictionary chemistryProperties
(
IOobject
(
"chemistryProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
Switch turbulentReaction(chemistryProperties.lookup("turbulentReaction"));
dimensionedScalar Cmix("Cmix", dimless, 1.0);
if (turbulentReaction)
{
chemistryProperties.lookup("Cmix") >> Cmix;
}

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Global
rhoEqn
Description
Solve the continuity for density.
\*---------------------------------------------------------------------------*/
{
solve
(
fvm::ddt(rho)
+ fvc::div(phi)
==
reactingParcels.Srho()
+ pointMassSources.Su()
);
}
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "turbulenceModel.H"
#include "BasicTrackedReactingCloud.H"
#include "chemistryModel.H"
#include "chemistrySolver.H"
#include "reactingThermoTypes.H"
#include "radiationModel.H"
#include "porousZones.H"
#include "timeActivatedExplicitMulticomponentPointSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "readChemistryProperties.H"
#include "readEnvironmentalProperties.H"
#include "createFields.H"
#include "createRadiationModel.H"
#include "createClouds.H"
#include "createMulticomponentPointSources.H"
#include "readPISOControls.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
reactingParcels.evolve();
reactingParcels.info();
#include "chemistry.H"
#include "rhoEqn.H"
// --- PIMPLE loop
for (int ocorr=1; ocorr<=nOuterCorr; ocorr++)
{
#include "UEqn.H"
#include "YEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
#include "hEqn.H"
#include "pEqn.H"
}
Info<< "T gas min/max = " << min(T).value() << ", "
<< max(T).value() << endl;
}
turbulence->correct();
rho = thermo->rho();
if (runTime.write())
{
#include "additionalOutput.H"
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return(0);
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -178,7 +178,6 @@ void writeAllDataBinary
} }
template<class Type> template<class Type>
void writeAllFaceData void writeAllFaceData
( (
@ -275,7 +274,7 @@ template<class Type>
bool writePatchField bool writePatchField
( (
const Foam::Field<Type>& pf, const Foam::Field<Type>& pf,
const Foam::label patchI, const Foam::label patchi,
const Foam::label ensightPatchI, const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet, const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp, const Foam::ensightMesh::nFacePrimitives& nfp,
@ -335,7 +334,7 @@ template<class Type>
bool writePatchFieldBinary bool writePatchFieldBinary
( (
const Foam::Field<Type>& pf, const Foam::Field<Type>& pf,
const Foam::label patchI, const Foam::label patchi,
const Foam::label ensightPatchI, const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet, const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp, const Foam::ensightMesh::nFacePrimitives& nfp,
@ -406,34 +405,27 @@ void writePatchField
const Time& runTime = eMesh.mesh().time(); const Time& runTime = eMesh.mesh().time();
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets(); const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const HashTable<labelList>& allPatchNames = eMesh.allPatchNames(); const wordList& allPatchNames = eMesh.allPatchNames();
const HashTable<label>& patchIndices = eMesh.patchIndices(); const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
label patchI = -1;
if (patchIndices.found(patchName))
{
patchI = patchIndices.find(patchName)();
}
label ensightPatchI = eMesh.patchPartOffset(); label ensightPatchI = eMesh.patchPartOffset();
for label patchi = -1;
(
HashTable<labelList>::const_iterator iter = forAll(allPatchNames, i)
allPatchNames.begin();
iter != allPatchNames.end();
++iter
)
{ {
if (iter.key() == patchName) break; if (allPatchNames[i] == patchName)
{
patchi = i;
break;
}
ensightPatchI++; ensightPatchI++;
} }
const labelList& patchProcessors = allPatchNames.find(patchName)(); const labelList& patchProcessors = allPatchProcs[patchi];
word pfName = patchName + '.' + fieldName; word pfName = patchName + '.' + fieldName;
@ -472,14 +464,14 @@ void writePatchField
ensightFile << pTraits<Type>::typeName << nl; ensightFile << pTraits<Type>::typeName << nl;
} }
if (patchI >= 0) if (patchi >= 0)
{ {
writePatchField writePatchField
( (
pf, pf,
patchI, patchi,
ensightPatchI, ensightPatchI,
boundaryFaceSets[patchI], boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
ensightFile ensightFile
@ -507,6 +499,7 @@ void writePatchField
} }
} }
template<class Type> template<class Type>
void ensightFieldAscii void ensightFieldAscii
( (
@ -527,8 +520,8 @@ void ensightFieldAscii
const cellSets& meshCellSets = eMesh.meshCellSets(); const cellSets& meshCellSets = eMesh.meshCellSets();
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets(); const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const HashTable<labelList>& allPatchNames = eMesh.allPatchNames(); const wordList& allPatchNames = eMesh.allPatchNames();
const HashTable<label>& patchIndices = eMesh.patchIndices(); const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
const wordHashSet& patchNames = eMesh.patchNames(); const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
@ -623,30 +616,23 @@ void ensightFieldAscii
label ensightPatchI = eMesh.patchPartOffset(); label ensightPatchI = eMesh.patchPartOffset();
for forAll(allPatchNames, patchi)
(
HashTable<labelList>::const_iterator iter = allPatchNames.begin();
iter != allPatchNames.end();
++iter
)
{ {
const word& patchName = iter.key(); const word& patchName = allPatchNames[patchi];
const labelList& patchProcessors = iter(); const labelList& patchProcessors = allPatchProcs[patchi];
if (patchNames.empty() || patchNames.found(patchName)) if (patchNames.empty() || patchNames.found(patchName))
{ {
if (patchIndices.found(patchName)) if (mesh.boundary()[patchi].size())
{ {
label patchI = patchIndices.find(patchName)();
if if
( (
writePatchField writePatchField
( (
vf.boundaryField()[patchI], vf.boundaryField()[patchi],
patchI, patchi,
ensightPatchI, ensightPatchI,
boundaryFaceSets[patchI], boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
ensightFile ensightFile
@ -708,8 +694,8 @@ void ensightFieldBinary
const cellSets& meshCellSets = eMesh.meshCellSets(); const cellSets& meshCellSets = eMesh.meshCellSets();
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets(); const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const HashTable<labelList>& allPatchNames = eMesh.allPatchNames(); const wordList& allPatchNames = eMesh.allPatchNames();
const HashTable<label>& patchIndices = eMesh.patchIndices(); const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
const wordHashSet& patchNames = eMesh.patchNames(); const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
@ -726,7 +712,11 @@ void ensightFieldBinary
{ {
// set the filename of the ensight file // set the filename of the ensight file
fileName ensightFileName(timeFile + "." + fieldObject.name()); fileName ensightFileName(timeFile + "." + fieldObject.name());
ensightFilePtr = new std::ofstream((postProcPath/ensightFileName).c_str(), ios_base::out | ios_base::binary | ios_base::trunc); ensightFilePtr = new std::ofstream
(
(postProcPath/ensightFileName).c_str(),
ios_base::out | ios_base::binary | ios_base::trunc
);
// Check on file opened? // Check on file opened?
} }
@ -787,38 +777,62 @@ void ensightFieldBinary
} }
} }
writeAllDataBinary("penta6", vf, prisms, meshCellSets.nPrisms, ensightFile); writeAllDataBinary
writeAllDataBinary("pyramid5", vf, pyrs, meshCellSets.nPyrs, ensightFile); (
writeAllDataBinary("tetra4", vf, tets, meshCellSets.nTets, ensightFile); "penta6",
writeAllDataBinary("nfaced", vf, polys, meshCellSets.nPolys, ensightFile); vf,
prisms,
meshCellSets.nPrisms,
ensightFile
);
writeAllDataBinary
(
"pyramid5",
vf,
pyrs,
meshCellSets.nPyrs,
ensightFile
);
writeAllDataBinary
(
"tetra4",
vf,
tets,
meshCellSets.nTets,
ensightFile
);
writeAllDataBinary
(
"nfaced",
vf,
polys,
meshCellSets.nPolys,
ensightFile
);
} }
label ensightPatchI = eMesh.patchPartOffset(); label ensightPatchI = eMesh.patchPartOffset();
for forAll(allPatchNames, patchi)
(
HashTable<labelList>::const_iterator iter = allPatchNames.begin();
iter != allPatchNames.end();
++iter
)
{ {
const word& patchName = iter.key(); const word& patchName = allPatchNames[patchi];
const labelList& patchProcessors = iter(); const labelList& patchProcessors = allPatchProcs[patchi];
if (patchNames.empty() || patchNames.found(patchName)) if (patchNames.empty() || patchNames.found(patchName))
{ {
if (patchIndices.found(patchName)) if (mesh.boundary()[patchi].size())
{ {
label patchI = patchIndices.find(patchName)();
if if
( (
writePatchFieldBinary writePatchFieldBinary
( (
vf.boundaryField()[patchI], vf.boundaryField()[patchi],
patchI, patchi,
ensightPatchI, ensightPatchI,
boundaryFaceSets[patchI], boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors, patchProcessors,
ensightFile ensightFile
@ -859,6 +873,7 @@ void ensightFieldBinary
} }
} }
template<class Type> template<class Type>
void ensightField void ensightField
( (

View File

@ -28,6 +28,7 @@ License
#include "Time.H" #include "Time.H"
#include "ensightMesh.H" #include "ensightMesh.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "globalMeshData.H"
#include "PstreamCombineReduceOps.H" #include "PstreamCombineReduceOps.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "cellModeller.H" #include "cellModeller.H"
@ -40,43 +41,37 @@ License
namespace Foam namespace Foam
{ {
//- Proxy-class to hold the patch processor list combination operator
class concatPatchNames class concatPatchProcs
{
public:
void operator()
(
HashTable<labelList>& x,
const HashTable<labelList>& y
) const
{ {
forAllConstIter(HashTable<labelList>, y, iter)
public:
void operator()
(
List<labelList>& x,
const List<labelList>& y
) const
{ {
HashTable<labelList>::iterator xiter = x.find(iter.key()); forAll(y, i)
if (xiter == x.end())
{ {
x.insert(iter.key(), iter()); const labelList& yPatches = y[i];
}
else
{
labelList& xPatches = xiter();
const labelList& yPatches = iter();
label offset = xPatches.size(); if (yPatches.size())
xPatches.setSize(offset + yPatches.size());
forAll(yPatches, i)
{ {
xPatches[i + offset] = yPatches[i]; labelList& xPatches = x[i];
label offset = xPatches.size();
xPatches.setSize(offset + yPatches.size());
forAll(yPatches, i)
{
xPatches[i + offset] = yPatches[i];
}
} }
} }
} }
} };
};
} // End namespace Foam } // End namespace Foam
@ -95,7 +90,7 @@ Foam::ensightMesh::ensightMesh
meshCellSets_(mesh_.nCells()), meshCellSets_(mesh_.nCells()),
boundaryFaceSets_(mesh_.boundary().size()), boundaryFaceSets_(mesh_.boundary().size()),
allPatchNames_(0), allPatchNames_(0),
patchIndices_(0), allPatchProcs_(0),
patchNames_(0), patchNames_(0),
nPatchPrims_(0) nPatchPrims_(0)
{ {
@ -109,32 +104,24 @@ Foam::ensightMesh::ensightMesh
if (!args.optionFound("noPatches")) if (!args.optionFound("noPatches"))
{ {
forAll (mesh_.boundaryMesh(), patchI) allPatchNames_ = wordList::subList
{ (
if mesh_.boundaryMesh().names(), mesh_.boundary().size()
( - mesh_.globalData().processorPatches().size()
typeid(mesh_.boundaryMesh()[patchI]) );
!= typeid(processorPolyPatch)
)
{
if (!allPatchNames_.found(mesh_.boundaryMesh()[patchI].name()))
{
allPatchNames_.insert
(
mesh_.boundaryMesh()[patchI].name(),
labelList(1, Pstream::myProcNo())
);
patchIndices_.insert allPatchProcs_.setSize(allPatchNames_.size());
(
mesh_.boundaryMesh()[patchI].name(), forAll (allPatchProcs_, patchi)
patchI {
); if (mesh_.boundary()[patchi].size())
} {
allPatchProcs_[patchi].setSize(1);
allPatchProcs_[patchi][0] = Pstream::myProcNo();
} }
} }
combineReduce(allPatchNames_, concatPatchNames()); combineReduce(allPatchProcs_, concatPatchProcs());
if (args.optionFound("patches")) if (args.optionFound("patches"))
{ {
@ -142,7 +129,7 @@ Foam::ensightMesh::ensightMesh
if (patchNameList.empty()) if (patchNameList.empty())
{ {
patchNameList = allPatchNames_.toc(); patchNameList = allPatchNames_;
} }
forAll (patchNameList, i) forAll (patchNameList, i)
@ -230,15 +217,15 @@ Foam::ensightMesh::ensightMesh
if (!args.optionFound("noPatches")) if (!args.optionFound("noPatches"))
{ {
forAll (mesh.boundary(), patchI) forAll (mesh.boundary(), patchi)
{ {
if (mesh.boundary()[patchI].size()) if (mesh.boundary()[patchi].size())
{ {
const polyPatch& p = mesh.boundaryMesh()[patchI]; const polyPatch& p = mesh.boundaryMesh()[patchi];
labelList& tris = boundaryFaceSets_[patchI].tris; labelList& tris = boundaryFaceSets_[patchi].tris;
labelList& quads = boundaryFaceSets_[patchI].quads; labelList& quads = boundaryFaceSets_[patchi].quads;
labelList& polys = boundaryFaceSets_[patchI].polys; labelList& polys = boundaryFaceSets_[patchi].polys;
tris.setSize(p.size()); tris.setSize(p.size());
quads.setSize(p.size()); quads.setSize(p.size());
@ -274,21 +261,19 @@ Foam::ensightMesh::ensightMesh
} }
forAllConstIter(HashTable<labelList>, allPatchNames_, iter) forAll(allPatchNames_, patchi)
{ {
const word& patchName = iter.key(); const word& patchName = allPatchNames_[patchi];
nFacePrimitives nfp; nFacePrimitives nfp;
if (patchNames_.empty() || patchNames_.found(patchName)) if (patchNames_.empty() || patchNames_.found(patchName))
{ {
if (patchIndices_.found(patchName)) if (mesh.boundary()[patchi].size())
{ {
label patchI = patchIndices_.find(patchName)(); nfp.nPoints = mesh.boundaryMesh()[patchi].localPoints().size();
nfp.nTris = boundaryFaceSets_[patchi].tris.size();
nfp.nPoints = mesh.boundaryMesh()[patchI].localPoints().size(); nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nTris = boundaryFaceSets_[patchI].tris.size(); nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
nfp.nQuads = boundaryFaceSets_[patchI].quads.size();
nfp.nPolys = boundaryFaceSets_[patchI].polys.size();
} }
} }
@ -1052,13 +1037,13 @@ void Foam::ensightMesh::writeAscii
label ensightPatchI = patchPartOffset_; label ensightPatchI = patchPartOffset_;
forAllConstIter(HashTable<labelList>, allPatchNames_, iter) forAll(allPatchNames_, patchi)
{ {
const labelList& patchProcessors = iter(); const word& patchName = allPatchNames_[patchi];
const labelList& patchProcessors = allPatchProcs_[patchi];
if (patchNames_.empty() || patchNames_.found(iter.key())) if (patchNames_.empty() || patchNames_.found(patchName))
{ {
const word& patchName = iter.key();
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
const labelList *trisPtr = NULL; const labelList *trisPtr = NULL;
@ -1068,14 +1053,13 @@ void Foam::ensightMesh::writeAscii
const pointField *patchPointsPtr = NULL; const pointField *patchPointsPtr = NULL;
const faceList *patchFacesPtr = NULL; const faceList *patchFacesPtr = NULL;
if (patchIndices_.found(iter.key())) if (mesh_.boundary()[patchi].size())
{ {
label patchI = patchIndices_.find(iter.key())(); const polyPatch& p = mesh_.boundaryMesh()[patchi];
const polyPatch& p = mesh_.boundaryMesh()[patchI];
trisPtr = &boundaryFaceSets_[patchI].tris; trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchI].quads; quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchI].polys; polysPtr = &boundaryFaceSets_[patchi].polys;
patchPointsPtr = &(p.localPoints()); patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces()); patchFacesPtr = &(p.localFaces());
@ -1265,7 +1249,7 @@ void Foam::ensightMesh::writeBinary
{ {
writeEnsDataBinary("part",ensightGeometryFile); writeEnsDataBinary("part",ensightGeometryFile);
writeEnsDataBinary(1,ensightGeometryFile); writeEnsDataBinary(1,ensightGeometryFile);
writeEnsDataBinary("FOAM cells",ensightGeometryFile); writeEnsDataBinary("internalMesh",ensightGeometryFile);
writeEnsDataBinary("coordinates",ensightGeometryFile); writeEnsDataBinary("coordinates",ensightGeometryFile);
writeEnsDataBinary(nPoints,ensightGeometryFile); writeEnsDataBinary(nPoints,ensightGeometryFile);
@ -1379,14 +1363,14 @@ void Foam::ensightMesh::writeBinary
label ensightPatchI = patchPartOffset_; label ensightPatchI = patchPartOffset_;
label iCount = 0; label iCount = 0;
forAllConstIter(HashTable<labelList>, allPatchNames_, iter) forAll(allPatchNames_, patchi)
{ {
iCount ++; iCount ++;
const labelList& patchProcessors = iter(); const word& patchName = allPatchNames_[patchi];
const labelList& patchProcessors = allPatchProcs_[patchi];
if (patchNames_.empty() || patchNames_.found(iter.key())) if (patchNames_.empty() || patchNames_.found(patchName))
{ {
const word& patchName = iter.key();
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
const labelList *trisPtr = NULL; const labelList *trisPtr = NULL;
@ -1396,14 +1380,13 @@ void Foam::ensightMesh::writeBinary
const pointField *patchPointsPtr = NULL; const pointField *patchPointsPtr = NULL;
const faceList *patchFacesPtr = NULL; const faceList *patchFacesPtr = NULL;
if (patchIndices_.found(iter.key())) if (mesh_.boundary()[patchi].size())
{ {
label patchI = patchIndices_.find(iter.key())(); const polyPatch& p = mesh_.boundaryMesh()[patchi];
const polyPatch& p = mesh_.boundaryMesh()[patchI];
trisPtr = &boundaryFaceSets_[patchI].tris; trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchI].quads; quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchI].polys; polysPtr = &boundaryFaceSets_[patchi].polys;
patchPointsPtr = &(p.localPoints()); patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces()); patchFacesPtr = &(p.localFaces());
@ -1424,7 +1407,7 @@ void Foam::ensightMesh::writeBinary
writeEnsDataBinary("part",ensightGeometryFile); writeEnsDataBinary("part",ensightGeometryFile);
writeEnsDataBinary(ensightPatchI++,ensightGeometryFile); writeEnsDataBinary(ensightPatchI++,ensightGeometryFile);
//writeEnsDataBinary(patchName.c_str(),ensightGeometryFile); //writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
writeEnsDataBinary(iter.key().c_str(),ensightGeometryFile); writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
writeEnsDataBinary("coordinates",ensightGeometryFile); writeEnsDataBinary("coordinates",ensightGeometryFile);
writeEnsDataBinary(nfp.nPoints,ensightGeometryFile); writeEnsDataBinary(nfp.nPoints,ensightGeometryFile);

View File

@ -91,9 +91,9 @@ class ensightMesh
List<faceSets> boundaryFaceSets_; List<faceSets> boundaryFaceSets_;
HashTable<labelList> allPatchNames_; wordList allPatchNames_;
HashTable<label> patchIndices_; List<labelList> allPatchProcs_;
wordHashSet patchNames_; wordHashSet patchNames_;
@ -269,14 +269,14 @@ public:
return boundaryFaceSets_; return boundaryFaceSets_;
} }
const HashTable<labelList>& allPatchNames() const const wordList& allPatchNames() const
{ {
return allPatchNames_; return allPatchNames_;
} }
const HashTable<label>& patchIndices() const const List<labelList>& allPatchProcs() const
{ {
return patchIndices_; return allPatchProcs_;
} }
const wordHashSet& patchNames() const const wordHashSet& patchNames() const

View File

@ -90,6 +90,9 @@ Usage
The quoting is required to avoid shell expansions and to pass the The quoting is required to avoid shell expansions and to pass the
information as a single argument. information as a single argument.
@param -useTimeName \n
use the time index in the VTK file name instead of the time index
Note Note
mesh subset is handled by vtkMesh. Slight inconsistency in mesh subset is handled by vtkMesh. Slight inconsistency in
interpolation: on the internal field it interpolates the whole volfield interpolation: on the internal field it interpolates the whole volfield
@ -242,6 +245,7 @@ int main(int argc, char *argv[])
argList::validOptions.insert("excludePatches","patches to exclude"); argList::validOptions.insert("excludePatches","patches to exclude");
argList::validOptions.insert("noFaceZones",""); argList::validOptions.insert("noFaceZones","");
argList::validOptions.insert("noLinks",""); argList::validOptions.insert("noLinks","");
argList::validOptions.insert("useTimeName","");
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
@ -250,6 +254,7 @@ int main(int argc, char *argv[])
bool doFaceZones = !args.optionFound("noFaceZones"); bool doFaceZones = !args.optionFound("noFaceZones");
bool doLinks = !args.optionFound("noLinks"); bool doLinks = !args.optionFound("noLinks");
bool binary = !args.optionFound("ascii"); bool binary = !args.optionFound("ascii");
bool useTimeName = args.optionFound("useTimeName");
if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4)) if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
{ {
@ -359,6 +364,16 @@ int main(int argc, char *argv[])
Info<< "Time: " << runTime.timeName() << endl; Info<< "Time: " << runTime.timeName() << endl;
word timeDesc = "";
if (useTimeName)
{
timeDesc = runTime.timeName();
}
else
{
timeDesc = name(runTime.timeIndex());
}
// Check for new polyMesh/ and update mesh, fvMeshSubset and cell // Check for new polyMesh/ and update mesh, fvMeshSubset and cell
// decomposition. // decomposition.
polyMesh::readUpdateState meshState = vMesh.readUpdate(); polyMesh::readUpdateState meshState = vMesh.readUpdate();
@ -388,7 +403,7 @@ int main(int argc, char *argv[])
( (
fvPath/set.name()/set.name() fvPath/set.name()/set.name()
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk" + ".vtk"
); );
@ -411,7 +426,7 @@ int main(int argc, char *argv[])
( (
fvPath/set.name()/set.name() fvPath/set.name()/set.name()
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk" + ".vtk"
); );
@ -548,7 +563,7 @@ int main(int argc, char *argv[])
( (
fvPath/vtkName fvPath/vtkName
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk" + ".vtk"
); );
@ -654,8 +669,8 @@ int main(int argc, char *argv[])
fvPath fvPath
/"surfaceFields" /"surfaceFields"
/"surfaceFields" /"surfaceFields"
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk" + ".vtk"
); );
@ -689,7 +704,7 @@ int main(int argc, char *argv[])
patchFileName = patchFileName =
fvPath/"allPatches"/cellSetName fvPath/"allPatches"/cellSetName
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk"; + ".vtk";
} }
else else
@ -697,7 +712,7 @@ int main(int argc, char *argv[])
patchFileName = patchFileName =
fvPath/"allPatches"/"allPatches" fvPath/"allPatches"/"allPatches"
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk"; + ".vtk";
} }
@ -767,7 +782,7 @@ int main(int argc, char *argv[])
patchFileName = patchFileName =
fvPath/pp.name()/cellSetName fvPath/pp.name()/cellSetName
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk"; + ".vtk";
} }
else else
@ -775,7 +790,7 @@ int main(int argc, char *argv[])
patchFileName = patchFileName =
fvPath/pp.name()/pp.name() fvPath/pp.name()/pp.name()
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk"; + ".vtk";
} }
@ -867,7 +882,7 @@ int main(int argc, char *argv[])
patchFileName = patchFileName =
fvPath/pp.name()/cellSetName fvPath/pp.name()/cellSetName
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk"; + ".vtk";
} }
else else
@ -875,7 +890,7 @@ int main(int argc, char *argv[])
patchFileName = patchFileName =
fvPath/pp.name()/pp.name() fvPath/pp.name()/pp.name()
+ "_" + "_"
+ name(timeI) + timeDesc
+ ".vtk"; + ".vtk";
} }
@ -931,7 +946,7 @@ int main(int argc, char *argv[])
fileName lagrFileName fileName lagrFileName
( (
fvPath/cloud::prefix/cloudDirs[i]/cloudDirs[i] fvPath/cloud::prefix/cloudDirs[i]/cloudDirs[i]
+ "_" + name(timeI) + ".vtk" + "_" + timeDesc + ".vtk"
); );
Info<< " Lagrangian: " << lagrFileName << endl; Info<< " Lagrangian: " << lagrFileName << endl;

View File

@ -0,0 +1,3 @@
particleTracks.C
EXE = $(FOAM_APPBIN)/particleTracks

View File

@ -0,0 +1,7 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-llagrangian

View File

@ -0,0 +1,22 @@
IOdictionary propsDict
(
IOobject
(
"particleTrackProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ
)
);
word cloudName(propsDict.lookup("cloudName"));
label sampleFrequency(readLabel(propsDict.lookup("sampleFrequency")));
// outputMode: compositeFile, filePerTrack
//word outputmode(propsDict.lookup("outputMode"))
label maxPositions(readLabel(propsDict.lookup("maxPositions")));
// outputFormat: raw, vtk
//word outputFormat(propsDict.lookup("outputFormat"));

View File

@ -0,0 +1,270 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
particleTracks
Description
Generates a VTK file of particle tracks for cases that were computed using
a tracked-parcel-type cloud
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Cloud.H"
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "timeSelector.H"
#include "OFstream.H"
#include "passiveParticle.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
# include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "Scanning times to determine track data" << nl << endl;
labelList maxIds(Pstream::nProcs(), -1);
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
IOobject origProcHeader
(
"origProc",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ
);
IOobject idHeader
(
"id",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ
);
if (idHeader.headerOk() && origProcHeader.headerOk())
{
IOField<label> origProc(origProcHeader);
IOField<label> id(idHeader);
forAll(id, i)
{
maxIds[origProc[i]] = max(maxIds[origProc[i]], id[i]);
}
}
}
Pstream::listCombineGather(maxIds, maxOp<label>());
Pstream::listCombineScatter(maxIds);
labelList numIds = maxIds + 1;
// calc starting ids for particles on each processor
List<label> startIds(numIds.size(), 0);
for (label i = 0; i < numIds.size()-1; i++)
{
startIds[i+1] += startIds[i] + numIds[i];
}
label nParticle = startIds[startIds.size()-1] + numIds[startIds.size()-1];
// number of tracks to generate
label nTracks = nParticle/sampleFrequency;
// storage for all particle tracks
List<DynamicList<vector> > allTracks(nTracks);
Info<< "\nGenerating " << nTracks << " particle tracks" << nl << endl;
forAll(timeDirs, timeI)
{
runTime.setTime(timeDirs[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;
IOobject positionsHeader
(
"positions",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
IOobject origProcHeader
(
"origProc",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
IOobject idHeader
(
"id",
runTime.timeName(),
cloud::prefix/cloudName,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if
(
positionsHeader.headerOk()
&& origProcHeader.headerOk()
&& idHeader.headerOk()
)
{
Info<< " Reading particle positions" << endl;
Cloud<passiveParticle> myCloud(mesh, cloudName, false);
Info<< " Reading particle id" << endl;
IOField<label> id(idHeader);
Info<< " Reading particle origProc" << endl;
IOField<label> origProc(origProcHeader);
// collect the track data on the master processor
label i = 0;
List<pointField> allPositions(Pstream::nProcs());
allPositions[Pstream::myProcNo()].setSize(myCloud.size());
forAllConstIter(Cloud<passiveParticle>, myCloud, iter)
{
allPositions[Pstream::myProcNo()][i++] = iter().position();
}
Pstream::gatherList(allPositions);
List<labelList> allIds(Pstream::nProcs());
allIds[Pstream::myProcNo()] = id;
Pstream::gatherList(allIds);
List<labelList> allOrigProcs(Pstream::nProcs());
allOrigProcs[Pstream::myProcNo()] = origProc;
Pstream::gatherList(allOrigProcs);
Info<< " Constructing tracks" << nl << endl;
if (Pstream::master())
{
forAll(allPositions, procI)
{
forAll(allPositions[procI], i)
{
label globalId =
startIds[allOrigProcs[procI][i]]
+ allIds[procI][i];
if (globalId % sampleFrequency == 0)
{
label trackId = globalId/sampleFrequency;
if (allTracks[trackId].size() < maxPositions)
{
allTracks[trackId].append
(
allPositions[procI][i]
);
}
}
}
}
}
}
else
{
Info<< " No particles read" << nl << endl;
}
}
if (Pstream::master())
{
Info<< "\nWriting particle tracks" << nl << endl;
OFstream vtkTracks("particleTracks.vtk");
// Total number of points in tracks + 1 per track
label nPoints = 0;
forAll(allTracks, trackI)
{
nPoints += allTracks[trackI].size();
}
vtkTracks
<< "# vtk DataFile Version 2.0" << nl
<< "particleTracks" << nl
<< "ASCII" << nl
<< "DATASET POLYDATA" << nl
<< "POINTS " << nPoints << " float" << nl;
// Write track points to file
forAll(allTracks, trackI)
{
forAll(allTracks[trackI], i)
{
const vector& pt = allTracks[trackI][i];
vtkTracks << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
}
}
// write track (line) connectivity to file
vtkTracks << "LINES " << nTracks << ' ' << nPoints+nTracks << nl;
// Write ids of track points to file
label globalPtI = 0;
forAll(allTracks, trackI)
{
vtkTracks << allTracks[trackI].size();
forAll(allTracks[trackI], i)
{
vtkTracks << ' ' << globalPtI;
globalPtI++;
}
vtkTracks << nl;
}
Info<< "end" << endl;
}
return 0;
}
// ************************************************************************* //

View File

@ -72,6 +72,7 @@ primitiveLists = primitives/Lists
$(primitiveLists)/boolList.C $(primitiveLists)/boolList.C
$(primitiveLists)/labelIOList.C $(primitiveLists)/labelIOList.C
$(primitiveLists)/scalarList.C $(primitiveLists)/scalarList.C
$(primitiveLists)/scalarIOList.C
$(primitiveLists)/vectorList.C $(primitiveLists)/vectorList.C
$(primitiveLists)/sphericalTensorList.C $(primitiveLists)/sphericalTensorList.C
$(primitiveLists)/symmTensorList.C $(primitiveLists)/symmTensorList.C

View File

@ -63,6 +63,21 @@ Foam::IOPtrList<T>::IOPtrList(const IOobject& io)
} }
template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const label s)
:
regIOobject(io),
PtrList<T>(s)
{
if (io.readOpt() != IOobject::NO_READ)
{
FatalErrorIn("IOPtrList<T>::IOPtrList(const IOobject&, const label)")
<< "NO_READ must be set if specifying size" << nl
<< exit(FatalError);
}
}
template<class T> template<class T>
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list) Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
: :

View File

@ -70,6 +70,9 @@ public:
//- Construct from IOobject //- Construct from IOobject
IOPtrList(const IOobject&); IOPtrList(const IOobject&);
//- Construct from IOobject with given size
IOPtrList(const IOobject&, const label);
//- Construct from IOobject and a PtrList //- Construct from IOobject and a PtrList
IOPtrList(const IOobject&, const PtrList<T>&); IOPtrList(const IOobject&, const PtrList<T>&);

View File

@ -22,27 +22,25 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Declaration of scalar IOList containers
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "basicReactingParcel.H" #include "scalarIOList.H"
#include "ReactingCloud.H" #include "addToRunTimeSelectionTable.H"
#include "SinglePhaseMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeCompositionModel(ReactingCloud<basicReactingParcel>); defineTemplateTypeNameAndDebugWithName(scalarIOList, "scalarList", 0);
defineTemplateTypeNameAndDebugWithName
// Add instances of composition model to the table
makeCompositionModelType
( (
SinglePhaseMixture, scalarListIOList,
ReactingCloud, "scalarListList",
basicReactingParcel 0
); );
}; }
// ************************************************************************* // // ************************************************************************* //

View File

@ -22,24 +22,30 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Typedef
Foam::scalarIOList
Description
Scalar container classes
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "basicKinematicParcel.H" #ifndef scalarIOList_H
#include "KinematicCloud.H" #define scalarIOList_H
#include "NoDrag.H" #include "scalarList.H"
#include "SphereDrag.H" #include "IOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeDragModel(KinematicCloud<basicKinematicParcel>); typedef IOList<scalar> scalarIOList;
typedef IOList<scalarList> scalarListIOList;
}
// Add instances of drag model to the table // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeDragModelType(NoDrag, KinematicCloud, basicKinematicParcel);
makeDragModelType(SphereDrag, KinematicCloud, basicKinematicParcel);
};
#endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -115,6 +115,28 @@ bool Foam::trackedParticle::move(trackedParticle::trackData& td)
} }
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
trackedParticle::trackData& td,
const label patchI
)
{
return false;
}
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
int&,
const label
)
{
return false;
}
void Foam::trackedParticle::hitWedgePatch void Foam::trackedParticle::hitWedgePatch
( (
const wedgePolyPatch&, const wedgePolyPatch&,

View File

@ -169,6 +169,21 @@ public:
bool move(trackData&); bool move(trackData&);
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions
bool hitPatch
(
const polyPatch&,
trackedParticle::trackData& td,
const label patchI
);
bool hitPatch
(
const polyPatch&,
int&,
const label patchI
);
//- Overridable function to handle the particle hitting a wedge //- Overridable function to handle the particle hitting a wedge
void hitWedgePatch void hitWedgePatch
( (

View File

@ -316,18 +316,32 @@ $(laplacianSchemes)/gaussLaplacianScheme/gaussLaplacianSchemes.C
finiteVolume/fvc/fvcMeshPhi.C finiteVolume/fvc/fvcMeshPhi.C
cfdTools/general/findRefCell/findRefCell.C general = cfdTools/general
cfdTools/general/adjustPhi/adjustPhi.C $(general)/findRefCell/findRefCell.C
cfdTools/general/bound/bound.C $(general)/adjustPhi/adjustPhi.C
cfdTools/general/porousMedia/porousZone.C $(general)/bound/bound.C
cfdTools/general/porousMedia/porousZones.C
cfdTools/general/MRF/MRFZone.C porousMedia = $(general)/porousMedia
cfdTools/general/MRF/MRFZones.C $(porousMedia)/porousZone.C
cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C $(porousMedia)/porousZones.C
cfdTools/general/fieldSources/timeActivatedExplicitSource/timeActivatedExplicitSource.C
cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C MRF = $(general)/MRF
cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C $(MRF)/MRFZone.C
cfdTools/general/SRF/SRFModel/rpm/rpm.C $(MRF)/MRFZones.C
cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
SRF = $(general)/SRF
$(SRF)/SRFModel/SRFModel/SRFModel.C
$(SRF)/SRFModel/SRFModel/newSRFModel.C
$(SRF)/SRFModel/rpm/rpm.C
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
$(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -0,0 +1,175 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeActivatedExplicitCellSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::timeActivatedExplicitCellSource::updateCellSet()
{
cellSelector_->applyToSet(topoSetSource::NEW, selectedCellSet_);
Info<< " " << name_ << ": selected "
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
<< " cells" << nl << endl;
V_ = scalarField(selectedCellSet_.size(), 1.0);
if (volumeType_ == vtAbsolute)
{
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitCellSource::timeActivatedExplicitCellSource
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dims
)
:
timeActivatedExplicitSource(name, mesh, dims),
onValue_(readScalar(lookup("onValue"))),
offValue_(readScalar(lookup("offValue"))),
V_(0),
cellSource_(lookup("cellSource")),
cellSelector_
(
topoSetSource::New
(
cellSource_,
mesh,
subDict(cellSource_ + "Coeffs")
)
),
selectedCellSet_
(
mesh,
name + "SourceCellSet",
mesh.nCells()/10 + 1 // Reasonable size estimate.
)
{
// Create the cell set
updateCellSet();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::timeActivatedExplicitCellSource::onValue() const
{
return onValue_;
}
Foam::scalar Foam::timeActivatedExplicitCellSource::offValue() const
{
return offValue_;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitCellSource::Su()
{
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
scalar value = offValue_;
if
(
active_
&& (runTime_.time().value() >= timeStart_)
&& (runTime_.time().value() <= timeStart_ + duration_)
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
updateCellSet();
}
value = onValue_;
}
DimensionedField<scalar, volMesh>& sourceField = tSource();
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
sourceField[iter.key()] = value/V_[i++];
}
return tSource;
}
bool Foam::timeActivatedExplicitCellSource::read()
{
if (timeActivatedExplicitSource::read())
{
lookup("onValue") >> onValue_;
lookup("offValue") >> offValue_;
lookup("cellSource") >> cellSource_;
cellSelector_ =
topoSetSource::New
(
cellSource_,
mesh_,
subDict(cellSource_ + "Coeffs")
);
updateCellSet();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,143 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeActivatedExplicitSourceNew
Description
Creates a cell set source that is activated at a given time, and remains
active for a specified duration. The source value is either in specific
(XX/m3) or absolute (XX) units.
SourceFiles
timeActivatedExplicitCellSource.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitCellSource_H
#define timeActivatedExplicitCellSource_H
#include "timeActivatedExplicitSource.H"
#include "topoSetSource.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitCellSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitCellSource
:
public timeActivatedExplicitSource
{
private:
// Private member functions
//- Update the cell set that the source is acting on
void updateCellSet();
// Private Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitCellSource(const timeActivatedExplicitCellSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitCellSource&);
protected:
// Protected data
// Source properties
//- Value when "on"
scalar onValue_;
//- Value when "off"
scalar offValue_;
// Cell set
//- Cell volumes
scalarList V_;
//- Name of cell source (XXXToCell)
word cellSource_;
//- Method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- Set of selected cells
cellSet selectedCellSet_;
public:
// Constructors
//- Construct from explicit source name and mesh
timeActivatedExplicitCellSource
(
const word&,
const fvMesh&,
const dimensionSet&
);
// Member Functions
// Access
//- Return the "on" value
virtual scalar onValue() const;
//- Return the "off" value
virtual scalar offValue() const;
//- Return a tmp field of the source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties()
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{}
Foam::pointSourceProperties::pointSourceProperties(const dictionary& dict)
:
name_(dict.name().name()),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
location_(dict.lookup("location")),
fieldData_(dict.lookup("fieldData"))
{}
Foam::pointSourceProperties::pointSourceProperties
(
const pointSourceProperties& psp
)
:
name_(psp.name_),
timeStart_(psp.timeStart_),
duration_(psp.duration_),
location_(psp.location_),
fieldData_(psp.fieldData_)
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointSourceProperties::operator=(const pointSourceProperties& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"pointSourceProperties::operator=(const pointSourceProperties&)"
) << "Attempted assignment to self" << nl
<< abort(FatalError);
}
// Set updated values
name_ = rhs.name_;
timeStart_ = rhs.timeStart_;
duration_ = rhs.duration_;
location_ = rhs.location_;
fieldData_ = rhs.fieldData_;}
// ************************************************************************* //

View File

@ -0,0 +1,158 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::pointSourceProperties
Description
Helper class to describe point source properties
SourceFiles
pointSourceProperties.C
\*---------------------------------------------------------------------------*/
#ifndef pointSourceProperties_H
#define pointSourceProperties_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointSourceProperties Declaration
\*---------------------------------------------------------------------------*/
class pointSourceProperties
{
protected:
// Protected data
typedef Tuple2<word, scalar> fieldNameValuePair;
//- Source name
word name_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Point location
point location_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
public:
// Constructors
//- Construct null
pointSourceProperties();
//- Construct from dictionary
pointSourceProperties(const dictionary& dict);
//- Construct from Istream
pointSourceProperties(Istream& is);
//- Copy constructor
pointSourceProperties(const pointSourceProperties&);
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the point location
inline const point& location() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the point location
inline point& location();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();
// Member Operators
void operator=(const pointSourceProperties&);
// IOstream operators
friend Istream& operator>>(Istream&, pointSourceProperties&);
friend Ostream& operator<<(Ostream&, const pointSourceProperties&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pointSourcePropertiesI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::pointSourceProperties::name() const
{
return name_;
}
inline Foam::scalar Foam::pointSourceProperties::timeStart() const
{
return timeStart_;
}
inline Foam::scalar Foam::pointSourceProperties::timeEnd() const
{
return timeStart_ + duration_;
}
inline Foam::scalar Foam::pointSourceProperties::duration() const
{
return duration_;
}
inline const Foam::point& Foam::pointSourceProperties::location() const
{
return location_;
}
inline const Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData() const
{
return fieldData_;
}
inline Foam::word& Foam::pointSourceProperties::name()
{
return name_;
}
inline Foam::scalar& Foam::pointSourceProperties::timeStart()
{
return timeStart_;
}
inline Foam::scalar& Foam::pointSourceProperties::duration()
{
return duration_;
}
inline Foam::point& Foam::pointSourceProperties::location()
{
return location_;
}
inline Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData()
{
return fieldData_;
}
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H"
#include "dictionaryEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties(Istream& is)
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{
is.check("pointSourceProperties(Istream&)");
const dictionaryEntry entry(dictionary::null, is);
name_ = entry.keyword();
entry.lookup("timeStart") >> timeStart_;
entry.lookup("duration") >> duration_;
entry.lookup("location") >> location_;
entry.lookup("fieldData") >> fieldData_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, pointSourceProperties& psp)
{
is.check("Istream& operator>>(Istream&, pointSourceProperties&)");
const dictionaryEntry entry(dictionary::null, is);
psp.name_ = entry.keyword();
entry.lookup("timeStart") >> psp.timeStart_;
entry.lookup("duration") >> psp.duration_;
entry.lookup("location") >> psp.location_;
entry.lookup("fieldData") >> psp.fieldData_;
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const pointSourceProperties& psp)
{
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
os << psp.name_ << nl << token::BEGIN_BLOCK << nl;
os.writeKeyword("timeStart") << psp.timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << psp.duration_ << token::END_STATEMENT << nl;
os.writeKeyword("location") << psp.location_ << token::END_STATEMENT << nl;
os.writeKeyword("fieldData") << psp.fieldData_ << token::END_STATEMENT << nl;
os << token::END_BLOCK << nl;
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,292 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "timeActivatedExplicitMulticomponentPointSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label
Foam::timeActivatedExplicitMulticomponentPointSource::carrierFieldId
(
const word& fieldName
)
{
forAll(carrierFields_, fieldI)
{
if (carrierFields_[fieldI].name() == fieldName)
{
return fieldI;
}
}
return -1;
}
void Foam::timeActivatedExplicitMulticomponentPointSource::updateAddressing()
{
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
bool foundCell = false;
label cid = mesh_.findCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
label cid = mesh_.findNearestCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find location " << psp.location() << " in mesh "
<< "for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
cellOwners_[sourceI] = cid;
}
fieldIds_[sourceI].setSize(psp.fieldData().size());
forAll(psp.fieldData(), fieldI)
{
const word& fieldName = psp.fieldData()[fieldI].first();
label cfid = carrierFieldId(fieldName);
if (cfid < 0)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find field " << fieldName << " in carrier "
<< "fields for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
fieldIds_[sourceI][fieldI] = cfid;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitMulticomponentPointSource::
timeActivatedExplicitMulticomponentPointSource
(
const word& name,
const fvMesh& mesh,
const PtrList<volScalarField>& carrierFields,
const dimensionSet& dims
)
:
IOdictionary
(
IOobject
(
name + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
name_(name),
mesh_(mesh),
runTime_(mesh.time()),
dimensions_(dims),
carrierFields_(carrierFields),
active_(lookup("active")),
pointSources_(lookup("pointSources")),
cellOwners_(pointSources_.size()),
fieldIds_(pointSources_.size())
{
// Initialise the field addressing
updateAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su
(
const label fieldI
)
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + carrierFields_[fieldI].name() + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
fieldIds_[sourceI][i] == fieldI
&& (runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su()
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "TotalSu",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
(runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
bool Foam::timeActivatedExplicitMulticomponentPointSource::read()
{
if (regIOobject::read())
{
lookup("active") >> active_;
lookup("pointSources") >> pointSources_;
cellOwners_.setSize(pointSources_.size());
updateAddressing();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::timeActivatedExplicitMulticomponentPointSourceNew
Description
Provides a mechanism to introduce point sources to a set of carrier fields.
Carrier fields are supplied on consruction, and interrogated to provide the
field indices of the sources.
Source values are assumed to be in <quantity>/s, and divided through by the
cell volumes before being returned, e.g. for a kg/s source
Properties are described in a <name>Properties dictionary
active true; // are sources active (true/false)
pointSources
(
source1 // source name
{
timeStart 0.0;
duration 1.0;
location (0 0 0);
fieldData
(
(H2O 0.1) // kg/s
(O2 0.05) // kg/s
);
}
source2 // source name
{
timeStart 0.5;
duration 2.0;
location (1 1 1);
fieldData
(
(NO 0.1) // kg/s
(CO2 0.05) // kg/s
(H2 0.001) // kg/s
);
}
);
SourceFiles
timeActivatedExplicitMulticomponentPointSourceNew.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitMulticomponentPointSource_H
#define timeActivatedExplicitMulticomponentPointSource_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitMulitcomponentPointSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitMulticomponentPointSource
:
public IOdictionary
{
protected:
// Protected data
//- Name of the source
word name_;
//- Reference to the mesh
const fvMesh& mesh_;
//- Reference to time database
const Time& runTime_;
//- Source dimensions
const dimensionSet& dimensions_;
//- Reference to the multicomponent carrier fields
const PtrList<volScalarField>& carrierFields_;
//- Active flag
bool active_;
//- List of point source properties
List<pointSourceProperties> pointSources_;
//- List of cell owners for point source locations
List<label> cellOwners_;
//- List of field ids for each source
List<labelList> fieldIds_;
// Protected Member Functions
//- Return the id of field given its name
label carrierFieldId(const word& fieldName);
//- Update the addressing between source and carrier fields
void updateAddressing();
//- Disallow default bitwise copy construct
timeActivatedExplicitMulticomponentPointSource
(
const timeActivatedExplicitMulticomponentPointSource&
);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitMulticomponentPointSource&);
public:
// Constructors
//- Construct from components
timeActivatedExplicitMulticomponentPointSource
(
const word&,
const fvMesh&,
const PtrList<volScalarField>&,
const dimensionSet&
);
// Member Functions
// Access
//- Return a tmp field of the source for field fieldI
virtual tmp<DimensionedField<scalar, volMesh> > Su
(
const label fieldI
);
//- Return a tmp field of the total source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -44,33 +44,11 @@ const Foam::NamedEnum<Foam::timeActivatedExplicitSource::volumeType, 2>
Foam::timeActivatedExplicitSource::volumeTypeNames_; Foam::timeActivatedExplicitSource::volumeTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::timeActivatedExplicitSource::updateCellSet()
{
cellSelector_->applyToSet(topoSetSource::NEW, selectedCellSet_);
Info<< " " << sourceName_ << ": selected "
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
<< " cells" << nl << endl;
V_ = scalarField(selectedCellSet_.size(), 1.0);
if (volumeType_ == vtAbsolute)
{
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitSource::timeActivatedExplicitSource Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
( (
const word& sourceName, const word& name,
const fvMesh& mesh, const fvMesh& mesh,
const dimensionSet& dims const dimensionSet& dims
) )
@ -79,51 +57,63 @@ Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
( (
IOobject IOobject
( (
sourceName + "Properties", name + "Properties",
mesh.time().constant(), mesh.time().constant(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
), ),
sourceName_(sourceName),
mesh_(mesh), mesh_(mesh),
runTime_(mesh.time()), runTime_(mesh.time()),
name_(name),
active_(lookup("active")),
dimensions_(dims), dimensions_(dims),
volumeType_(volumeTypeNames_.read(lookup("volumeType"))), volumeType_(volumeTypeNames_.read(lookup("volumeType"))),
timeStart_(readScalar(lookup("timeStart"))), timeStart_(readScalar(lookup("timeStart"))),
duration_(readScalar(lookup("duration"))), duration_(readScalar(lookup("duration")))
onValue_(readScalar(lookup("onValue"))), {}
offValue_(readScalar(lookup("offValue"))),
currentValue_(0.0),
V_(0),
cellSource_(lookup("cellSource")),
cellSelector_
(
topoSetSource::New
(
cellSource_,
mesh,
subDict(cellSource_ + "Coeffs")
)
),
selectedCellSet_
(
mesh,
sourceName + "SourceCellSet",
mesh.nCells()/10 + 1 // Reasonable size estimate.
)
{
// Create the cell set
updateCellSet();
// Initialise the value
update();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvMesh& Foam::timeActivatedExplicitSource::mesh() const
{
return mesh_;
}
const Foam::Time& Foam::timeActivatedExplicitSource::runTime() const
{
return runTime_;
}
const Foam::word& Foam::timeActivatedExplicitSource::name() const
{
return name_;
}
const Foam::Switch& Foam::timeActivatedExplicitSource::active() const
{
return active_;
}
const Foam::dimensionSet& Foam::timeActivatedExplicitSource::dimensions() const
{
return dimensions_;
}
const Foam::timeActivatedExplicitSource::volumeType&
Foam::timeActivatedExplicitSource::volume() const
{
return volumeType_;
}
Foam::scalar Foam::timeActivatedExplicitSource::timeStart() const Foam::scalar Foam::timeActivatedExplicitSource::timeStart() const
{ {
return timeStart_; return timeStart_;
@ -136,70 +126,22 @@ Foam::scalar Foam::timeActivatedExplicitSource::duration() const
} }
const Foam::dimensionedScalar
Foam::timeActivatedExplicitSource::currentValue() const
{
return dimensionedScalar
(
sourceName_,
dimensions_,
currentValue_
);
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitSource::Su() const
{
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
sourceName_ + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
DimensionedField<scalar, volMesh>& sourceField = tSource();
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
sourceField[iter.key()] = currentValue_/V_[i++];
}
return tSource;
}
bool Foam::timeActivatedExplicitSource::read() bool Foam::timeActivatedExplicitSource::read()
{ {
if (regIOobject::read()) if (regIOobject::read())
{ {
volumeType_ = volumeTypeNames_.read(lookup("volumeType")); lookup("active") >> active_;
lookup("timeStart") >> duration_; if (active_)
lookup("duration") >> duration_; {
lookup("onValue") >> onValue_; volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
lookup("offValue") >> offValue_; lookup("timeStart") >> duration_;
lookup("cellSource") >> cellSource_; lookup("duration") >> duration_;
cellSelector_ = return true;
topoSetSource::New }
( else
cellSource_, {
mesh_, return false;
subDict(cellSource_ + "Coeffs") }
);
updateCellSet();
return true;
} }
else else
{ {
@ -208,28 +150,6 @@ bool Foam::timeActivatedExplicitSource::read()
} }
void Foam::timeActivatedExplicitSource::update()
{
// Set the source value
if
(
(runTime_.time().value() >= timeStart_)
&& (runTime_.time().value() <= timeStart_ + duration_)
)
{
currentValue_ = onValue_;
}
else
{
currentValue_ = offValue_;
}
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
updateCellSet();
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -23,15 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::timeActivatedExplicitSourceNew Foam::timeActivatedExplicitSource
Description Description
Creates a cell set source that is activated at a given time, and remains Base class for field sources. Provides:
active for a specified duration. The source value is either in specific - name
(XX/m3) or absolute (XX) units. - references to mesh and time
- dimensions
- volume type
- startTime
- duration
- read (from <sourceName>Properties dictionary)
SourceFiles SourceFiles
timeActivatedExplicitSourceNew.C timeActivatedExplicitSource.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -40,8 +45,6 @@ SourceFiles
#include "IOdictionary.H" #include "IOdictionary.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "topoSetSource.H"
#include "cellSet.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "Time.H" #include "Time.H"
#include "NamedEnum.H" #include "NamedEnum.H"
@ -72,19 +75,19 @@ public:
private: private:
// Private member functions // Private Member Functions
//- Update the cell set that the source is acting on //- Disallow default bitwise copy construct
void updateCellSet(); timeActivatedExplicitSource(const timeActivatedExplicitSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitSource&);
protected: protected:
// Protected data // Protected data
//- Name of the source
word sourceName_;
//- Reference to the mesh //- Reference to the mesh
const fvMesh& mesh_; const fvMesh& mesh_;
@ -94,6 +97,12 @@ protected:
// Source properties // Source properties
//- Name of the source
word name_;
//- Active flag
Switch active_;
//- Dimensions //- Dimensions
const dimensionSet dimensions_; const dimensionSet dimensions_;
@ -106,39 +115,6 @@ protected:
//- Duration [s] //- Duration [s]
scalar duration_; scalar duration_;
//- Value when "on"
scalar onValue_;
//- Value when "off"
scalar offValue_;
//- Current source value
scalar currentValue_;
// Cell set
//- Cell volumes
scalarList V_;
//- Name of cell source (XXXToCell)
word cellSource_;
//- Method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- Set of selected cells
cellSet selectedCellSet_;
// Protected Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitSource(const timeActivatedExplicitSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitSource&);
public: public:
@ -157,24 +133,33 @@ public:
// Access // Access
//- Return the reference to the mesh
virtual const fvMesh& mesh() const;
//- Return the reference to the time database
virtual const Time& runTime() const;
//- Return the source name
virtual const word& name() const;
//- Return the active flag
virtual const Switch& active() const;
//- Return the dimensions
virtual const dimensionSet& dimensions() const;
//- Return the volume type
virtual const volumeType& volume() const;
//- Return the start time //- Return the start time
scalar timeStart() const; virtual scalar timeStart() const;
//- Return the duration //- Return the duration
scalar duration() const; virtual scalar duration() const;
//- Return the current value of the source
const dimensionedScalar currentValue() const;
//- Return a tmp field of the source
virtual tmp<DimensionedField<scalar, volMesh> > Su() const;
//- Read properties dictionary //- Read properties dictionary
virtual bool read(); virtual bool read();
//- Update
virtual void update();
}; };

View File

@ -79,6 +79,8 @@ Foam::porousZone::porousZone
D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero), D_("D", dimensionSet(0, -2, 0, 0, 0), tensor::zero),
F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero) F_("F", dimensionSet(0, -1, 0, 0, 0), tensor::zero)
{ {
Info<< "Creating porous zone: " << name_ << endl;
if (cellZoneID_ == -1 && !Pstream::parRun()) if (cellZoneID_ == -1 && !Pstream::parRun())
{ {
FatalErrorIn FatalErrorIn

View File

@ -21,7 +21,7 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gaussLaplacianScheme.H" #include "gaussLaplacianScheme.H"

View File

@ -45,7 +45,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
const labelList& faces = mesh.cells()[celli_]; const labelList& faces = mesh.cells()[celli_];
const vector& C = mesh.cellCentres()[celli_]; const vector& C = mesh.cellCentres()[celli_];
labelList faceList(0); DynamicList<label> faceList(10);
forAll(faces, i) forAll(faces, i)
{ {
label facei = faces[i]; label facei = faces[i];
@ -53,12 +53,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
if ((lam > 0) && (lam < 1.0)) if ((lam > 0) && (lam < 1.0))
{ {
label n = faceList.size(); faceList.append(facei);
faceList.setSize(n+1);
faceList[n] = facei;
} }
} }
faceList.shrink();
return faceList; return faceList;
} }
@ -75,7 +75,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
const labelList& faces = mesh.cells()[celli]; const labelList& faces = mesh.cells()[celli];
const vector& C = mesh.cellCentres()[celli]; const vector& C = mesh.cellCentres()[celli];
labelList faceList(0); DynamicList<label> faceList(10);
forAll(faces, i) forAll(faces, i)
{ {
label facei = faces[i]; label facei = faces[i];
@ -83,12 +83,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
if ((lam > 0) && (lam < 1.0)) if ((lam > 0) && (lam < 1.0))
{ {
label n = faceList.size(); faceList.append(facei);
faceList.setSize(n+1);
faceList[n] = facei;
} }
} }
faceList.shrink();
return faceList; return faceList;
} }
@ -186,6 +186,17 @@ Foam::Particle<ParticleType>::Particle
{} {}
template<class ParticleType>
Foam::Particle<ParticleType>::Particle(const Particle<ParticleType>& p)
:
cloud_(p.cloud_),
position_(p.position_),
celli_(p.celli_),
facei_(p.facei_),
stepFraction_(p.stepFraction_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParticleType> template<class ParticleType>
@ -328,56 +339,47 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
label patchi = patch(facei_); label patchi = patch(facei_);
const polyPatch& patch = mesh.boundaryMesh()[patchi]; const polyPatch& patch = mesh.boundaryMesh()[patchi];
if (isA<wedgePolyPatch>(patch)) if (!p.hitPatch(patch, td, patchi))
{ {
p.hitWedgePatch if (isA<wedgePolyPatch>(patch))
( {
static_cast<const wedgePolyPatch&>(patch), td p.hitWedgePatch
); (
} static_cast<const wedgePolyPatch&>(patch), td
else if (isA<symmetryPolyPatch>(patch)) );
{ }
p.hitSymmetryPatch else if (isA<symmetryPolyPatch>(patch))
( {
static_cast<const symmetryPolyPatch&>(patch), td p.hitSymmetryPatch
); (
} static_cast<const symmetryPolyPatch&>(patch), td
else if (isA<cyclicPolyPatch>(patch)) );
{ }
p.hitCyclicPatch else if (isA<cyclicPolyPatch>(patch))
( {
static_cast<const cyclicPolyPatch&>(patch), td p.hitCyclicPatch
); (
} static_cast<const cyclicPolyPatch&>(patch), td
else if (isA<processorPolyPatch>(patch)) );
{ }
p.hitProcessorPatch else if (isA<processorPolyPatch>(patch))
( {
static_cast<const processorPolyPatch&>(patch), td p.hitProcessorPatch
); (
} static_cast<const processorPolyPatch&>(patch), td
else if (isA<wallPolyPatch>(patch)) );
{ }
p.hitWallPatch else if (isA<wallPolyPatch>(patch))
( {
static_cast<const wallPolyPatch&>(patch), td p.hitWallPatch
); (
} static_cast<const wallPolyPatch&>(patch), td
else if (isA<polyPatch>(patch)) );
{ }
p.hitPatch else
( {
static_cast<const polyPatch&>(patch), td p.hitPatch(patch, td);
); }
}
else
{
FatalErrorIn
(
"Particle::trackToFace"
"(const vector& endPosition, scalar& trackFraction)"
)<< "patch type " << patch.type() << " not suported" << nl
<< abort(FatalError);
} }
} }
} }
@ -423,6 +425,19 @@ void Foam::Particle<ParticleType>::transformProperties(const vector&)
{} {}
template<class ParticleType>
template<class TrackData>
bool Foam::Particle<ParticleType>::hitPatch
(
const polyPatch&,
TrackData&,
const label
)
{
return false;
}
template<class ParticleType> template<class ParticleType>
template<class TrackData> template<class TrackData>
void Foam::Particle<ParticleType>::hitWedgePatch void Foam::Particle<ParticleType>::hitWedgePatch

View File

@ -98,10 +98,7 @@ public:
// Constructors // Constructors
inline trackData inline trackData(Cloud<ParticleType>& cloud);
(
Cloud<ParticleType>& cloud
);
// Member functions // Member functions
@ -171,6 +168,16 @@ protected:
// Patch interactions // Patch interactions
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions
template<class TrackData>
bool hitPatch
(
const polyPatch&,
TrackData& td,
const label patchI
);
//- Overridable function to handle the particle hitting a wedgePatch //- Overridable function to handle the particle hitting a wedgePatch
template<class TrackData> template<class TrackData>
void hitWedgePatch void hitWedgePatch
@ -256,8 +263,13 @@ public:
friend class Cloud<ParticleType>; friend class Cloud<ParticleType>;
//- Runtime type information // Static data members
TypeName("Particle");
//- String representation of properties
static string propHeader;
//- Runtime type information
TypeName("Particle");
// Constructors // Constructors
@ -278,14 +290,24 @@ public:
bool readFields = true bool readFields = true
); );
//- Construct as a copy
Particle(const Particle& p);
//- Construct a clone
autoPtr<ParticleType> clone() const
{
return autoPtr<Particle>(new Particle(*this));
}
//- Factory class to read-construct particles used for //- Factory class to read-construct particles used for
// parallel transfer // parallel transfer
class iNew class iNew
{ {
// Private data // Private data
const Cloud<ParticleType>& cloud_; //- Reference to the cloud
const Cloud<ParticleType>& cloud_;
public: public:
@ -303,9 +325,8 @@ public:
//- Destructor //- Destructor
virtual ~Particle()
virtual ~Particle() {}
{}
// Member Functions // Member Functions
@ -344,6 +365,9 @@ public:
//- Return the impact model to be used, soft or hard (default). //- Return the impact model to be used, soft or hard (default).
inline bool softImpact() const; inline bool softImpact() const;
//- Return the particle current time
inline scalar currentTime() const;
// Check // Check
@ -414,10 +438,7 @@ public:
// I-O // I-O
//- Write the fields associated with the owner cloud //- Write the fields associated with the owner cloud
static void writeFields static void writeFields(const Cloud<ParticleType>& c);
(
const Cloud<ParticleType>& c
);
// Ostream Operator // Ostream Operator

View File

@ -345,6 +345,15 @@ inline bool Particle<ParticleType>::softImpact() const
} }
template<class ParticleType>
inline scalar Particle<ParticleType>::currentTime() const
{
return
cloud_.pMesh().time().value()
+ stepFraction_*cloud_.pMesh().time().deltaT().value();
}
template<class ParticleType> template<class ParticleType>
inline label Particle<ParticleType>::patch(const label facei) const inline label Particle<ParticleType>::patch(const label facei) const
{ {

View File

@ -28,6 +28,12 @@ License
#include "IOstreams.H" #include "IOstreams.H"
#include "IOPosition.H" #include "IOPosition.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParticleType>
Foam::string Foam::Particle<ParticleType>::propHeader = "(Px Py Pz) cellI";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from Istream // Construct from Istream

View File

@ -0,0 +1,72 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "ParticleTrackingData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class ParcelType>
Foam::label Foam::ParticleTrackingData<ParcelType>::PARTICLE_COUNT = 0;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ParticleTrackingData<ParcelType>::ParticleTrackingData
(
const Cloud<ParcelType>& cloud
)
:
cloud_(cloud),
origProc_(Pstream::myProcNo()),
id_(PARTICLE_COUNT++)
{}
template<class ParcelType>
Foam::ParticleTrackingData<ParcelType>::ParticleTrackingData
(
const ParticleTrackingData& ptd
)
:
cloud_(ptd.cloud_),
origProc_(ptd.origProc_),
id_(ptd.id_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ParticleTrackingData<ParcelType>::~ParticleTrackingData()
{}
// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
#include "ParticleTrackingDataIO.C"
// ************************************************************************* //

View File

@ -0,0 +1,166 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::ParticleTrackingData
Description
Class to provide additional properties to allow construction of
particle tracks
SourceFiles
ParticleTrackingData.C
ParticleTrackingDataIO.C
\*---------------------------------------------------------------------------*/
#ifndef ParticleTrackingData_H
#define ParticleTrackingData_H
#include "Cloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes and friend functions
template<class ParcelType>
class ParticleTrackingData;
template<class ParcelType>
Ostream& operator<<
(
Ostream&,
const ParticleTrackingData<ParcelType>&
);
/*---------------------------------------------------------------------------*\
Class ParticleTrackingData Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
class ParticleTrackingData
{
// Private data
//- Reference to the cloud
const Cloud<ParcelType>& cloud_;
//- Originating processor id
label origProc_;
//- Local particle id
label id_;
//- Cumulative particle count used for particle id
static label PARTICLE_COUNT;
// Private member functions
//- Write properties - particle count
static void writeProperties(const Cloud<ParcelType>& cloud);
//- Read properties - particle count
static void readProperties(const Cloud<ParcelType>& cloud);
public:
// Constructors
//- Construct from cloud
ParticleTrackingData(const Cloud<ParcelType>& cloud);
//- Construct copy
ParticleTrackingData(const ParticleTrackingData& ptd);
//- Construct from Istream and mesh
ParticleTrackingData
(
const Cloud<ParcelType>& cloud,
Istream& is,
bool readFields
);
//- Destructor
~ParticleTrackingData();
// Member functions
// Access
//- Return const access to the cloud
inline const Cloud<ParcelType>& cloud() const;
//- Return const access to the originating processor id
inline label origProc() const;
//- Return const access to the local particle id
inline label id() const;
// I-O
//- Read fields
static void readFields(Cloud<ParcelType>& c);
//- Write fields
static void writeFields(const Cloud<ParcelType>& c);
// Ostream Operator
friend Ostream& operator<< <ParcelType>
(
Ostream&,
const ParticleTrackingData<ParcelType>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleTrackingDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ParticleTrackingData.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
template<class ParcelType>
inline const Foam::Cloud<ParcelType>&
Foam::ParticleTrackingData<ParcelType>::cloud() const
{
return cloud_;
}
template<class ParcelType>
inline Foam::label Foam::ParticleTrackingData<ParcelType>::origProc() const
{
return origProc_;
}
template<class ParcelType>
inline Foam::label Foam::ParticleTrackingData<ParcelType>::id() const
{
return id_;
}
// ************************************************************************* //

View File

@ -0,0 +1,233 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "ParticleTrackingData.H"
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::readProperties
(
const Cloud<ParcelType>& cloud
)
{
IOobject propsDictHeader
(
"particleTrackingProperties",
cloud.db().time().timeName(),
"uniform/Lagrangian"/cloud.name(),
cloud.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
word procName("processor" + name(Pstream::myProcNo()));
if (propsDict.found(procName))
{
propsDict.subDict(procName).lookup("particleCount") >>
PARTICLE_COUNT;
}
}
}
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::writeProperties
(
const Cloud<ParcelType>& cloud
)
{
if (cloud.db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"particleTrackingProperties",
cloud.db().time().timeName(),
"uniform/Lagrangian"/cloud.name(),
cloud.db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
word procName("processor" + name(Pstream::myProcNo()));
propsDict.add(procName, dictionary());
propsDict.subDict(procName).add("particleCount", PARTICLE_COUNT);
propsDict.regIOobject::write();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::ParticleTrackingData<ParcelType>::ParticleTrackingData
(
const Cloud<ParcelType>& cloud,
Istream& is,
bool readFields
)
:
cloud_(cloud),
origProc_(-1),
id_(-1)
{
if (readFields)
{
if (is.format() == IOstream::ASCII)
{
is >> origProc_ >> id_;
}
else
{
is.read
(
reinterpret_cast<char*>(&origProc_),
sizeof(origProc_) + sizeof(id_)
);
}
}
// Check state of Istream
is.check
(
"ParticleTrackingData<ParcelType>::ParticleTrackingData"
"("
"Istream&, "
"bool"
")"
);
}
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::readFields
(
Cloud<ParcelType>& c
)
{
if (!c.size())
{
return;
}
readProperties(c);
IOField<label> origProc(c.fieldIOobject("origProc", IOobject::MUST_READ));
c.checkFieldIOobject(c, origProc);
IOField<label> id(c.fieldIOobject("id", IOobject::MUST_READ));
c.checkFieldIOobject(c, id);
label i = 0;
forAllIter(typename Cloud<ParcelType>, c, iter)
{
ParcelType& p = iter();
p.origProc_ = origProc[i];
p.id_ = id[i];
i++;
}
}
template<class ParcelType>
void Foam::ParticleTrackingData<ParcelType>::writeFields
(
const Cloud<ParcelType>& c
)
{
writeProperties(c);
const label np = c.size();
IOField<label> origProc
(
c.fieldIOobject("origProc", IOobject::NO_READ),
np
);
IOField<label> id(c.fieldIOobject("id", IOobject::NO_READ), np);
label i = 0;
forAllConstIter(typename Cloud<ParcelType>, c, iter)
{
const ParcelType& p = iter();
origProc[i] = p.origProc();
id[i] = p.id();
i++;
}
origProc.write();
id.write();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class ParcelType>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const ParticleTrackingData<ParcelType>& p
)
{
if (os.format() == IOstream::ASCII)
{
os << p.origProc_ << token::SPACE << p.id_ << token::SPACE;
}
else
{
os.write
(
reinterpret_cast<const char*>(&p.origProc_),
sizeof(p.origProc_) + sizeof(p.id_)
);
}
// Check state of Ostream
os.check
(
"Ostream& operator<<"
"("
"Ostream&, "
"const ParticleTrackingData<ParcelType>&"
")"
);
return os;
}
// ************************************************************************* //

View File

@ -87,6 +87,12 @@ public:
Particle<indexedParticle>(c, is) Particle<indexedParticle>(c, is)
{} {}
//- Construct as a copy
indexedParticle(const indexedParticle& p)
:
Particle<indexedParticle>(p)
{}
//- Construct and return a clone //- Construct and return a clone
autoPtr<indexedParticle> clone() const autoPtr<indexedParticle> clone() const
{ {

View File

@ -47,7 +47,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class passiveParticle Declaration Class passiveParticle Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class passiveParticle class passiveParticle
@ -81,6 +81,12 @@ public:
Particle<passiveParticle>(c, is) Particle<passiveParticle>(c, is)
{} {}
//- Construct as copy
passiveParticle(const passiveParticle& p)
:
Particle<passiveParticle>(p)
{}
//- Construct and return a clone //- Construct and return a clone
autoPtr<passiveParticle> clone() const autoPtr<passiveParticle> clone() const
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,53 +24,46 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "coalCloud.H" #include "CoalCloud.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(coalCloud, 0);
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coalCloud::coalCloud template<class ThermoType>
Foam::CoalCloud<ThermoType>::CoalCloud
( (
const word& cloudType, const word& cloudName,
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U, const volVectorField& U,
const dimensionedVector& g, const dimensionedVector& g,
hCombustionThermo& thermo, hCombustionThermo& thermo
PtrList<specieReactingProperties>& gases
) )
: :
ReactingMultiphaseCloud<coalParcel> ReactingMultiphaseCloud<CoalParcel<ThermoType> >
( (
cloudType, cloudName,
rho, rho,
U, U,
g, g,
thermo, thermo
gases
) )
{ {
coalParcel::readFields(*this); CoalParcel<ThermoType>::readFields(*this);
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coalCloud::~coalCloud() template<class ThermoType>
Foam::CoalCloud<ThermoType>::~CoalCloud()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::coalCloud::writeFields() const template<class ThermoType>
void Foam::CoalCloud<ThermoType>::writeFields() const
{ {
coalParcel::writeFields(*this); CoalParcel<ThermoType>::writeFields(*this);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,20 +23,20 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
coalCloud CoalCloud
Description Description
SourceFiles SourceFiles
coalCloud.C CoalCloud.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coalCloud_H #ifndef CoalCloud_H
#define coalCloud_H #define CoalCloud_H
#include "ReactingMultiphaseCloud.H" #include "ReactingMultiphaseCloud.H"
#include "coalParcel.H" #include "CoalParcel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,44 +44,44 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class coalCloud Declaration Class CoalCloud Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class coalCloud template<class ThermoType>
class CoalCloud
: :
public ReactingMultiphaseCloud<coalParcel> public ReactingMultiphaseCloud<CoalParcel<ThermoType> >
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
coalCloud(const coalCloud&); CoalCloud(const CoalCloud&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const coalCloud&); void operator=(const CoalCloud&);
public: public:
//-Runtime type information //-Runtime type information
TypeName("coalCloud"); TypeName("CoalCloud");
// Constructors // Constructors
//- Construct given carrier gas fields //- Construct given carrier gas fields
coalCloud CoalCloud
( (
const word& cloudType, const word& cloudName,
const volScalarField& rho, const volScalarField& rho,
const volVectorField& U, const volVectorField& U,
const dimensionedVector& g, const dimensionedVector& g,
hCombustionThermo& thermo, hCombustionThermo& thermo
PtrList<specieReactingProperties>& gases
); );
//- Destructor //- Destructor
~coalCloud(); ~CoalCloud();
// Member Functions // Member Functions
@ -97,6 +97,12 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CoalCloud.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,24 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "coalParcel.H" #include "createReactingCloudTypes.H"
#include "ReactingCloud.H" #include "CoalCloud.H"
#include "SingleMixtureFraction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeCompositionModel(ReactingCloud<coalParcel>); createReactingCloudType(CoalCloud);
// Add instances of composition model to the table
makeCompositionModelType
(
SingleMixtureFraction,
ReactingCloud,
coalParcel
);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,25 +24,28 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "coalParcel.H" #include "CoalParcel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(coalParcel, 0);
defineParticleTypeNameAndDebug(coalParcel, 0);
defineParcelTypeNameAndDebug(coalParcel, 0);
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::coalParcel::coalParcel template<class ThermoType>
Foam::CoalParcel<ThermoType>::CoalParcel
( (
ReactingMultiphaseCloud<coalParcel>& owner, ReactingMultiphaseCloud<CoalParcel<ThermoType> >& owner,
const vector& position, const vector& position,
const label celli, const label cellI
)
:
ReactingMultiphaseParcel<CoalParcel<ThermoType> >(owner, position, cellI)
{}
template<class ThermoType>
Foam::CoalParcel<ThermoType>::CoalParcel
(
ReactingMultiphaseCloud<CoalParcel<ThermoType> >& owner,
const vector& position,
const label cellI,
const label typeId, const label typeId,
const scalar nParticle0, const scalar nParticle0,
const scalar d0, const scalar d0,
@ -51,14 +54,16 @@ Foam::coalParcel::coalParcel
const scalarField& YGas0, const scalarField& YGas0,
const scalarField& YLiquid0, const scalarField& YLiquid0,
const scalarField& YSolid0, const scalarField& YSolid0,
const constantProperties& constProps const typename
ReactingMultiphaseParcel<CoalParcel<ThermoType> >::
constantProperties& constProps
) )
: :
ReactingMultiphaseParcel<coalParcel> ReactingMultiphaseParcel<CoalParcel<ThermoType> >
( (
owner, owner,
position, position,
celli, cellI,
typeId, typeId,
nParticle0, nParticle0,
d0, d0,
@ -72,20 +77,22 @@ Foam::coalParcel::coalParcel
{} {}
Foam::coalParcel::coalParcel template<class ThermoType>
Foam::CoalParcel<ThermoType>::CoalParcel
( (
const Cloud<coalParcel>& cloud, const Cloud<CoalParcel<ThermoType> >& cloud,
Istream& is, Istream& is,
bool readFields bool readFields
) )
: :
ReactingMultiphaseParcel<coalParcel>(cloud, is, readFields) ReactingMultiphaseParcel<CoalParcel<ThermoType> >(cloud, is, readFields)
{} {}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
Foam::coalParcel::~coalParcel() template<class ThermoType>
Foam::CoalParcel<ThermoType>::~CoalParcel()
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -23,19 +23,19 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
coalParcel CoalParcel
Description Description
SourceFiles SourceFiles
coalParcel.C CoalParcel.C
coalParcelIO.C CoalParcelIO.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coalParcel_H #ifndef CoalParcel_H
#define coalParcel_H #define CoalParcel_H
#include "ReactingMultiphaseParcel.H" #include "ReactingMultiphaseParcel.H"
@ -44,27 +44,44 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declaration of classes
template<class ThermoType>
class CoalParcel;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class coalParcel Declaration Class CoalParcel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class coalParcel template<class ThermoType>
class CoalParcel
: :
public ReactingMultiphaseParcel<coalParcel> public ReactingMultiphaseParcel<CoalParcel<ThermoType> >
{ {
public: public:
//- The type of thermodynamics this parcel was instantiated for
typedef ThermoType thermoType;
// Run-time type information // Run-time type information
TypeName("coalParcel"); TypeName("CoalParcel");
// Constructors // Constructors
//- Construct from components //- Construct from owner, position, and cloud owner
coalParcel // Other properties initialised as null
CoalParcel
( (
ReactingMultiphaseCloud<coalParcel>& owner, ReactingMultiphaseCloud<CoalParcel>& owner,
const vector& position, const vector& position,
const label celli, const label cellI
);
//- Construct from components
CoalParcel
(
ReactingMultiphaseCloud<CoalParcel>& owner,
const vector& position,
const label cellI,
const label typeId, const label typeId,
const scalar nParticle0, const scalar nParticle0,
const scalar d0, const scalar d0,
@ -73,42 +90,43 @@ public:
const scalarField& YGas0, const scalarField& YGas0,
const scalarField& YLiquid0, const scalarField& YLiquid0,
const scalarField& YSolid0, const scalarField& YSolid0,
const constantProperties& constProps const typename
ReactingMultiphaseParcel<CoalParcel>::
constantProperties& constProps
); );
//- Construct from Istream //- Construct from Istream
coalParcel CoalParcel
( (
const Cloud<coalParcel>& c, const Cloud<CoalParcel>& c,
Istream& is, Istream& is,
bool readFields = true bool readFields = true
); );
//- Construct and return a clone //- Construct and return a clone
autoPtr<coalParcel> clone() const autoPtr<CoalParcel> clone() const
{ {
return autoPtr<coalParcel>(new coalParcel(*this)); return autoPtr<CoalParcel>(new CoalParcel(*this));
} }
//- Destructor //- Destructor
virtual ~coalParcel(); virtual ~CoalParcel();
}; };
template<>
inline bool contiguous<coalParcel>()
{
return false; // Now have scalar lists/fields (mass fractions)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "CoalParcel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,21 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "coalParcel.H" #include "createCoalParcelTypes.H"
#include "KinematicCloud.H" #include "CoalParcel.H"
#include "NoDrag.H"
#include "SphereDrag.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeDragModel(KinematicCloud<coalParcel>); createCoalParcelType(CoalParcel);
// Add instances of drag model to the table
makeDragModelType(NoDrag, KinematicCloud, coalParcel);
makeDragModelType(SphereDrag, KinematicCloud, coalParcel);
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,44 +24,47 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "basicKinematicParcel.H" #include "CoalParcel.H"
#include "KinematicCloud.H"
#include "NoDispersion.H" // Kinematic
#include "GradientDispersionRAS.H" #include "makeReactingParcelDispersionModels.H"
#include "StochasticDispersionRAS.H" #include "makeReactingParcelDragModels.H"
#include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant
#include "makeReactingParcelPatchInteractionModels.H"
#include "makeReactingParcelPostProcessingModels.H"
// Thermodynamic
#include "makeReactingParcelHeatTransferModels.H"
// Reacting
#include "makeReactingMultiphaseParcelCompositionModels.H" // MP variant
#include "makeReactingParcelPhaseChangeModels.H"
// Reacting multiphase
#include "makeReactingMultiphaseParcelDevolatilisationModels.H"
#include "makeCoalParcelSurfaceReactionModels.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeDispersionModel(KinematicCloud<basicKinematicParcel>); // Kinematic sub-models
makeReactingDispersionModels(CoalParcel);
makeReactingDragModels(CoalParcel);
makeReactingMultiphaseInjectionModels(CoalParcel);
makeReactingPatchInteractionModels(CoalParcel);
makeReactingPostProcessingModels(CoalParcel);
defineNamedTemplateTypeNameAndDebug // Thermo sub-models
( makeReactingHeatTransferModels(CoalParcel);
DispersionRASModel<KinematicCloud<basicKinematicParcel> >,
0
);
// Add instances of dispersion model to the table // Reacting sub-models
makeDispersionModelType makeReactingMultiphaseCompositionModels(CoalParcel);
( makeReactingPhaseChangeModels(CoalParcel);
NoDispersion,
KinematicCloud, // Reacting multiphase sub-models
basicKinematicParcel makeReactingMultiphaseDevolatilisationModels(CoalParcel);
); makeCoalSurfaceReactionModels(CoalParcel);
makeDispersionModelType
(
GradientDispersionRAS,
KinematicCloud,
basicKinematicParcel
);
makeDispersionModelType
(
StochasticDispersionRAS,
KinematicCloud,
basicKinematicParcel
);
}; };

View File

@ -1,22 +1,8 @@
/* coal cloud */ /* Coal cloud */
coalCloud/coalCloud.C CoalCloud/defineCoalCloud.C
/* coal parcel and sub-models */
coalParcel/coalParcel.C
coalParcel/defineCoalParcel.C
coalParcel/submodels/makeCoalParcelCompositionModels.C
coalParcel/submodels/makeCoalParcelDevolatilisationModels.C
coalParcel/submodels/makeCoalParcelDragModels.C
coalParcel/submodels/makeCoalParcelDispersionModels.C
coalParcel/submodels/makeCoalParcelInjectionModels.C
coalParcel/submodels/makeCoalParcelHeatTransferModels.C
coalParcel/submodels/makeCoalParcelPhaseChangeModels.C
coalParcel/submodels/makeCoalParcelSurfaceReactionModels.C
coalParcel/submodels/makeCoalParcelWallInteractionModels.C
submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C
submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C
submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C
/* Coal parcel and sub-models */
CoalParcel/defineCoalParcel.C
CoalParcel/makeCoalParcelSubmodels.C
LIB = $(FOAM_LIBBIN)/libcoalCombustion LIB = $(FOAM_LIBBIN)/libcoalCombustion

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "coalParcel.H"
#include "ReactingMultiphaseCloud.H"
namespace Foam
{
defineTemplateTypeNameAndDebug(Cloud<coalParcel>, 0);
defineParcelTypeNameAndDebug(KinematicParcel<coalParcel>, 0);
// defineTemplateTypeNameAndDebug(KinematicParcel<coalParcel>, 0);
defineParcelTypeNameAndDebug(ThermoParcel<coalParcel>, 0);
defineTemplateTypeNameAndDebug(ThermoParcel<coalParcel>, 0);
defineParcelTypeNameAndDebug(ReactingParcel<coalParcel>, 0);
defineTemplateTypeNameAndDebug(ReactingParcel<coalParcel>, 0);
defineParcelTypeNameAndDebug(ReactingMultiphaseParcel<coalParcel>, 0);
defineTemplateTypeNameAndDebug(ReactingMultiphaseParcel<coalParcel>, 0);
defineParcelTypeNameAndDebug(KinematicCloud<coalParcel>, 0);
defineParcelTypeNameAndDebug(ThermoCloud<coalParcel>, 0);
defineParcelTypeNameAndDebug(ReactingCloud<coalParcel>, 0);
defineParcelTypeNameAndDebug(ReactingMultiphaseCloud<coalParcel>, 0);
};
// ************************************************************************* //

View File

@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "coalParcel.H"
#include "ReactingMultiphaseCloud.H"
#include "NoDevolatilisation.H"
#include "ConstantRateDevolatilisation.H"
#include "SingleKineticRateDevolatilisation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeDevolatilisationModel
(
ReactingMultiphaseCloud<coalParcel>
);
// Add instances of devolatilisation model to the table
makeDevolatilisationModelType
(
NoDevolatilisation,
ReactingMultiphaseCloud,
coalParcel
);
makeDevolatilisationModelType
(
ConstantRateDevolatilisation,
ReactingMultiphaseCloud,
coalParcel
);
makeDevolatilisationModelType
(
SingleKineticRateDevolatilisation,
ReactingMultiphaseCloud,
coalParcel
);
};
// ************************************************************************* //

View File

@ -1,58 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "coalParcel.H"
#include "ReactingCloud.H"
#include "NoPhaseChange.H"
#include "LiquidEvaporation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePhaseChangeModel
(
ReactingCloud<coalParcel>
);
// Add instances of phase change model to the table
makePhaseChangeModelType
(
NoPhaseChange,
ReactingCloud,
coalParcel
);
makePhaseChangeModelType
(
LiquidEvaporation,
ReactingCloud,
coalParcel
);
};
// ************************************************************************* //

View File

@ -1,69 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "coalParcel.H"
#include "ReactingMultiphaseCloud.H"
#include "NoSurfaceReaction.H"
#include "COxidationDiffusionLimitedRate.H"
#include "COxidationKineticDiffusionLimitedRate.H"
#include "COxidationMurphyShaddix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeSurfaceReactionModel(ReactingMultiphaseCloud<coalParcel>);
// Add instances of surface reaction model to the table
makeSurfaceReactionModelType
(
NoSurfaceReaction,
ReactingMultiphaseCloud,
coalParcel
);
makeSurfaceReactionModelTypeInstance
(
COxidationDiffusionLimitedRate,
ReactingMultiphaseCloud,
coalParcel
);
makeSurfaceReactionModelTypeInstance
(
COxidationKineticDiffusionLimitedRate,
ReactingMultiphaseCloud,
coalParcel
);
makeSurfaceReactionModelTypeInstance
(
COxidationMurphyShaddix,
ReactingMultiphaseCloud,
coalParcel
);
};
// ************************************************************************* //

View File

@ -1,55 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "coalParcel.H"
#include "ReactingCloud.H"
#include "Rebound.H"
#include "StandardWallInteraction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWallInteractionModel(KinematicCloud<coalParcel>);
// Add instances of wall interaction model to the table
makeWallInteractionModelType
(
Rebound,
KinematicCloud,
coalParcel
);
makeWallInteractionModelType
(
StandardWallInteraction,
KinematicCloud,
coalParcel
);
};
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef createCoalParcelTypes_H
#define createCoalParcelTypes_H
#include "makeParcelIOList.H"
#include "reactingThermoTypes.H"
#include "CoalCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define createCoalParcelType(ParcelType) \
\
createCoalParcelThermoType \
( \
ParcelType, \
specieConstProperties \
); \
createCoalParcelThermoType \
( \
ParcelType, \
specieReactingProperties \
);
#define createCoalParcelThermoType(ParcelType, ThermoType) \
\
typedef ParcelType<ThermoType> ParcelType##ThermoType; \
\
makeParcelIOList(ParcelType##ThermoType); \
\
defineTemplateTypeNameAndDebug(ParcelType##ThermoType, 0); \
defineTemplateTypeNameAndDebug(Particle<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(Cloud<ParcelType##ThermoType>, 0); \
\
defineParcelTypeNameAndDebug(KinematicParcel<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug \
( \
KinematicParcel<ParcelType##ThermoType>, \
0 \
); \
defineParcelTypeNameAndDebug(ThermoParcel<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(ThermoParcel<ParcelType##ThermoType>, 0); \
defineParcelTypeNameAndDebug(ReactingParcel<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(ReactingParcel<ParcelType##ThermoType>, 0);\
defineParcelTypeNameAndDebug \
( \
ReactingMultiphaseParcel<ParcelType##ThermoType>, \
0 \
); \
defineTemplateTypeNameAndDebug \
( \
ReactingMultiphaseParcel<ParcelType##ThermoType>, \
0 \
); \
defineParcelTypeNameAndDebug(CoalParcel<ParcelType##ThermoType>, 0); \
defineTemplateTypeNameAndDebug(CoalParcel<ParcelType##ThermoType>, 0); \
\
defineParcelTypeNameAndDebug(KinematicCloud<ParcelType##ThermoType>, 0); \
defineParcelTypeNameAndDebug(ThermoCloud<ParcelType##ThermoType>, 0); \
defineParcelTypeNameAndDebug(ReactingCloud<ParcelType##ThermoType>, 0); \
defineParcelTypeNameAndDebug \
( \
ReactingMultiphaseCloud<ParcelType##ThermoType>, \
0 \
); \
defineParcelTypeNameAndDebug(CoalCloud<ParcelType##ThermoType>, 0);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,97 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef makeCoalParcelSurfaceReactionModels_H
#define makeCoalParcelSurfaceReactionModels_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingThermoTypes.H"
#include "ReactingMultiphaseCloud.H"
#include "NoSurfaceReaction.H"
#include "COxidationDiffusionLimitedRate.H"
#include "COxidationKineticDiffusionLimitedRate.H"
#include "COxidationMurphyShaddix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeCoalSurfaceReactionModels(ParcelType) \
\
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
specieConstProperties \
); \
makeCoalSurfaceReactionModelThermoType \
( \
ParcelType, \
specieReactingProperties \
);
#define makeCoalSurfaceReactionModelThermoType(ParcelType, ThermoType) \
\
makeSurfaceReactionModel \
( \
ReactingMultiphaseCloud<ParcelType<ThermoType> > \
); \
\
makeSurfaceReactionModelThermoType \
( \
NoSurfaceReaction, \
ReactingMultiphaseCloud, \
ParcelType, \
ThermoType \
); \
makeSurfaceReactionModelThermoType \
( \
COxidationDiffusionLimitedRate, \
ReactingMultiphaseCloud, \
ParcelType, \
ThermoType \
); \
makeSurfaceReactionModelThermoType \
( \
COxidationKineticDiffusionLimitedRate, \
ReactingMultiphaseCloud, \
ParcelType, \
ThermoType \
); \
makeSurfaceReactionModelThermoType \
( \
COxidationMurphyShaddix, \
ReactingMultiphaseCloud, \
ParcelType, \
ThermoType \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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