mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -7,6 +7,7 @@
|
||||
*.orig
|
||||
*.bak
|
||||
\#*\#
|
||||
.directory
|
||||
|
||||
# CVS recovered versions - anywhere
|
||||
.#*
|
||||
@ -47,7 +48,9 @@ doc/[Dd]oxygen/man
|
||||
# source packages - anywhere
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
*.tar
|
||||
*.tgz
|
||||
*.gtgz
|
||||
|
||||
# ignore the persistent .build tag in the main directory
|
||||
/.build
|
||||
|
||||
@ -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
|
||||
);
|
||||
@ -19,7 +19,6 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/ODE/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-L$(FOAM_USER_LIBBIN) \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lcompressibleRASModels \
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,11 +35,11 @@ Description
|
||||
#include "hCombustionThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "basicThermoCloud.H"
|
||||
#include "coalCloud.H"
|
||||
#include "CoalCloud.H"
|
||||
#include "chemistryModel.H"
|
||||
#include "chemistrySolver.H"
|
||||
#include "ReactingCloudThermoTypes.H"
|
||||
#include "timeActivatedExplicitSource.H"
|
||||
#include "reactingThermoTypes.H"
|
||||
#include "timeActivatedExplicitCellSource.H"
|
||||
#include "radiationModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -113,8 +113,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
enthalpySource.update();
|
||||
|
||||
rho = thermo->rho();
|
||||
|
||||
if (runTime.write())
|
||||
|
||||
@ -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;
|
||||
coalCloud coalParcels
|
||||
CoalCloud<specieReactingProperties> coalParcels
|
||||
(
|
||||
"coalCloud1",
|
||||
rho,
|
||||
U,
|
||||
g,
|
||||
thermo(),
|
||||
gasProperties
|
||||
thermo()
|
||||
);
|
||||
|
||||
Info<< "\nConstructing limestone cloud" << endl;
|
||||
|
||||
@ -105,8 +105,8 @@
|
||||
volScalarField DpDt =
|
||||
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
|
||||
Info<< "\nConstructing explicit enthalpy source" << endl;
|
||||
timeActivatedExplicitSource enthalpySource
|
||||
Info<< "\nConstructing explicit enthalpy cell source" << endl;
|
||||
timeActivatedExplicitCellSource enthalpySource
|
||||
(
|
||||
"enthalpySource",
|
||||
mesh,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -15,12 +15,10 @@
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
-fvc::reconstruct
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
fvc::snGrad(pd)
|
||||
+ ghf*fvc::snGrad(rho)
|
||||
) * mesh.magSf()
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
- fvc::snGrad(p)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -59,27 +59,6 @@
|
||||
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();
|
||||
|
||||
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
bool closedVolume = pd.needReference();
|
||||
bool closedVolume = p.needReference();
|
||||
|
||||
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++)
|
||||
{
|
||||
fvScalarMatrix pdEqn
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, pd)
|
||||
+ fvc::ddt(psi)*pRef
|
||||
+ fvc::ddt(psi, rho)*gh
|
||||
fvm::ddt(psi, p)
|
||||
+ fvc::div(phi)
|
||||
- fvm::laplacian(rhorUAf, pd)
|
||||
- fvm::laplacian(rhorUAf, p)
|
||||
);
|
||||
|
||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
pdEqn.solve(mesh.solver(pd.name() + "Final"));
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pdEqn.solve(mesh.solver(pd.name()));
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi += pdEqn.flux();
|
||||
phi += pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
p == pd + rho*gh + pRef;
|
||||
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
|
||||
|
||||
#include "rhoEqn.H"
|
||||
@ -62,6 +59,4 @@
|
||||
/fvc::domainIntegrate(thermo->psi());
|
||||
rho = thermo->rho();
|
||||
}
|
||||
|
||||
pd == p - (rho*gh + pRef);
|
||||
}
|
||||
|
||||
@ -13,14 +13,11 @@
|
||||
(
|
||||
UEqn()
|
||||
==
|
||||
-fvc::reconstruct
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
fvc::snGrad(pd)
|
||||
+ ghf*fvc::snGrad(rho)
|
||||
) * mesh.magSf()
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
- fvc::snGrad(p)*mesh.magSf()
|
||||
)
|
||||
).initialResidual();
|
||||
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
|
||||
|
||||
@ -39,7 +39,6 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
@ -47,7 +46,7 @@ int main(int argc, char *argv[])
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
@ -58,7 +57,7 @@ int main(int argc, char *argv[])
|
||||
#include "readSIMPLEControls.H"
|
||||
#include "initConvergenceCheck.H"
|
||||
|
||||
pd.storePrevIter();
|
||||
p.storePrevIter();
|
||||
rho.storePrevIter();
|
||||
|
||||
// Pressure-velocity SIMPLE corrector
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
label pdRefCell = 0;
|
||||
scalar pdRefValue = 0.0;
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell
|
||||
(
|
||||
pd,
|
||||
p,
|
||||
mesh.solutionDict().subDict("SIMPLE"),
|
||||
pdRefCell,
|
||||
pdRefValue
|
||||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
{
|
||||
rho = thermo->rho();
|
||||
|
||||
volScalarField rUA = 1.0/UEqn().A();
|
||||
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
|
||||
|
||||
@ -7,48 +9,32 @@
|
||||
|
||||
phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
|
||||
bool closedVolume = adjustPhi(phi, U, p);
|
||||
surfaceScalarField buoyancyPhi = ghf*fvc::snGrad(rho)*rhorUAf*mesh.magSf();
|
||||
phi -= buoyancyPhi;
|
||||
surfaceScalarField buoyancyPhi =
|
||||
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
|
||||
phi += buoyancyPhi;
|
||||
|
||||
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
|
||||
if (nonOrth == 0)
|
||||
{
|
||||
eqnResidual = pdEqn.solve().initialResidual();
|
||||
eqnResidual = pEqn.solve().initialResidual();
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
}
|
||||
else
|
||||
{
|
||||
pdEqn.solve();
|
||||
pEqn.solve();
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
// Calculate the conservative fluxes
|
||||
phi -= pdEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
pd.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U -= rUA*fvc::reconstruct((buoyancyPhi + pdEqn.flux())/rhorUAf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
#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)
|
||||
@ -57,10 +43,23 @@
|
||||
/fvc::domainIntegrate(thermo->psi());
|
||||
}
|
||||
|
||||
// Calculate the conservative fluxes
|
||||
phi -= pEqn.flux();
|
||||
|
||||
// Explicitly relax pressure for momentum corrector
|
||||
p.relax();
|
||||
|
||||
// Correct the momentum source with the pressure gradient flux
|
||||
// calculated from the relaxed pressure
|
||||
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rhorUAf);
|
||||
U.correctBoundaryConditions();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
rho = thermo->rho();
|
||||
rho.relax();
|
||||
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
|
||||
<< endl;
|
||||
|
||||
pd == p - (rho*gh + pRef);
|
||||
}
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
reactingParcelFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/reactingParcelFoam
|
||||
@ -0,0 +1,9 @@
|
||||
Info<< "\nConstructing reacting cloud" << endl;
|
||||
BasicReactingCloud<specieReactingProperties> parcels
|
||||
(
|
||||
"reactingCloud1",
|
||||
rho,
|
||||
U,
|
||||
g,
|
||||
thermo()
|
||||
);
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -34,10 +34,10 @@ Description
|
||||
#include "fvCFD.H"
|
||||
#include "hCombustionThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "basicReactingCloud.H"
|
||||
#include "BasicReactingCloud.H"
|
||||
#include "chemistryModel.H"
|
||||
#include "chemistrySolver.H"
|
||||
#include "ReactingCloudThermoTypes.H"
|
||||
#include "reactingThermoTypes.H"
|
||||
#include "radiationModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -0,0 +1,3 @@
|
||||
trackedReactingParcelFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/trackedReactingParcelFoam
|
||||
@ -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
|
||||
@ -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));
|
||||
}
|
||||
@ -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);
|
||||
|
||||
}
|
||||
@ -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();
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
Info<< "\nConstructing reacting cloud" << endl;
|
||||
BasicTrackedReactingCloud<specieReactingProperties> reactingParcels
|
||||
(
|
||||
"reactingCloud1",
|
||||
rho,
|
||||
U,
|
||||
g,
|
||||
thermo()
|
||||
);
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
Info<< "\nConstructing multi-component mass flow rate point sources" << endl;
|
||||
timeActivatedExplicitMulticomponentPointSource pointMassSources
|
||||
(
|
||||
"pointMassSources",
|
||||
mesh,
|
||||
Y,
|
||||
dimMass/dimVolume/dimTime
|
||||
);
|
||||
@ -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();
|
||||
}
|
||||
110
applications/solvers/lagrangian/trackedReactingParcelFoam/pEqn.H
Normal file
110
applications/solvers/lagrangian/trackedReactingParcelFoam/pEqn.H
Normal 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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
@ -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()
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -178,7 +178,6 @@ void writeAllDataBinary
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class Type>
|
||||
void writeAllFaceData
|
||||
(
|
||||
@ -275,7 +274,7 @@ template<class Type>
|
||||
bool writePatchField
|
||||
(
|
||||
const Foam::Field<Type>& pf,
|
||||
const Foam::label patchI,
|
||||
const Foam::label patchi,
|
||||
const Foam::label ensightPatchI,
|
||||
const Foam::faceSets& boundaryFaceSet,
|
||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||
@ -335,7 +334,7 @@ template<class Type>
|
||||
bool writePatchFieldBinary
|
||||
(
|
||||
const Foam::Field<Type>& pf,
|
||||
const Foam::label patchI,
|
||||
const Foam::label patchi,
|
||||
const Foam::label ensightPatchI,
|
||||
const Foam::faceSets& boundaryFaceSet,
|
||||
const Foam::ensightMesh::nFacePrimitives& nfp,
|
||||
@ -406,34 +405,27 @@ void writePatchField
|
||||
const Time& runTime = eMesh.mesh().time();
|
||||
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const HashTable<labelList>& allPatchNames = eMesh.allPatchNames();
|
||||
const HashTable<label>& patchIndices = eMesh.patchIndices();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
nPatchPrims = eMesh.nPatchPrims();
|
||||
|
||||
label patchI = -1;
|
||||
|
||||
if (patchIndices.found(patchName))
|
||||
{
|
||||
patchI = patchIndices.find(patchName)();
|
||||
}
|
||||
|
||||
label ensightPatchI = eMesh.patchPartOffset();
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<labelList>::const_iterator iter =
|
||||
allPatchNames.begin();
|
||||
iter != allPatchNames.end();
|
||||
++iter
|
||||
)
|
||||
label patchi = -1;
|
||||
|
||||
forAll(allPatchNames, i)
|
||||
{
|
||||
if (iter.key() == patchName) break;
|
||||
if (allPatchNames[i] == patchName)
|
||||
{
|
||||
patchi = i;
|
||||
break;
|
||||
}
|
||||
ensightPatchI++;
|
||||
}
|
||||
|
||||
|
||||
const labelList& patchProcessors = allPatchNames.find(patchName)();
|
||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
||||
|
||||
word pfName = patchName + '.' + fieldName;
|
||||
|
||||
@ -472,14 +464,14 @@ void writePatchField
|
||||
ensightFile << pTraits<Type>::typeName << nl;
|
||||
}
|
||||
|
||||
if (patchI >= 0)
|
||||
if (patchi >= 0)
|
||||
{
|
||||
writePatchField
|
||||
(
|
||||
pf,
|
||||
patchI,
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchI],
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
@ -507,6 +499,7 @@ void writePatchField
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void ensightFieldAscii
|
||||
(
|
||||
@ -527,8 +520,8 @@ void ensightFieldAscii
|
||||
|
||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const HashTable<labelList>& allPatchNames = eMesh.allPatchNames();
|
||||
const HashTable<label>& patchIndices = eMesh.patchIndices();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
||||
const wordHashSet& patchNames = eMesh.patchNames();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
nPatchPrims = eMesh.nPatchPrims();
|
||||
@ -623,30 +616,23 @@ void ensightFieldAscii
|
||||
|
||||
label ensightPatchI = eMesh.patchPartOffset();
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<labelList>::const_iterator iter = allPatchNames.begin();
|
||||
iter != allPatchNames.end();
|
||||
++iter
|
||||
)
|
||||
forAll(allPatchNames, patchi)
|
||||
{
|
||||
const word& patchName = iter.key();
|
||||
const labelList& patchProcessors = iter();
|
||||
const word& patchName = allPatchNames[patchi];
|
||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
||||
|
||||
if (patchNames.empty() || patchNames.found(patchName))
|
||||
{
|
||||
if (patchIndices.found(patchName))
|
||||
if (mesh.boundary()[patchi].size())
|
||||
{
|
||||
label patchI = patchIndices.find(patchName)();
|
||||
|
||||
if
|
||||
(
|
||||
writePatchField
|
||||
(
|
||||
vf.boundaryField()[patchI],
|
||||
patchI,
|
||||
vf.boundaryField()[patchi],
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchI],
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
@ -708,8 +694,8 @@ void ensightFieldBinary
|
||||
|
||||
const cellSets& meshCellSets = eMesh.meshCellSets();
|
||||
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
|
||||
const HashTable<labelList>& allPatchNames = eMesh.allPatchNames();
|
||||
const HashTable<label>& patchIndices = eMesh.patchIndices();
|
||||
const wordList& allPatchNames = eMesh.allPatchNames();
|
||||
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
|
||||
const wordHashSet& patchNames = eMesh.patchNames();
|
||||
const HashTable<ensightMesh::nFacePrimitives>&
|
||||
nPatchPrims = eMesh.nPatchPrims();
|
||||
@ -726,7 +712,11 @@ void ensightFieldBinary
|
||||
{
|
||||
// set the filename of the ensight file
|
||||
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?
|
||||
}
|
||||
|
||||
@ -787,38 +777,62 @@ void ensightFieldBinary
|
||||
}
|
||||
}
|
||||
|
||||
writeAllDataBinary("penta6", 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);
|
||||
writeAllDataBinary
|
||||
(
|
||||
"penta6",
|
||||
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();
|
||||
|
||||
for
|
||||
(
|
||||
HashTable<labelList>::const_iterator iter = allPatchNames.begin();
|
||||
iter != allPatchNames.end();
|
||||
++iter
|
||||
)
|
||||
forAll(allPatchNames, patchi)
|
||||
{
|
||||
const word& patchName = iter.key();
|
||||
const labelList& patchProcessors = iter();
|
||||
const word& patchName = allPatchNames[patchi];
|
||||
const labelList& patchProcessors = allPatchProcs[patchi];
|
||||
|
||||
if (patchNames.empty() || patchNames.found(patchName))
|
||||
{
|
||||
if (patchIndices.found(patchName))
|
||||
if (mesh.boundary()[patchi].size())
|
||||
{
|
||||
label patchI = patchIndices.find(patchName)();
|
||||
|
||||
if
|
||||
(
|
||||
writePatchFieldBinary
|
||||
(
|
||||
vf.boundaryField()[patchI],
|
||||
patchI,
|
||||
vf.boundaryField()[patchi],
|
||||
patchi,
|
||||
ensightPatchI,
|
||||
boundaryFaceSets[patchI],
|
||||
boundaryFaceSets[patchi],
|
||||
nPatchPrims.find(patchName)(),
|
||||
patchProcessors,
|
||||
ensightFile
|
||||
@ -859,6 +873,7 @@ void ensightFieldBinary
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void ensightField
|
||||
(
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "ensightMesh.H"
|
||||
#include "fvMesh.H"
|
||||
#include "globalMeshData.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "cellModeller.H"
|
||||
@ -40,30 +41,25 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class concatPatchNames
|
||||
//- Proxy-class to hold the patch processor list combination operator
|
||||
class concatPatchProcs
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
void operator()
|
||||
(
|
||||
HashTable<labelList>& x,
|
||||
const HashTable<labelList>& y
|
||||
List<labelList>& x,
|
||||
const List<labelList>& y
|
||||
) const
|
||||
{
|
||||
forAllConstIter(HashTable<labelList>, y, iter)
|
||||
forAll(y, i)
|
||||
{
|
||||
HashTable<labelList>::iterator xiter = x.find(iter.key());
|
||||
const labelList& yPatches = y[i];
|
||||
|
||||
if (xiter == x.end())
|
||||
if (yPatches.size())
|
||||
{
|
||||
x.insert(iter.key(), iter());
|
||||
}
|
||||
else
|
||||
{
|
||||
labelList& xPatches = xiter();
|
||||
const labelList& yPatches = iter();
|
||||
labelList& xPatches = x[i];
|
||||
|
||||
label offset = xPatches.size();
|
||||
xPatches.setSize(offset + yPatches.size());
|
||||
@ -76,7 +72,6 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
@ -95,7 +90,7 @@ Foam::ensightMesh::ensightMesh
|
||||
meshCellSets_(mesh_.nCells()),
|
||||
boundaryFaceSets_(mesh_.boundary().size()),
|
||||
allPatchNames_(0),
|
||||
patchIndices_(0),
|
||||
allPatchProcs_(0),
|
||||
patchNames_(0),
|
||||
nPatchPrims_(0)
|
||||
{
|
||||
@ -109,32 +104,24 @@ Foam::ensightMesh::ensightMesh
|
||||
|
||||
if (!args.optionFound("noPatches"))
|
||||
{
|
||||
forAll (mesh_.boundaryMesh(), patchI)
|
||||
{
|
||||
if
|
||||
allPatchNames_ = wordList::subList
|
||||
(
|
||||
typeid(mesh_.boundaryMesh()[patchI])
|
||||
!= typeid(processorPolyPatch)
|
||||
)
|
||||
{
|
||||
if (!allPatchNames_.found(mesh_.boundaryMesh()[patchI].name()))
|
||||
{
|
||||
allPatchNames_.insert
|
||||
(
|
||||
mesh_.boundaryMesh()[patchI].name(),
|
||||
labelList(1, Pstream::myProcNo())
|
||||
mesh_.boundaryMesh().names(), mesh_.boundary().size()
|
||||
- mesh_.globalData().processorPatches().size()
|
||||
);
|
||||
|
||||
patchIndices_.insert
|
||||
(
|
||||
mesh_.boundaryMesh()[patchI].name(),
|
||||
patchI
|
||||
);
|
||||
}
|
||||
allPatchProcs_.setSize(allPatchNames_.size());
|
||||
|
||||
forAll (allPatchProcs_, 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"))
|
||||
{
|
||||
@ -142,7 +129,7 @@ Foam::ensightMesh::ensightMesh
|
||||
|
||||
if (patchNameList.empty())
|
||||
{
|
||||
patchNameList = allPatchNames_.toc();
|
||||
patchNameList = allPatchNames_;
|
||||
}
|
||||
|
||||
forAll (patchNameList, i)
|
||||
@ -230,15 +217,15 @@ Foam::ensightMesh::ensightMesh
|
||||
|
||||
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& quads = boundaryFaceSets_[patchI].quads;
|
||||
labelList& polys = boundaryFaceSets_[patchI].polys;
|
||||
labelList& tris = boundaryFaceSets_[patchi].tris;
|
||||
labelList& quads = boundaryFaceSets_[patchi].quads;
|
||||
labelList& polys = boundaryFaceSets_[patchi].polys;
|
||||
|
||||
tris.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;
|
||||
|
||||
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.nQuads = boundaryFaceSets_[patchI].quads.size();
|
||||
nfp.nPolys = boundaryFaceSets_[patchI].polys.size();
|
||||
nfp.nPoints = mesh.boundaryMesh()[patchi].localPoints().size();
|
||||
nfp.nTris = boundaryFaceSets_[patchi].tris.size();
|
||||
nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
|
||||
nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1052,13 +1037,13 @@ void Foam::ensightMesh::writeAscii
|
||||
|
||||
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 labelList *trisPtr = NULL;
|
||||
@ -1068,14 +1053,13 @@ void Foam::ensightMesh::writeAscii
|
||||
const pointField *patchPointsPtr = 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;
|
||||
quadsPtr = &boundaryFaceSets_[patchI].quads;
|
||||
polysPtr = &boundaryFaceSets_[patchI].polys;
|
||||
trisPtr = &boundaryFaceSets_[patchi].tris;
|
||||
quadsPtr = &boundaryFaceSets_[patchi].quads;
|
||||
polysPtr = &boundaryFaceSets_[patchi].polys;
|
||||
|
||||
patchPointsPtr = &(p.localPoints());
|
||||
patchFacesPtr = &(p.localFaces());
|
||||
@ -1265,7 +1249,7 @@ void Foam::ensightMesh::writeBinary
|
||||
{
|
||||
writeEnsDataBinary("part",ensightGeometryFile);
|
||||
writeEnsDataBinary(1,ensightGeometryFile);
|
||||
writeEnsDataBinary("FOAM cells",ensightGeometryFile);
|
||||
writeEnsDataBinary("internalMesh",ensightGeometryFile);
|
||||
writeEnsDataBinary("coordinates",ensightGeometryFile);
|
||||
writeEnsDataBinary(nPoints,ensightGeometryFile);
|
||||
|
||||
@ -1379,14 +1363,14 @@ void Foam::ensightMesh::writeBinary
|
||||
label ensightPatchI = patchPartOffset_;
|
||||
label iCount = 0;
|
||||
|
||||
forAllConstIter(HashTable<labelList>, allPatchNames_, iter)
|
||||
forAll(allPatchNames_, patchi)
|
||||
{
|
||||
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 labelList *trisPtr = NULL;
|
||||
@ -1396,14 +1380,13 @@ void Foam::ensightMesh::writeBinary
|
||||
const pointField *patchPointsPtr = 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;
|
||||
quadsPtr = &boundaryFaceSets_[patchI].quads;
|
||||
polysPtr = &boundaryFaceSets_[patchI].polys;
|
||||
trisPtr = &boundaryFaceSets_[patchi].tris;
|
||||
quadsPtr = &boundaryFaceSets_[patchi].quads;
|
||||
polysPtr = &boundaryFaceSets_[patchi].polys;
|
||||
|
||||
patchPointsPtr = &(p.localPoints());
|
||||
patchFacesPtr = &(p.localFaces());
|
||||
@ -1424,7 +1407,7 @@ void Foam::ensightMesh::writeBinary
|
||||
writeEnsDataBinary("part",ensightGeometryFile);
|
||||
writeEnsDataBinary(ensightPatchI++,ensightGeometryFile);
|
||||
//writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
|
||||
writeEnsDataBinary(iter.key().c_str(),ensightGeometryFile);
|
||||
writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
|
||||
writeEnsDataBinary("coordinates",ensightGeometryFile);
|
||||
writeEnsDataBinary(nfp.nPoints,ensightGeometryFile);
|
||||
|
||||
|
||||
@ -91,9 +91,9 @@ class ensightMesh
|
||||
|
||||
List<faceSets> boundaryFaceSets_;
|
||||
|
||||
HashTable<labelList> allPatchNames_;
|
||||
wordList allPatchNames_;
|
||||
|
||||
HashTable<label> patchIndices_;
|
||||
List<labelList> allPatchProcs_;
|
||||
|
||||
wordHashSet patchNames_;
|
||||
|
||||
@ -269,14 +269,14 @@ public:
|
||||
return boundaryFaceSets_;
|
||||
}
|
||||
|
||||
const HashTable<labelList>& allPatchNames() const
|
||||
const wordList& allPatchNames() const
|
||||
{
|
||||
return allPatchNames_;
|
||||
}
|
||||
|
||||
const HashTable<label>& patchIndices() const
|
||||
const List<labelList>& allPatchProcs() const
|
||||
{
|
||||
return patchIndices_;
|
||||
return allPatchProcs_;
|
||||
}
|
||||
|
||||
const wordHashSet& patchNames() const
|
||||
|
||||
@ -90,6 +90,9 @@ Usage
|
||||
The quoting is required to avoid shell expansions and to pass the
|
||||
information as a single argument.
|
||||
|
||||
@param -useTimeName \n
|
||||
use the time index in the VTK file name instead of the time index
|
||||
|
||||
Note
|
||||
mesh subset is handled by vtkMesh. Slight inconsistency in
|
||||
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("noFaceZones","");
|
||||
argList::validOptions.insert("noLinks","");
|
||||
argList::validOptions.insert("useTimeName","");
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
@ -250,6 +254,7 @@ int main(int argc, char *argv[])
|
||||
bool doFaceZones = !args.optionFound("noFaceZones");
|
||||
bool doLinks = !args.optionFound("noLinks");
|
||||
bool binary = !args.optionFound("ascii");
|
||||
bool useTimeName = args.optionFound("useTimeName");
|
||||
|
||||
if (binary && (sizeof(floatScalar) != 4 || sizeof(label) != 4))
|
||||
{
|
||||
@ -359,6 +364,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
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
|
||||
// decomposition.
|
||||
polyMesh::readUpdateState meshState = vMesh.readUpdate();
|
||||
@ -388,7 +403,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
fvPath/set.name()/set.name()
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk"
|
||||
);
|
||||
|
||||
@ -411,7 +426,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
fvPath/set.name()/set.name()
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk"
|
||||
);
|
||||
|
||||
@ -548,7 +563,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
fvPath/vtkName
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk"
|
||||
);
|
||||
|
||||
@ -655,7 +670,7 @@ int main(int argc, char *argv[])
|
||||
/"surfaceFields"
|
||||
/"surfaceFields"
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk"
|
||||
);
|
||||
|
||||
@ -689,7 +704,7 @@ int main(int argc, char *argv[])
|
||||
patchFileName =
|
||||
fvPath/"allPatches"/cellSetName
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk";
|
||||
}
|
||||
else
|
||||
@ -697,7 +712,7 @@ int main(int argc, char *argv[])
|
||||
patchFileName =
|
||||
fvPath/"allPatches"/"allPatches"
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk";
|
||||
}
|
||||
|
||||
@ -767,7 +782,7 @@ int main(int argc, char *argv[])
|
||||
patchFileName =
|
||||
fvPath/pp.name()/cellSetName
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk";
|
||||
}
|
||||
else
|
||||
@ -775,7 +790,7 @@ int main(int argc, char *argv[])
|
||||
patchFileName =
|
||||
fvPath/pp.name()/pp.name()
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk";
|
||||
}
|
||||
|
||||
@ -867,7 +882,7 @@ int main(int argc, char *argv[])
|
||||
patchFileName =
|
||||
fvPath/pp.name()/cellSetName
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk";
|
||||
}
|
||||
else
|
||||
@ -875,7 +890,7 @@ int main(int argc, char *argv[])
|
||||
patchFileName =
|
||||
fvPath/pp.name()/pp.name()
|
||||
+ "_"
|
||||
+ name(timeI)
|
||||
+ timeDesc
|
||||
+ ".vtk";
|
||||
}
|
||||
|
||||
@ -931,7 +946,7 @@ int main(int argc, char *argv[])
|
||||
fileName lagrFileName
|
||||
(
|
||||
fvPath/cloud::prefix/cloudDirs[i]/cloudDirs[i]
|
||||
+ "_" + name(timeI) + ".vtk"
|
||||
+ "_" + timeDesc + ".vtk"
|
||||
);
|
||||
|
||||
Info<< " Lagrangian: " << lagrFileName << endl;
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
particleTracks.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/particleTracks
|
||||
@ -0,0 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-llagrangian
|
||||
@ -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"));
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -72,6 +72,7 @@ primitiveLists = primitives/Lists
|
||||
$(primitiveLists)/boolList.C
|
||||
$(primitiveLists)/labelIOList.C
|
||||
$(primitiveLists)/scalarList.C
|
||||
$(primitiveLists)/scalarIOList.C
|
||||
$(primitiveLists)/vectorList.C
|
||||
$(primitiveLists)/sphericalTensorList.C
|
||||
$(primitiveLists)/symmTensorList.C
|
||||
|
||||
@ -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>
|
||||
Foam::IOPtrList<T>::IOPtrList(const IOobject& io, const PtrList<T>& list)
|
||||
:
|
||||
|
||||
@ -70,6 +70,9 @@ public:
|
||||
//- Construct from IOobject
|
||||
IOPtrList(const IOobject&);
|
||||
|
||||
//- Construct from IOobject with given size
|
||||
IOPtrList(const IOobject&, const label);
|
||||
|
||||
//- Construct from IOobject and a PtrList
|
||||
IOPtrList(const IOobject&, const PtrList<T>&);
|
||||
|
||||
|
||||
@ -22,27 +22,25 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Description
|
||||
Declaration of scalar IOList containers
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicReactingParcel.H"
|
||||
#include "ReactingCloud.H"
|
||||
|
||||
#include "SinglePhaseMixture.H"
|
||||
#include "scalarIOList.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeCompositionModel(ReactingCloud<basicReactingParcel>);
|
||||
|
||||
// Add instances of composition model to the table
|
||||
makeCompositionModelType
|
||||
defineTemplateTypeNameAndDebugWithName(scalarIOList, "scalarList", 0);
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
SinglePhaseMixture,
|
||||
ReactingCloud,
|
||||
basicReactingParcel
|
||||
scalarListIOList,
|
||||
"scalarListList",
|
||||
0
|
||||
);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -22,24 +22,30 @@ License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Typedef
|
||||
Foam::scalarIOList
|
||||
|
||||
Description
|
||||
Scalar container classes
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicKinematicParcel.H"
|
||||
#include "KinematicCloud.H"
|
||||
#ifndef scalarIOList_H
|
||||
#define scalarIOList_H
|
||||
|
||||
#include "NoDrag.H"
|
||||
#include "SphereDrag.H"
|
||||
#include "scalarList.H"
|
||||
#include "IOList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
(
|
||||
const wedgePolyPatch&,
|
||||
|
||||
@ -169,6 +169,21 @@ public:
|
||||
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
|
||||
void hitWedgePatch
|
||||
(
|
||||
|
||||
@ -316,18 +316,32 @@ $(laplacianSchemes)/gaussLaplacianScheme/gaussLaplacianSchemes.C
|
||||
|
||||
finiteVolume/fvc/fvcMeshPhi.C
|
||||
|
||||
cfdTools/general/findRefCell/findRefCell.C
|
||||
cfdTools/general/adjustPhi/adjustPhi.C
|
||||
cfdTools/general/bound/bound.C
|
||||
cfdTools/general/porousMedia/porousZone.C
|
||||
cfdTools/general/porousMedia/porousZones.C
|
||||
cfdTools/general/MRF/MRFZone.C
|
||||
cfdTools/general/MRF/MRFZones.C
|
||||
cfdTools/general/fieldSources/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||
cfdTools/general/fieldSources/timeActivatedExplicitSource/timeActivatedExplicitSource.C
|
||||
cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C
|
||||
cfdTools/general/SRF/SRFModel/SRFModel/newSRFModel.C
|
||||
cfdTools/general/SRF/SRFModel/rpm/rpm.C
|
||||
cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
|
||||
general = cfdTools/general
|
||||
$(general)/findRefCell/findRefCell.C
|
||||
$(general)/adjustPhi/adjustPhi.C
|
||||
$(general)/bound/bound.C
|
||||
|
||||
porousMedia = $(general)/porousMedia
|
||||
$(porousMedia)/porousZone.C
|
||||
$(porousMedia)/porousZones.C
|
||||
|
||||
MRF = $(general)/MRF
|
||||
$(MRF)/MRFZone.C
|
||||
$(MRF)/MRFZones.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
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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_;}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -44,33 +44,11 @@ const Foam::NamedEnum<Foam::timeActivatedExplicitSource::volumeType, 2>
|
||||
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 * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
|
||||
(
|
||||
const word& sourceName,
|
||||
const word& name,
|
||||
const fvMesh& mesh,
|
||||
const dimensionSet& dims
|
||||
)
|
||||
@ -79,51 +57,63 @@ Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
sourceName + "Properties",
|
||||
name + "Properties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
sourceName_(sourceName),
|
||||
mesh_(mesh),
|
||||
runTime_(mesh.time()),
|
||||
name_(name),
|
||||
active_(lookup("active")),
|
||||
dimensions_(dims),
|
||||
volumeType_(volumeTypeNames_.read(lookup("volumeType"))),
|
||||
timeStart_(readScalar(lookup("timeStart"))),
|
||||
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();
|
||||
}
|
||||
duration_(readScalar(lookup("duration")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * 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
|
||||
{
|
||||
return timeStart_;
|
||||
@ -136,69 +126,16 @@ 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()
|
||||
{
|
||||
if (regIOobject::read())
|
||||
{
|
||||
lookup("active") >> active_;
|
||||
if (active_)
|
||||
{
|
||||
volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
|
||||
lookup("timeStart") >> duration_;
|
||||
lookup("duration") >> duration_;
|
||||
lookup("onValue") >> onValue_;
|
||||
lookup("offValue") >> offValue_;
|
||||
lookup("cellSource") >> cellSource_;
|
||||
cellSelector_ =
|
||||
topoSetSource::New
|
||||
(
|
||||
cellSource_,
|
||||
mesh_,
|
||||
subDict(cellSource_ + "Coeffs")
|
||||
);
|
||||
updateCellSet();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@ -206,30 +143,13 @@ bool Foam::timeActivatedExplicitSource::read()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -23,15 +23,20 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::timeActivatedExplicitSourceNew
|
||||
Foam::timeActivatedExplicitSource
|
||||
|
||||
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.
|
||||
Base class for field sources. Provides:
|
||||
- name
|
||||
- references to mesh and time
|
||||
- dimensions
|
||||
- volume type
|
||||
- startTime
|
||||
- duration
|
||||
- read (from <sourceName>Properties dictionary)
|
||||
|
||||
SourceFiles
|
||||
timeActivatedExplicitSourceNew.C
|
||||
timeActivatedExplicitSource.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,8 +45,6 @@ SourceFiles
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
#include "topoSetSource.H"
|
||||
#include "cellSet.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "NamedEnum.H"
|
||||
@ -72,19 +75,19 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
// Private Member Functions
|
||||
|
||||
//- Update the cell set that the source is acting on
|
||||
void updateCellSet();
|
||||
//- Disallow default bitwise copy construct
|
||||
timeActivatedExplicitSource(const timeActivatedExplicitSource&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const timeActivatedExplicitSource&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of the source
|
||||
word sourceName_;
|
||||
|
||||
//- Reference to the mesh
|
||||
const fvMesh& mesh_;
|
||||
|
||||
@ -94,6 +97,12 @@ protected:
|
||||
|
||||
// Source properties
|
||||
|
||||
//- Name of the source
|
||||
word name_;
|
||||
|
||||
//- Active flag
|
||||
Switch active_;
|
||||
|
||||
//- Dimensions
|
||||
const dimensionSet dimensions_;
|
||||
|
||||
@ -106,39 +115,6 @@ protected:
|
||||
//- Duration [s]
|
||||
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:
|
||||
|
||||
@ -157,24 +133,33 @@ public:
|
||||
|
||||
// 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
|
||||
scalar timeStart() const;
|
||||
virtual scalar timeStart() const;
|
||||
|
||||
//- Return the duration
|
||||
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;
|
||||
virtual scalar duration() const;
|
||||
|
||||
|
||||
//- Read properties dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Update
|
||||
virtual void update();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -79,6 +79,8 @@ Foam::porousZone::porousZone
|
||||
D_("D", dimensionSet(0, -2, 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())
|
||||
{
|
||||
FatalErrorIn
|
||||
|
||||
@ -45,7 +45,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
|
||||
const labelList& faces = mesh.cells()[celli_];
|
||||
const vector& C = mesh.cellCentres()[celli_];
|
||||
|
||||
labelList faceList(0);
|
||||
DynamicList<label> faceList(10);
|
||||
forAll(faces, i)
|
||||
{
|
||||
label facei = faces[i];
|
||||
@ -53,12 +53,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
|
||||
|
||||
if ((lam > 0) && (lam < 1.0))
|
||||
{
|
||||
label n = faceList.size();
|
||||
faceList.setSize(n+1);
|
||||
faceList[n] = facei;
|
||||
faceList.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
faceList.shrink();
|
||||
|
||||
return faceList;
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
|
||||
const labelList& faces = mesh.cells()[celli];
|
||||
const vector& C = mesh.cellCentres()[celli];
|
||||
|
||||
labelList faceList(0);
|
||||
DynamicList<label> faceList(10);
|
||||
forAll(faces, i)
|
||||
{
|
||||
label facei = faces[i];
|
||||
@ -83,12 +83,12 @@ Foam::labelList Foam::Particle<ParticleType>::findFaces
|
||||
|
||||
if ((lam > 0) && (lam < 1.0))
|
||||
{
|
||||
label n = faceList.size();
|
||||
faceList.setSize(n+1);
|
||||
faceList[n] = facei;
|
||||
faceList.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
faceList.shrink();
|
||||
|
||||
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 * * * * * * * * * * * * * //
|
||||
|
||||
template<class ParticleType>
|
||||
@ -328,6 +339,8 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
|
||||
label patchi = patch(facei_);
|
||||
const polyPatch& patch = mesh.boundaryMesh()[patchi];
|
||||
|
||||
if (!p.hitPatch(patch, td, patchi))
|
||||
{
|
||||
if (isA<wedgePolyPatch>(patch))
|
||||
{
|
||||
p.hitWedgePatch
|
||||
@ -363,21 +376,10 @@ Foam::scalar Foam::Particle<ParticleType>::trackToFace
|
||||
static_cast<const wallPolyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else if (isA<polyPatch>(patch))
|
||||
{
|
||||
p.hitPatch
|
||||
(
|
||||
static_cast<const polyPatch&>(patch), td
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Particle::trackToFace"
|
||||
"(const vector& endPosition, scalar& trackFraction)"
|
||||
)<< "patch type " << patch.type() << " not suported" << nl
|
||||
<< abort(FatalError);
|
||||
p.hitPatch(patch, td);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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 TrackData>
|
||||
void Foam::Particle<ParticleType>::hitWedgePatch
|
||||
|
||||
@ -98,10 +98,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
inline trackData
|
||||
(
|
||||
Cloud<ParticleType>& cloud
|
||||
);
|
||||
inline trackData(Cloud<ParticleType>& cloud);
|
||||
|
||||
|
||||
// Member functions
|
||||
@ -171,6 +168,16 @@ protected:
|
||||
|
||||
// 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
|
||||
template<class TrackData>
|
||||
void hitWedgePatch
|
||||
@ -256,6 +263,11 @@ public:
|
||||
friend class Cloud<ParticleType>;
|
||||
|
||||
|
||||
// Static data members
|
||||
|
||||
//- String representation of properties
|
||||
static string propHeader;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("Particle");
|
||||
|
||||
@ -278,13 +290,23 @@ public:
|
||||
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
|
||||
// parallel transfer
|
||||
class iNew
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Reference to the cloud
|
||||
const Cloud<ParticleType>& cloud_;
|
||||
|
||||
|
||||
@ -303,7 +325,6 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
virtual ~Particle()
|
||||
{}
|
||||
|
||||
@ -344,6 +365,9 @@ public:
|
||||
//- Return the impact model to be used, soft or hard (default).
|
||||
inline bool softImpact() const;
|
||||
|
||||
//- Return the particle current time
|
||||
inline scalar currentTime() const;
|
||||
|
||||
|
||||
// Check
|
||||
|
||||
@ -414,10 +438,7 @@ public:
|
||||
// I-O
|
||||
|
||||
//- Write the fields associated with the owner cloud
|
||||
static void writeFields
|
||||
(
|
||||
const Cloud<ParticleType>& c
|
||||
);
|
||||
static void writeFields(const Cloud<ParticleType>& c);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
@ -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>
|
||||
inline label Particle<ParticleType>::patch(const label facei) const
|
||||
{
|
||||
|
||||
@ -28,6 +28,12 @@ License
|
||||
#include "IOstreams.H"
|
||||
#include "IOPosition.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
template<class ParticleType>
|
||||
Foam::string Foam::Particle<ParticleType>::propHeader = "(Px Py Pz) cellI";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from Istream
|
||||
|
||||
@ -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"
|
||||
|
||||
// ************************************************************************* //
|
||||
166
src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.H
Normal file
166
src/lagrangian/basic/ParticleTrackingData/ParticleTrackingData.H
Normal 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -87,6 +87,12 @@ public:
|
||||
Particle<indexedParticle>(c, is)
|
||||
{}
|
||||
|
||||
//- Construct as a copy
|
||||
indexedParticle(const indexedParticle& p)
|
||||
:
|
||||
Particle<indexedParticle>(p)
|
||||
{}
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<indexedParticle> clone() const
|
||||
{
|
||||
|
||||
@ -81,6 +81,12 @@ public:
|
||||
Particle<passiveParticle>(c, is)
|
||||
{}
|
||||
|
||||
//- Construct as copy
|
||||
passiveParticle(const passiveParticle& p)
|
||||
:
|
||||
Particle<passiveParticle>(p)
|
||||
{}
|
||||
|
||||
//- Construct and return a clone
|
||||
autoPtr<passiveParticle> clone() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,53 +24,46 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coalCloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(coalCloud, 0);
|
||||
};
|
||||
|
||||
#include "CoalCloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coalCloud::coalCloud
|
||||
template<class ThermoType>
|
||||
Foam::CoalCloud<ThermoType>::CoalCloud
|
||||
(
|
||||
const word& cloudType,
|
||||
const word& cloudName,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const dimensionedVector& g,
|
||||
hCombustionThermo& thermo,
|
||||
PtrList<specieReactingProperties>& gases
|
||||
hCombustionThermo& thermo
|
||||
)
|
||||
:
|
||||
ReactingMultiphaseCloud<coalParcel>
|
||||
ReactingMultiphaseCloud<CoalParcel<ThermoType> >
|
||||
(
|
||||
cloudType,
|
||||
cloudName,
|
||||
rho,
|
||||
U,
|
||||
g,
|
||||
thermo,
|
||||
gases
|
||||
thermo
|
||||
)
|
||||
{
|
||||
coalParcel::readFields(*this);
|
||||
CoalParcel<ThermoType>::readFields(*this);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coalCloud::~coalCloud()
|
||||
template<class ThermoType>
|
||||
Foam::CoalCloud<ThermoType>::~CoalCloud()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::coalCloud::writeFields() const
|
||||
template<class ThermoType>
|
||||
void Foam::CoalCloud<ThermoType>::writeFields() const
|
||||
{
|
||||
coalParcel::writeFields(*this);
|
||||
CoalParcel<ThermoType>::writeFields(*this);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,20 +23,20 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
coalCloud
|
||||
CoalCloud
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
coalCloud.C
|
||||
CoalCloud.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coalCloud_H
|
||||
#define coalCloud_H
|
||||
#ifndef CoalCloud_H
|
||||
#define CoalCloud_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
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
coalCloud(const coalCloud&);
|
||||
CoalCloud(const CoalCloud&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const coalCloud&);
|
||||
void operator=(const CoalCloud&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//-Runtime type information
|
||||
TypeName("coalCloud");
|
||||
TypeName("CoalCloud");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct given carrier gas fields
|
||||
coalCloud
|
||||
CoalCloud
|
||||
(
|
||||
const word& cloudType,
|
||||
const word& cloudName,
|
||||
const volScalarField& rho,
|
||||
const volVectorField& U,
|
||||
const dimensionedVector& g,
|
||||
hCombustionThermo& thermo,
|
||||
PtrList<specieReactingProperties>& gases
|
||||
hCombustionThermo& thermo
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~coalCloud();
|
||||
~CoalCloud();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -97,6 +97,12 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "CoalCloud.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,24 +24,14 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coalParcel.H"
|
||||
#include "ReactingCloud.H"
|
||||
|
||||
#include "SingleMixtureFraction.H"
|
||||
#include "createReactingCloudTypes.H"
|
||||
#include "CoalCloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeCompositionModel(ReactingCloud<coalParcel>);
|
||||
|
||||
// Add instances of composition model to the table
|
||||
makeCompositionModelType
|
||||
(
|
||||
SingleMixtureFraction,
|
||||
ReactingCloud,
|
||||
coalParcel
|
||||
);
|
||||
createReactingCloudType(CoalCloud);
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,25 +24,28 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coalParcel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(coalParcel, 0);
|
||||
defineParticleTypeNameAndDebug(coalParcel, 0);
|
||||
defineParcelTypeNameAndDebug(coalParcel, 0);
|
||||
};
|
||||
|
||||
#include "CoalParcel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coalParcel::coalParcel
|
||||
template<class ThermoType>
|
||||
Foam::CoalParcel<ThermoType>::CoalParcel
|
||||
(
|
||||
ReactingMultiphaseCloud<coalParcel>& owner,
|
||||
ReactingMultiphaseCloud<CoalParcel<ThermoType> >& owner,
|
||||
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 scalar nParticle0,
|
||||
const scalar d0,
|
||||
@ -51,14 +54,16 @@ Foam::coalParcel::coalParcel
|
||||
const scalarField& YGas0,
|
||||
const scalarField& YLiquid0,
|
||||
const scalarField& YSolid0,
|
||||
const constantProperties& constProps
|
||||
const typename
|
||||
ReactingMultiphaseParcel<CoalParcel<ThermoType> >::
|
||||
constantProperties& constProps
|
||||
)
|
||||
:
|
||||
ReactingMultiphaseParcel<coalParcel>
|
||||
ReactingMultiphaseParcel<CoalParcel<ThermoType> >
|
||||
(
|
||||
owner,
|
||||
position,
|
||||
celli,
|
||||
cellI,
|
||||
typeId,
|
||||
nParticle0,
|
||||
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,
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
ReactingMultiphaseParcel<coalParcel>(cloud, is, readFields)
|
||||
ReactingMultiphaseParcel<CoalParcel<ThermoType> >(cloud, is, readFields)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::coalParcel::~coalParcel()
|
||||
template<class ThermoType>
|
||||
Foam::CoalParcel<ThermoType>::~CoalParcel()
|
||||
{}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,19 +23,19 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
coalParcel
|
||||
CoalParcel
|
||||
|
||||
Description
|
||||
|
||||
|
||||
SourceFiles
|
||||
coalParcel.C
|
||||
coalParcelIO.C
|
||||
CoalParcel.C
|
||||
CoalParcelIO.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef coalParcel_H
|
||||
#define coalParcel_H
|
||||
#ifndef CoalParcel_H
|
||||
#define CoalParcel_H
|
||||
|
||||
#include "ReactingMultiphaseParcel.H"
|
||||
|
||||
@ -44,27 +44,44 @@ SourceFiles
|
||||
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:
|
||||
|
||||
//- The type of thermodynamics this parcel was instantiated for
|
||||
typedef ThermoType thermoType;
|
||||
|
||||
// Run-time type information
|
||||
TypeName("coalParcel");
|
||||
TypeName("CoalParcel");
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
coalParcel
|
||||
//- Construct from owner, position, and cloud owner
|
||||
// Other properties initialised as null
|
||||
CoalParcel
|
||||
(
|
||||
ReactingMultiphaseCloud<coalParcel>& owner,
|
||||
ReactingMultiphaseCloud<CoalParcel>& owner,
|
||||
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 scalar nParticle0,
|
||||
const scalar d0,
|
||||
@ -73,42 +90,43 @@ public:
|
||||
const scalarField& YGas0,
|
||||
const scalarField& YLiquid0,
|
||||
const scalarField& YSolid0,
|
||||
const constantProperties& constProps
|
||||
const typename
|
||||
ReactingMultiphaseParcel<CoalParcel>::
|
||||
constantProperties& constProps
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
coalParcel
|
||||
CoalParcel
|
||||
(
|
||||
const Cloud<coalParcel>& c,
|
||||
const Cloud<CoalParcel>& c,
|
||||
Istream& is,
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
//- 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
|
||||
virtual ~coalParcel();
|
||||
virtual ~CoalParcel();
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
inline bool contiguous<coalParcel>()
|
||||
{
|
||||
return false; // Now have scalar lists/fields (mass fractions)
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "CoalParcel.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,21 +24,14 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "coalParcel.H"
|
||||
#include "KinematicCloud.H"
|
||||
|
||||
#include "NoDrag.H"
|
||||
#include "SphereDrag.H"
|
||||
#include "createCoalParcelTypes.H"
|
||||
#include "CoalParcel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeDragModel(KinematicCloud<coalParcel>);
|
||||
|
||||
// Add instances of drag model to the table
|
||||
makeDragModelType(NoDrag, KinematicCloud, coalParcel);
|
||||
makeDragModelType(SphereDrag, KinematicCloud, coalParcel);
|
||||
createCoalParcelType(CoalParcel);
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,44 +24,47 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "basicKinematicParcel.H"
|
||||
#include "KinematicCloud.H"
|
||||
#include "CoalParcel.H"
|
||||
|
||||
#include "NoDispersion.H"
|
||||
#include "GradientDispersionRAS.H"
|
||||
#include "StochasticDispersionRAS.H"
|
||||
// Kinematic
|
||||
#include "makeReactingParcelDispersionModels.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
|
||||
{
|
||||
makeDispersionModel(KinematicCloud<basicKinematicParcel>);
|
||||
// Kinematic sub-models
|
||||
makeReactingDispersionModels(CoalParcel);
|
||||
makeReactingDragModels(CoalParcel);
|
||||
makeReactingMultiphaseInjectionModels(CoalParcel);
|
||||
makeReactingPatchInteractionModels(CoalParcel);
|
||||
makeReactingPostProcessingModels(CoalParcel);
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
DispersionRASModel<KinematicCloud<basicKinematicParcel> >,
|
||||
0
|
||||
);
|
||||
// Thermo sub-models
|
||||
makeReactingHeatTransferModels(CoalParcel);
|
||||
|
||||
// Add instances of dispersion model to the table
|
||||
makeDispersionModelType
|
||||
(
|
||||
NoDispersion,
|
||||
KinematicCloud,
|
||||
basicKinematicParcel
|
||||
);
|
||||
makeDispersionModelType
|
||||
(
|
||||
GradientDispersionRAS,
|
||||
KinematicCloud,
|
||||
basicKinematicParcel
|
||||
);
|
||||
makeDispersionModelType
|
||||
(
|
||||
StochasticDispersionRAS,
|
||||
KinematicCloud,
|
||||
basicKinematicParcel
|
||||
);
|
||||
// Reacting sub-models
|
||||
makeReactingMultiphaseCompositionModels(CoalParcel);
|
||||
makeReactingPhaseChangeModels(CoalParcel);
|
||||
|
||||
// Reacting multiphase sub-models
|
||||
makeReactingMultiphaseDevolatilisationModels(CoalParcel);
|
||||
makeCoalSurfaceReactionModels(CoalParcel);
|
||||
};
|
||||
|
||||
|
||||
@ -1,22 +1,8 @@
|
||||
/* coal cloud */
|
||||
coalCloud/coalCloud.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 cloud */
|
||||
CoalCloud/defineCoalCloud.C
|
||||
|
||||
/* Coal parcel and sub-models */
|
||||
CoalParcel/defineCoalParcel.C
|
||||
CoalParcel/makeCoalParcelSubmodels.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libcoalCombustion
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,18 +28,14 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::COxidationDiffusionLimitedRate::COxidationDiffusionLimitedRate
|
||||
template<class CloudType>
|
||||
Foam::COxidationDiffusionLimitedRate<CloudType>::COxidationDiffusionLimitedRate
|
||||
(
|
||||
const dictionary& dict,
|
||||
ReactingMultiphaseCloud<coalParcel>& owner
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
SurfaceReactionModel<ReactingMultiphaseCloud<coalParcel> >
|
||||
(
|
||||
dict,
|
||||
owner,
|
||||
typeName
|
||||
),
|
||||
SurfaceReactionModel<CloudType>(dict, owner, typeName),
|
||||
Sb_(dimensionedScalar(this->coeffDict().lookup("Sb")).value()),
|
||||
D_(dimensionedScalar(this->coeffDict().lookup("D")).value()),
|
||||
CsLocalId_(-1),
|
||||
@ -63,10 +59,10 @@ Foam::COxidationDiffusionLimitedRate::COxidationDiffusionLimitedRate
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"COxidationDiffusionLimitedRate"
|
||||
"COxidationDiffusionLimitedRate<CloudType>"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"ReactingMultiphaseCloud<coalParcel>&"
|
||||
"CloudType&"
|
||||
")"
|
||||
) << "Stoichiometry of reaction, Sb, must be greater than zero" << nl
|
||||
<< exit(FatalError);
|
||||
@ -76,19 +72,23 @@ Foam::COxidationDiffusionLimitedRate::COxidationDiffusionLimitedRate
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::COxidationDiffusionLimitedRate::~COxidationDiffusionLimitedRate()
|
||||
template<class CloudType>
|
||||
Foam::COxidationDiffusionLimitedRate<CloudType>::
|
||||
~COxidationDiffusionLimitedRate()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::COxidationDiffusionLimitedRate::active() const
|
||||
template<class CloudType>
|
||||
bool Foam::COxidationDiffusionLimitedRate<CloudType>::active() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::COxidationDiffusionLimitedRate::calculate
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate
|
||||
(
|
||||
const scalar dt,
|
||||
const label cellI,
|
||||
@ -110,7 +110,8 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate::calculate
|
||||
) const
|
||||
{
|
||||
// Fraction of remaining combustible material
|
||||
const scalar fComb = YMixture[coalParcel::SLD]*YSolid[CsLocalId_];
|
||||
const label idSolid = CloudType::parcelType::SLD;
|
||||
const scalar fComb = YMixture[idSolid]*YSolid[CsLocalId_];
|
||||
|
||||
// Surface combustion active combustible fraction is consumed
|
||||
if (fComb < SMALL)
|
||||
@ -120,7 +121,7 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate::calculate
|
||||
|
||||
// Local mass fraction of O2 in the carrier phase
|
||||
const scalar YO2 =
|
||||
owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
|
||||
this->owner().carrierThermo().composition().Y(O2GlobalId_)[cellI];
|
||||
|
||||
// Change in C mass [kg]
|
||||
scalar dmC =
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user