Merge branch 'master' into dsmc

This commit is contained in:
graham
2009-06-17 14:38:47 +01:00
925 changed files with 28297 additions and 7557 deletions

9
README
View File

@ -14,11 +14,10 @@
General Public License terms under which you can copy the files.
* System requirements
OpenFOAM is developed and tested on Linux, but should work with other Unix
style systems. To check your system setup, execute the foamSystemCheck script
in the bin/ directory of the OpenFOAM installation. If no problems are
reported, proceed to "3. Installation"; otherwise contact your system
administrator.
OpenFOAM is developed and tested on Linux, but should work with other POSIX
systems. To check your system setup, execute the foamSystemCheck script in
the bin/ directory of the OpenFOAM installation. If no problems are reported,
proceed to "3. Installation"; otherwise contact your system administrator.
If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the
section "Running OpenFOAM in 32-bit mode".

View File

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

View File

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

View File

@ -0,0 +1,37 @@
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)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lcompressibleRASModels \
-lcompressibleLESModels \
-llagrangian \
-llagrangianIntermediate \
-lspecie \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lthermophysicalFunctions \
-lcombustionThermophysicalModels \
-lchemistryModel \
-lradiation \
-lODE

View File

@ -0,0 +1,16 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
rho.dimensionedInternalField()*g
+ parcels.SU()
);
UEqn.relax();
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View File

@ -0,0 +1,43 @@
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)
==
parcels.Srho(i)
+ kappa*chemistry.RR(i)().dimensionedInternalField()
);
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,90 @@
Info<< "Reading thermophysical properties\n" << 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<< "\nReading field U\n" << 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\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
)
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info << "Constructing chemical mechanism" << endl;
chemistryModel chemistry
(
thermo(),
rho
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll (Y, i)
{
fields.add(Y[i]);
}
fields.add(h);

View File

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

View File

@ -0,0 +1,72 @@
rho = thermo->rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*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++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
==
parcels.Srho()
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi == pEqn.flux();
}
}
}
else
{
phi =
fvc::interpolate(rho)*
(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, p)
==
parcels.Srho()
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Application
reactingParcelFoam
Description
Transient PISO solver for compressible, laminar or turbulent flow with
reacting Lagrangian parcels.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "turbulenceModel.H"
#include "basicReactingCloud.H"
#include "chemistryModel.H"
#include "chemistrySolver.H"
#include "ReactingCloudThermoTypes.H"
#include "radiationModel.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 "createClouds.H"
#include "createRadiationModel.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;
parcels.evolve();
parcels.info();
#include "chemistry.H"
#include "rhoEqn.H"
// --- PIMPLE loop
for (int ocorr=1; ocorr<=nOuterCorr; ocorr++)
{
#include "UEqn.H"
#include "YEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
#include "hEqn.H"
#include "pEqn.H"
}
Info<< "T gas min/max = " << min(T).value() << ", "
<< max(T).value() << endl;
}
turbulence->correct();
rho = thermo->rho();
if (runTime.write())
{
#include "additionalOutput.H"
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return(0);
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Global
rhoEqn
Description
Solve the continuity for density.
\*---------------------------------------------------------------------------*/
{
solve
(
fvm::ddt(rho)
+ fvc::div(phi)
==
parcels.Srho()
);
}
// ************************************************************************* //

View File

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

View File

@ -6,7 +6,8 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
EXE_LIBS = \
-llagrangian \

View File

@ -47,11 +47,7 @@
);
word kinematicCloudName("kinematicCloud");
if (args.options().found("cloudName"))
{
kinematicCloudName = args.options()["cloudName"];
}
args.optionReadIfPresent("cloudName", kinematicCloudName);
Info<< "Constructing kinematicCloud " << kinematicCloudName << endl;
basicKinematicCloud kinematicCloud

View File

@ -97,7 +97,7 @@ int main(int argc, char *argv[])
U.write();
phi.write();
if (args.options().found("writep"))
if (args.optionFound("writep"))
{
p.write();
}

View File

@ -0,0 +1,3 @@
coalChemistryFoam.C
EXE = $(FOAM_USER_APPBIN)/coalChemistryFoam

View File

@ -0,0 +1,40 @@
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 = \
-L$(FOAM_USER_LIBBIN) \
-lfiniteVolume \
-lmeshTools \
-lcompressibleRASModels \
-lcompressibleLESModels \
-llagrangian \
-llagrangianIntermediate \
-lcoalCombustion\
-lspecie \
-lbasicThermophysicalModels \
-lliquids \
-lliquidMixture \
-lsolids \
-lsolidMixture \
-lthermophysicalFunctions \
-lcombustionThermophysicalModels \
-lchemistryModel \
-lradiation \
-lODE

View File

@ -0,0 +1,17 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
rho.dimensionedInternalField()*g
+ coalParcels.SU()
+ limestoneParcels.SU()
);
UEqn.relax();
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View File

@ -0,0 +1,43 @@
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)
==
coalParcels.Srho(i)
+ kappa*chemistry.RR(i)().dimensionedInternalField()
);
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
Y[inertIndex].max(0.0);
}

View File

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

View File

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

View File

@ -0,0 +1,136 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Application
coalChemistryFoam
Description
Transient solver for compressible, turbulent flow with coal and
limestone parcel injections, and combustion.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "turbulenceModel.H"
#include "basicThermoCloud.H"
#include "coalCloud.H"
#include "chemistryModel.H"
#include "chemistrySolver.H"
#include "ReactingCloudThermoTypes.H"
#include "timeActivatedExplicitSource.H"
#include "radiationModel.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 "createClouds.H"
#include "createRadiationModel.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;
rhoEffLagrangian = coalParcels.rhoEff() + limestoneParcels.rhoEff();
pDyn = 0.5*rho*magSqr(U);
coalParcels.evolve();
coalParcels.info();
Info<< endl;
limestoneParcels.evolve();
limestoneParcels.info();
Info<< endl;
#include "chemistry.H"
#include "rhoEqn.H"
// --- PIMPLE loop
for (int ocorr=1; ocorr<=nOuterCorr; ocorr++)
{
#include "UEqn.H"
#include "YEqn.H"
#include "hEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
#include "pEqn.H"
}
Info<< "T gas min/max = " << min(T).value() << ", "
<< max(T).value() << endl;
}
turbulence->correct();
enthalpySource.update();
rho = thermo->rho();
if (runTime.write())
{
#include "additionalOutput.H"
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return(0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
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
(
"coalCloud1",
rho,
U,
g,
thermo(),
gasProperties
);
Info<< "\nConstructing limestone cloud" << endl;
basicThermoCloud limestoneParcels
(
"limestoneCloud1",
rho,
U,
g,
thermo()
);

View File

@ -0,0 +1,129 @@
Info<< "Reading thermophysical properties\n" << 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()
);
// lagrangian effective density field - used externally (optional)
volScalarField rhoEffLagrangian
(
IOobject
(
"rhoEffLagrangian",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimDensity, 0.0)
);
// dynamic pressure field - used externally (optional)
volScalarField pDyn
(
IOobject
(
"pDyn",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimPressure, 0.0)
);
Info<< "\nReading field U\n" << 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\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo()
)
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
Info<< "\nConstructing explicit enthalpy source" << endl;
timeActivatedExplicitSource enthalpySource
(
"enthalpySource",
mesh,
h.dimensions()*phi.dimensions()/mesh.V().dimensions()
);
Info << "Constructing chemical mechanism" << endl;
chemistryModel chemistry
(
thermo(),
rho
);
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
forAll (Y, i)
{
fields.add(Y[i]);
}
fields.add(h);

View File

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

View File

@ -0,0 +1,72 @@
rho = thermo->rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*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++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
==
coalParcels.Srho()
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi == pEqn.flux();
}
}
}
else
{
phi =
fvc::interpolate(rho)*
(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, p)
==
coalParcels.Srho()
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

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

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Global
rhoEqn
Description
Solve the continuity for density.
\*---------------------------------------------------------------------------*/
{
solve
(
fvm::ddt(rho)
+ fvc::div(phi)
==
coalParcels.Srho()
);
}
// ************************************************************************* //

View File

@ -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) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -7,8 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-linterfaceProperties \
@ -18,5 +17,4 @@ EXE_LIBS = \
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools \
-ldynamicFvMesh \
-lsampling
-ldynamicFvMesh

View File

@ -116,34 +116,23 @@
pd + rho*(g & mesh.C())
);
autoPtr<probes> pRefProbe;
label pdRefCell = 0;
scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue);
scalar pRefValue = 0.0;
if (pd.needReference())
{
pRefProbe.set
(
new probes
(
"pRefProbe",
mesh,
mesh.solutionDict().subDict("PISO").subDict("pRefProbe")
)
);
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
pdRefCell = pRefProbe->cells()[0];
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - pRefProbe->sample<scalar>("p")()[0]
pRefValue - getRefCellValue(p, pdRefCell)
);
}

View File

@ -40,7 +40,6 @@ Description
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"
#include "turbulenceModel.H"
#include "probes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -123,7 +122,7 @@ int main(int argc, char *argv[])
(
"p",
p.dimensions(),
pRefValue - pRefProbe->sample<scalar>("p")()[0]
pRefValue - getRefCellValue(p, pdRefCell)
);
}

View File

@ -106,6 +106,23 @@
scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue);
scalar pRefValue = 0.0;
if (pd.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
// Construct interface from alpha1 distribution
interfaceProperties interface(alpha1, U, twoPhaseProperties);

View File

@ -91,6 +91,16 @@ int main(int argc, char *argv[])
p = pd + rho*gh;
if (pd.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
turbulence->correct();
runTime.write();

View File

@ -68,6 +68,23 @@
scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue);
scalar pRefValue = 0.0;
if (pd.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
// Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence

View File

@ -83,6 +83,16 @@ int main(int argc, char *argv[])
p = pd + rho*gh;
if (pd.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
turbulence->correct();
runTime.write();

View File

@ -95,6 +95,23 @@
scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue);
scalar pRefValue = 0.0;
if (pd.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
// Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence

View File

@ -75,6 +75,16 @@ int main(int argc, char *argv[])
p = pd + rho*gh;
if (pd.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
turbulence->correct();
runTime.write();

View File

@ -160,18 +160,33 @@ int main(int argc, char *argv[])
<< " " << lstB.size() << endl;
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
<< " " << dlD.size() << "/" << dlD.capacity() << endl;
DynamicList<label,10> dlE1(10);
DynamicList<label> dlE2(dlE1);
DynamicList<label> dlE2(dlE1); // construct dissimilar
Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: "
<< " " << dlE1.size() << "/" << dlE1.capacity() << endl;
Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: "
<< " " << dlE2.size() << "/" << dlE2.capacity() << endl;
dlE2.append(100);
for (label elemI=0; elemI < 5; ++elemI)
{
dlE1.append(4 - elemI);
dlE2.append(elemI);
}
Info<< "<dlE2>" << dlE2 << "</dlE2>" << endl;
DynamicList<label> dlE3(dlE2); // construct identical
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
dlE3 = dlE1; // assign dissimilar
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
dlE3 = dlE2; // assign identical
Info<< "<dlE3>" << dlE3 << "</dlE3>" << endl;
Info<< "\nEnd\n";
return 0;

View File

@ -39,7 +39,7 @@ using namespace Foam;
int main()
{
HASHTABLE_CLASS<double> table1(100);
HASHTABLE_CLASS<double> table1(13);
table1.insert("aaa", 1.0);
table1.insert("aba", 2.0);
@ -56,7 +56,8 @@ int main()
table1.erase("abs");
Info<< "\ntable1 toc: " << table1.toc() << endl;
Info<< "\ntable1 [" << table1.size() << "] " << endl;
table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl;
forAllIter(HASHTABLE_CLASS<double>, table1, iter)
{
Info<< iter.key() << " => " << iter() << nl;
@ -97,7 +98,7 @@ int main()
<< "transfer table1 -> table3 via the xfer() method" << nl;
Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table1 << nl
<< "\ntable2" << table2 << nl
<< "\ntable3" << table3 << nl;
Info<< "\nerase table2 by iterator" << nl;
@ -113,10 +114,14 @@ int main()
<< "\ntable3" << table3 << nl;
table3.resize(1);
Info<< "\nresize(1) table3" << table3 << nl;
Info<< "\nresize(1) table3" << nl;
table3.printInfo(Info)
<< table3 << nl;
table3.resize(10000);
Info<< "\nresize(10000) table3" << table3 << nl;
Info<< "\nresize(10000) table3" << nl;
table3.printInfo(Info)
<< table3 << nl;
HASHTABLE_CLASS<double> table4;
@ -134,26 +139,27 @@ int main()
table1.erase(table1.begin());
Info<< "removed an element - test table1 != table3 : "
<< (table1 != table3) << nl;
// insert a few things into table2
table2.set("ada", 14.0);
table2.set("aeq", 15.0);
table2.set("aaw", 16.0);
table2.set("abs", 17.0);
table2.set("adx", 20.0);
Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
label nErased = table1.erase(table2);
Info<< "\nerase table2 keys from table1 (removed "
<< nErased << " elements)" << nl
<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
Info<< "\nclearStorage table3 ... ";
Info<< "\ntable3" << table3
<< "\nclearStorage table3 ... ";
table3.clearStorage();
Info<< table3 << nl;

View File

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/
#include "OSspecific.H"
#include "argList.H"
#include "wordReList.H"
#include "IOstreams.H"
#include "IStringStream.H"
@ -38,11 +40,21 @@ Description
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::noParallel();
argList::validOptions.insert("reList", "reList");
argList::validOptions.insert("wordList", "wordList");
argList::validOptions.insert("stringList", "stringList");
argList::validOptions.insert("float", "xx");
argList::validOptions.insert("flag", "");
# include "setRootCase.H"
List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl;
@ -69,6 +81,43 @@ int main(int argc, char *argv[])
Info<< "Elements " << map << " out of " << list3
<< " => " << subList3 << endl;
wordReList reLst;
wordList wLst;
stringList sLst;
scalar xxx(-1);
if (args.optionFound("flag"))
{
Info<<"-flag:" << args.option("flag") << endl;
}
if (args.optionReadIfPresent<scalar>("float", xxx))
{
Info<<"read float " << xxx << endl;
}
if (args.optionFound("reList"))
{
reLst = args.optionReadList<wordRe>("reList");
}
if (args.optionFound("wordList"))
{
wLst = args.optionReadList<word>("wordList");
}
if (args.optionFound("stringList"))
{
sLst = args.optionReadList<string>("stringList");
}
Info<< nl
<< "-reList: " << reLst << nl
<< "-wordList: " << wLst << nl
<< "-stringList: " << sLst << endl;
return 0;
}

View File

@ -0,0 +1,2 @@
POSIXTest.C
EXE = $(FOAM_USER_APPBIN)/POSIXTest

View File

@ -39,7 +39,7 @@ using namespace Foam;
int main()
{
HASHTABLE_CLASS<double> table1(100);
HASHTABLE_CLASS<double> table1(13);
table1.insert("aaa", 1.0);
table1.insert("aba", 2.0);
@ -56,7 +56,8 @@ int main()
table1.erase("abs");
Info<< "\ntable1 toc: " << table1.toc() << endl;
Info<< "\ntable1 [" << table1.size() << "] " << endl;
table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl;
forAllIter(HASHTABLE_CLASS<double>, table1, iter)
{
Info<< iter.key() << " => " << iter() << nl;
@ -97,7 +98,7 @@ int main()
<< "transfer table1 -> table3 via the xfer() method" << nl;
Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table1 << nl
<< "\ntable2" << table2 << nl
<< "\ntable3" << table3 << nl;
Info<< "\nerase table2 by iterator" << nl;
@ -113,10 +114,14 @@ int main()
<< "\ntable3" << table3 << nl;
table3.resize(1);
Info<< "\nresize(1) table3" << table3 << nl;
Info<< "\nresize(1) table3" << nl;
table3.printInfo(Info)
<< table3 << nl;
table3.resize(10000);
Info<< "\nresize(10000) table3" << table3 << nl;
Info<< "\nresize(10000) table3" << nl;
table3.printInfo(Info)
<< table3 << nl;
HASHTABLE_CLASS<double> table4;
@ -134,26 +139,27 @@ int main()
table1.erase(table1.begin());
Info<< "removed an element - test table1 != table3 : "
<< (table1 != table3) << nl;
// insert a few things into table2
table2.set("ada", 14.0);
table2.set("aeq", 15.0);
table2.set("aaw", 16.0);
table2.set("abs", 17.0);
table2.set("adx", 20.0);
Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
label nErased = table1.erase(table2);
Info<< "\nerase table2 keys from table1 (removed "
<< nErased << " elements)" << nl
<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl;
Info<< "\nclearStorage table3 ... ";
Info<< "\ntable3" << table3
<< "\nclearStorage table3 ... ";
table3.clearStorage();
Info<< table3 << nl;
@ -162,4 +168,5 @@ int main()
return 0;
}
// ************************************************************************* //

View File

@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "UIndirectList.H"
#include "DynamicList.H"
#include "IOstreams.H"
#include "ListOps.H"
#include "OFstream.H"
@ -58,11 +59,11 @@ int main(int argc, char *argv[])
idl[1] = -666;
Info<< "idl[1] changed:" << idl << endl;
Info<< "idl[1] changed: " << idl << endl;
idl = -999;
Info<< "idl changed:" << idl << endl;
Info<< "idl changed: " << idl << endl;
UIndirectList<double> idl2(idl);
@ -79,17 +80,26 @@ int main(int argc, char *argv[])
idl = ident;
}
Info<< "idl assigned from UList:" << idl << endl;
Info<< "idl assigned from UList: " << idl << endl;
List<double> realList = UIndirectList<double>(completeList, addresses);
// test List operations
Info<< "realList:" << realList << endl;
List<double> flatList = UIndirectList<double>(completeList, addresses);
Info<< "List assigned from UIndirectList: " << flatList << endl;
List<double> realList2(UIndirectList<double>(completeList, addresses));
List<double> flatList2(UIndirectList<double>(completeList, addresses));
Info<< "List constructed from UIndirectList: " << flatList2 << endl;
Info<< "realList2:" << realList2 << endl;
flatList.append(UIndirectList<double>(completeList, addresses));
Info<< "List::append(UIndirectList): " << flatList << endl;
DynamicList<double> dynList(UIndirectList<double>(completeList, addresses));
Info<< "DynamicList constructed from UIndirectList: " << dynList << endl;
dynList.append(UIndirectList<double>(completeList, addresses));
Info<< "DynamicList::append(UIndirectList): " << dynList << endl;
Info << "\nEnd\n" << endl;
return 0;

View File

@ -1,2 +0,0 @@
UnixTest.C
EXE = $(FOAM_USER_APPBIN)/UnixTest

View File

@ -52,10 +52,17 @@ int main(int argc, char *argv[])
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc() << endl;
// copy back
dict1 = dict2;
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << endl;
dictionary dict3(dict2.subDictPtr("boundaryField"));
dictionary dict4(dict2.subDictPtr("NONEXISTENT"));
Info<< "dictionary construct from pointer" << nl
<< "ok = " << dict3.name() << " " << dict3.toc() << nl
<< "no = " << dict4.name() << " " << dict4.toc() << endl;
}

View File

@ -1,23 +1,28 @@
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputMode merge
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 1;
// use 'protect' to supply defaults
#inputMode protect
internalField uniform 10;
dimensions [ 0 2 -2 0 0 0 0 ];
#inputMode merge
active
{
type turbulentIntensityKineticEnergyInlet;
@ -31,6 +36,7 @@ inactive
type zeroGradient;
}
boundaryField
{
Default_Boundary_Region
@ -101,4 +107,4 @@ baz
// this should work too
#remove ( bar baz )
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,19 +1,18 @@
/*-------------------------------*- C++ -*---------------------------------*\
| ========= |
| \\ / OpenFOAM |
| \\ / |
| \\ / The Open Source CFD Toolbox |
| \\/ http://www.OpenFOAM.org |
\*-------------------------------------------------------------------------*/
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: Any |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object testDict;
version 2.0;
format ascii;
class dictionary;
object testDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
boundaryField
{
@ -27,4 +26,4 @@ boundaryField
}
#inputMode overwrite
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -465,7 +465,7 @@ int main(int argc, char *argv[])
scalar minLen(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);

View File

@ -448,19 +448,12 @@ int main(int argc, char *argv[])
scalar minCos = Foam::cos(featureAngle*mathematicalConstant::pi/180.0);
scalar concaveAngle = defaultConcaveAngle;
if (args.options().found("concaveAngle"))
{
concaveAngle = readScalar
(
IStringStream(args.options()["concaveAngle"])()
);
}
args.optionReadIfPresent("concaveAngle", concaveAngle);
scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0);
bool snapMeshDict = args.options().found("snapMesh");
bool overwrite = args.options().found("overwrite");
bool snapMeshDict = args.optionFound("snapMesh");
bool overwrite = args.optionFound("overwrite");
Info<< "Merging all faces of a cell" << nl
<< " - which are on the same patch" << nl

View File

@ -336,7 +336,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
Info<< "Reading modifyMeshDict\n" << endl;

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
pointMesh pMesh(mesh);
word cellSetName(args.args()[1]);
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
Info<< "Reading cells to refine from cellSet " << cellSetName
<< nl << endl;

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[])
word patchName(args.additionalArgs()[0]);
scalar weight(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
label patchID = mesh.boundaryMesh().findPatchID(patchName);
@ -101,11 +101,11 @@ int main(int argc, char *argv[])
// List of cells to refine
//
bool useSet = args.options().found("useSet");
bool useSet = args.optionFound("useSet");
if (useSet)
{
word setName(args.options()["useSet"]);
word setName(args.option("useSet"));
Info<< "Subsetting cells to cut based on cellSet" << setName << endl
<< endl;

View File

@ -110,7 +110,7 @@ int main(int argc, char *argv[])
<< " to allow for some truncation error."
<< nl << endl;
bool readLevel = args.options().found("readLevel");
bool readLevel = args.optionFound("readLevel");
const scalarField& vols = mesh.cellVolumes();

View File

@ -57,7 +57,7 @@ int main(int argc, char *argv[])
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
word setName(args.additionalArgs()[0]);

View File

@ -542,23 +542,19 @@ int main(int argc, char *argv[])
scalar minCos = Foam::cos(radAngle);
scalar minSin = Foam::sin(radAngle);
bool readSet = args.options().found("set");
bool geometry = args.options().found("geometry");
bool overwrite = args.options().found("overwrite");
bool readSet = args.optionFound("set");
bool geometry = args.optionFound("geometry");
bool overwrite = args.optionFound("overwrite");
scalar edgeTol = 0.2;
if (args.options().found("tol"))
{
edgeTol = readScalar(IStringStream(args.options()["tol"])());
}
args.optionReadIfPresent("tol", edgeTol);
Info<< "Trying to split cells with internal angles > feature angle\n" << nl
<< "featureAngle : " << featureAngle << nl
<< "edge snapping tol : " << edgeTol << nl;
if (readSet)
{
Info<< "candidate cells : cellSet " << args.options()["set"] << nl;
Info<< "candidate cells : cellSet " << args.option("set") << nl;
}
else
{
@ -586,7 +582,7 @@ int main(int argc, char *argv[])
if (readSet)
{
// Read cells to cut from cellSet
cellSet cells(mesh, args.options()["set"]);
cellSet cells(mesh, args.option("set"));
cellsToCut = cells;
}

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
@ -246,10 +246,7 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
# include "createTime.H"

View File

@ -60,10 +60,7 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
# include "createTime.H"

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
@ -760,21 +760,18 @@ int main(int argc, char *argv[])
FatalError.exit();
}
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
HashSet<word> ignoreCellGroups;
if (args.options().found("ignoreCellGroups"))
if (args.optionFound("ignoreCellGroups"))
{
IStringStream(args.options()["ignoreCellGroups"])() >> ignoreCellGroups;
args.optionLookup("ignoreCellGroups")() >> ignoreCellGroups;
}
HashSet<word> ignoreFaceGroups;
if (args.options().found("ignoreFaceGroups"))
if (args.optionFound("ignoreFaceGroups"))
{
IStringStream(args.options()["ignoreFaceGroups"])() >> ignoreFaceGroups;
args.optionLookup("ignoreFaceGroups")() >> ignoreFaceGroups;
}
# include "createTime.H"

View File

@ -879,13 +879,10 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
bool writeSets = args.options().found("writeSets");
bool writeZones = args.options().found("writeZones");
bool writeSets = args.optionFound("writeSets");
bool writeZones = args.optionFound("writeZones");
# include "createTime.H"

View File

@ -87,7 +87,7 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
bool surfaceOnly = false;
if (args.options().found("surface") or args.options().found("tri"))
if (args.optionFound("surface") || args.optionFound("tri"))
{
surfaceOnly = true;
}
@ -98,16 +98,15 @@ int main(int argc, char *argv[])
exportName = meshWriter::defaultSurfaceName;
}
if (args.options().found("case"))
if (args.optionFound("case"))
{
exportName += '-' + args.globalCaseName();
}
// default: rescale from [m] to [mm]
scalar scaleFactor = 1000;
if (args.options().found("scale"))
if (args.optionReadIfPresent("scale", scaleFactor))
{
scaleFactor = readScalar(IStringStream(args.options()["scale"])());
if (scaleFactor <= 0)
{
scaleFactor = 1;
@ -129,7 +128,7 @@ int main(int argc, char *argv[])
{
meshWriters::STARCD writer(mesh, scaleFactor);
if (args.options().found("noBnd"))
if (args.optionFound("noBnd"))
{
writer.noBoundary();
}
@ -142,7 +141,7 @@ int main(int argc, char *argv[])
if (surfaceOnly)
{
if (args.options().found("tri"))
if (args.optionFound("tri"))
{
writer.writeSurface(meshName, true);
}

View File

@ -1,4 +1,4 @@
/*---------------------------------------------------------------------------*\
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
@ -646,10 +646,7 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
# include "createTime.H"

View File

@ -689,7 +689,7 @@ int main(int argc, char *argv[])
fileName mshName(args.additionalArgs()[0]);
bool keepOrientation = args.options().found("keepOrientation");
bool keepOrientation = args.optionFound("keepOrientation");
// Storage for points
pointField points;

View File

@ -852,7 +852,7 @@ int main(int argc, char *argv[])
// For debugging: dump boundary faces as triSurface
if (args.options().found("dump"))
if (args.optionFound("dump"))
{
DynamicList<labelledTri> triangles(boundaryFaces.size());

View File

@ -68,15 +68,15 @@ int main(int argc, char *argv[])
# include "createTime.H"
fileName kivaFileName("otape17");
if (args.options().found("file"))
if (args.optionFound("file"))
{
kivaFileName = args.options()["file"];
kivaFileName = args.option("file");
}
kivaVersions kivaVersion = kiva3v;
if (args.options().found("version"))
if (args.optionFound("version"))
{
word kivaVersionName = args.options()["version"];
word kivaVersionName = args.option("version");
if (kivaVersionName == "kiva3")
{
@ -99,10 +99,7 @@ int main(int argc, char *argv[])
}
scalar zHeadMin = -GREAT;
if (args.options().found("zHeadMin"))
{
zHeadMin = atof(args.options()["zHeadMin"].c_str());
}
args.optionReadIfPresent("zHeadMin", zHeadMin);
# include "readKivaGrid.H"

View File

@ -62,14 +62,12 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool readHex(args.options().found("hex"));
bool readHex = args.optionFound("hex");
fileName mshFile(args.additionalArgs()[0]);
IFstream mshStream(mshFile);
label nCells;
mshStream >> nCells;
if (readHex)

View File

@ -71,18 +71,14 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
bool readBlank = !args.options().found("noBlank");
bool singleBlock = args.options().found("singleBlock");
scalar twoDThicknes = -1;
if (args.options().found("2D"))
bool readBlank = !args.optionFound("noBlank");
bool singleBlock = args.optionFound("singleBlock");
scalar twoDThickness = -1;
if (args.optionReadIfPresent("2D", twoDThickness))
{
twoDThicknes = readScalar(IStringStream(args.options()["2D"])());
Info<< "Reading 2D case by extruding points by " << twoDThicknes
Info<< "Reading 2D case by extruding points by " << twoDThickness
<< " in z direction." << nl << endl;
}
@ -114,7 +110,7 @@ int main(int argc, char *argv[])
forAll (blocks, blockI)
{
if (twoDThicknes > 0)
if (twoDThickness > 0)
{
// Fake second set of points (done in readPoints below)
plot3dFile >> nx >> ny;
@ -139,7 +135,7 @@ int main(int argc, char *argv[])
forAll (blocks, blockI)
{
Info<< "block " << blockI << ":" << nl;
blocks[blockI].readPoints(readBlank, twoDThicknes, plot3dFile);
blocks[blockI].readPoints(readBlank, twoDThickness, plot3dFile);
sumPoints += blocks[blockI].nBlockPoints();
nMeshCells += blocks[blockI].nBlockCells();
Info<< nl;

View File

@ -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) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -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) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License

View File

@ -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) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -45,6 +45,7 @@ Description
#include "argList.H"
#include "Time.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "mathematicalConstants.H"
#include "polyTopoChange.H"
@ -340,7 +341,8 @@ void dumpFeatures
int main(int argc, char *argv[])
{
argList::noParallel();
# include "addTimeOptions.H"
timeSelector::addOptions(true, false);
argList::validArgs.append("feature angle[0-180]");
argList::validOptions.insert("splitAllFaces", "");
argList::validOptions.insert("doNotPreserveFaceZones", "");
@ -349,13 +351,10 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
// Get times list
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
// Mark boundary edges and points.
@ -381,9 +380,9 @@ int main(int argc, char *argv[])
<< endl;
const bool splitAllFaces = args.options().found("splitAllFaces");
const bool overwrite = args.options().found("overwrite");
const bool doNotPreserveFaceZones = args.options().found
const bool splitAllFaces = args.optionFound("splitAllFaces");
const bool overwrite = args.optionFound("overwrite");
const bool doNotPreserveFaceZones = args.optionFound
(
"doNotPreserveFaceZones"
);

View File

@ -51,10 +51,7 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
# include "createTime.H"

View File

@ -68,27 +68,26 @@ int main(int argc, char *argv[])
argList args(argc, argv);
Time runTime(args.rootPath(), args.caseName());
stringList const& params = args.additionalArgs();
const stringList& params = args.additionalArgs();
// default rescale from [mm] to [m]
scalar scaleFactor = 0.001;
if (args.options().found("scale"))
if (args.optionReadIfPresent("scale", scaleFactor))
{
scaleFactor = readScalar(IStringStream(args.options()["scale"])());
if (scaleFactor <= 0)
{
scaleFactor = 1;
}
}
if (args.options().found("solids"))
if (args.optionFound("solids"))
{
meshReaders::STARCD::keepSolids = true;
}
// default to binary output, unless otherwise specified
IOstream::streamFormat format = IOstream::BINARY;
if (args.options().found("ascii"))
if (args.optionFound("ascii"))
{
format = IOstream::ASCII;
}

View File

@ -51,10 +51,7 @@ int main(int argc, char *argv[])
}
scalar scaleFactor = 1.0;
if (args.options().found("scale"))
{
scaleFactor = atof(args.options()["scale"].c_str());
}
args.optionReadIfPresent("scale", scaleFactor);
# include "createTime.H"

View File

@ -103,7 +103,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
bool readFaceFile = !args.options().found("noFaceFile");
bool readFaceFile = !args.optionFound("noFaceFile");
fileName prefix(args.additionalArgs()[0]);

View File

@ -350,12 +350,12 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
bool patchFaces = args.options().found("patchFaces");
bool doCell = args.options().found("cell");
bool doPoint = args.options().found("point");
bool doFace = args.options().found("face");
bool doCellSet = args.options().found("cellSet");
bool doFaceSet = args.options().found("faceSet");
bool patchFaces = args.optionFound("patchFaces");
bool doCell = args.optionFound("cell");
bool doPoint = args.optionFound("point");
bool doFace = args.optionFound("face");
bool doCellSet = args.optionFound("cellSet");
bool doFaceSet = args.optionFound("faceSet");
Info<< "Writing mesh objects as .obj files such that the object"
@ -383,22 +383,19 @@ int main(int argc, char *argv[])
}
else if (doCell)
{
label cellI =
readLabel(IStringStream(args.options()["cell"])());
label cellI = args.optionRead<label>("cell");
writePoints(mesh, cellI, runTime.timeName());
}
else if (doPoint)
{
label pointI =
readLabel(IStringStream(args.options()["point"])());
label pointI = args.optionRead<label>("point");
writePointCells(mesh, pointI, runTime.timeName());
}
else if (doFace)
{
label faceI =
readLabel(IStringStream(args.options()["face"])());
label faceI = args.optionRead<label>("face");
fileName fName
(
@ -420,7 +417,7 @@ int main(int argc, char *argv[])
}
else if (doCellSet)
{
word setName(args.options()["cellSet"]);
word setName(args.option("cellSet"));
cellSet cells(mesh, setName);
@ -432,7 +429,7 @@ int main(int argc, char *argv[])
}
else if (doFaceSet)
{
word setName(args.options()["faceSet"]);
word setName(args.option("faceSet"));
faceSet faces(mesh, setName);

View File

@ -83,10 +83,10 @@ int main(int argc, char *argv[])
word regionName;
fileName polyMeshDir;
if (args.options().found("region"))
if (args.optionFound("region"))
{
// constant/<region>/polyMesh/blockMeshDict
regionName = args.options()["region"];
regionName = args.option("region");
polyMeshDir = regionName/polyMesh::meshSubDir;
Info<< nl << "Generating mesh for region " << regionName << endl;
@ -100,9 +100,9 @@ int main(int argc, char *argv[])
autoPtr<IOobject> meshDictIoPtr;
if (args.options().found("dict"))
if (args.optionFound("dict"))
{
fileName dictPath(args.options()["dict"]);
fileName dictPath(args.option("dict"));
meshDictIoPtr.set
(
@ -110,7 +110,7 @@ int main(int argc, char *argv[])
(
(
isDir(dictPath)
? dictPath/dictName
? dictPath/dictName
: dictPath
),
runTime,
@ -153,7 +153,7 @@ int main(int argc, char *argv[])
blockMesh blocks(meshDict);
if (args.options().found("blockTopology"))
if (args.optionFound("blockTopology"))
{
// Write mesh as edges.
{

View File

@ -66,7 +66,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
scalar thickness(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
// Check that mesh is 2D

View File

@ -55,7 +55,7 @@ int main(int argc, char *argv[])
#include "setRoots.H"
#include "createTimeExtruded.H"
if (args.options().found("sourceCase") == args.options().found("surface"))
if (args.optionFound("sourceCase") == args.optionFound("surface"))
{
FatalErrorIn(args.executable())
<< "Specify either -sourceCase and -sourcePatch"
@ -83,12 +83,12 @@ int main(int argc, char *argv[])
)
);
if (args.options().found("sourceCase"))
if (args.optionFound("sourceCase"))
{
fileName sourceCasePath(args.options()["sourceCase"]);
fileName sourceCasePath(args.option("sourceCase"));
fileName sourceRootDir = sourceCasePath.path();
fileName sourceCaseDir = sourceCasePath.name();
word patchName(args.options()["sourcePatch"]);
word patchName(args.option("sourcePatch"));
Info<< "Extruding patch " << patchName
<< " on mesh " << sourceCasePath << nl
@ -144,7 +144,7 @@ int main(int argc, char *argv[])
else
{
// Read from surface
fileName surfName(args.options()["surface"]);
fileName surfName(args.option("surface"));
Info<< "Extruding surfaceMesh read from file " << surfName << nl
<< endl;
@ -250,7 +250,7 @@ int main(int argc, char *argv[])
// Merging front and back patch faces
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (args.options().found("mergeFaces"))
if (args.optionFound("mergeFaces"))
{
Info<< "Assuming full 360 degree axisymmetric case;"
<< " stitching faces on patches "

View File

@ -50,7 +50,7 @@ int main(int argc, char *argv[])
# include "createPolyMesh.H"
const word oldInstance = mesh.pointsInstance();
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
if (!overwrite)
{

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[])
boundaryMesh bMesh;
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);

View File

@ -58,9 +58,9 @@ int main(int argc, char *argv[])
instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedPolyMesh.H"
const bool noTopology = args.options().found("noTopology");
const bool allGeometry = args.options().found("allGeometry");
const bool allTopology = args.options().found("allTopology");
const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.optionFound("allGeometry");
const bool allTopology = args.optionFound("allTopology");
forAll(timeDirs, timeI)
{

View File

@ -48,157 +48,6 @@ using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void createBaffles
(
const polyMesh& mesh,
const label faceI,
const label oldPatchI,
const labelList& newPatches,
PackedBoolList& doneFace,
polyTopoChange& meshMod
)
{
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const faceZoneMesh& faceZones = mesh.faceZones();
const face& f = mesh.faces()[faceI];
label zoneID = faceZones.whichZone(faceI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
label nei = -1;
if (oldPatchI == -1)
{
nei = mesh.faceNeighbour()[faceI];
}
face revFace(f.reverseFace());
forAll(newPatches, i)
{
if (oldPatchI == -1)
{
// Internal face
if (doneFace.set(faceI))
{
// First usage of face. Modify.
meshMod.setAction
(
polyModifyFace
(
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI], // owner
-1, // neighbour
false, // face flip
newPatches[i], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
else
{
// Second or more usage of face. Add.
meshMod.setAction
(
polyAddFace
(
f, // modified face
mesh.faceOwner()[faceI], // owner
-1, // neighbour
-1, // master point
-1, // master edge
faceI, // master face
false, // face flip
newPatches[i], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
meshMod.setAction
(
polyAddFace
(
revFace, // modified face
nei, // owner
-1, // neighbour
-1, // masterPointID
-1, // masterEdgeID
faceI, // masterFaceID,
true, // face flip
newPatches[i], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
else if
(
patches[oldPatchI].coupled()
&& patches[newPatches[i]].coupled()
)
{
// Do not allow coupled patches to be moved to different coupled
// patches.
//WarningIn("createBaffles()")
// << "Not moving face from coupled patch "
// << patches[oldPatchI].name()
// << " to another coupled patch " << patches[newPatches[i]]
// << endl;
}
else
{
if (doneFace.set(faceI))
{
meshMod.setAction
(
polyModifyFace
(
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI], // owner
-1, // neighbour
false, // face flip
newPatches[i], // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
else
{
meshMod.setAction
(
polyAddFace
(
f, // modified face
mesh.faceOwner()[faceI], // owner
-1, // neighbour
-1, // master point
-1, // master edge
faceI, // master face
false, // face flip
newPatches[i], // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
}
}
}
// Main program:
int main(int argc, char *argv[])
@ -215,22 +64,23 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
const faceZoneMesh& faceZones = mesh.faceZones();
// Faces to baffle
word setName(args.additionalArgs()[0]);
Pout<< "Reading faceSet from " << setName << nl << endl;
Info<< "Reading faceSet from " << setName << nl << endl;
faceSet facesToSplit(mesh, setName);
// Make sure set is synchronised across couples
facesToSplit.sync(mesh);
Pout<< "Read " << facesToSplit.size() << " faces from " << setName
<< nl << endl;
Info<< "Read " << returnReduce(facesToSplit.size(), sumOp<label>())
<< " faces from " << setName << nl << endl;
// Patches to put baffles into
labelList newPatches(1);
DynamicList<label> newPatches(1);
word patchName(args.additionalArgs()[1]);
newPatches[0] = patches.findPatchID(patchName);
newPatches.append(patches.findPatchID(patchName));
Pout<< "Using patch " << patchName
<< " at index " << newPatches[0] << endl;
@ -243,13 +93,14 @@ int main(int argc, char *argv[])
// Additional patches
if (args.options().found("additionalPatches"))
if (args.optionFound("additionalPatches"))
{
const wordList patchNames
(
IStringStream(args.options()["additionalPatches"])()
args.optionLookup("additionalPatches")()
);
newPatches.reserve(patchNames.size() + 1);
forAll(patchNames, i)
{
label patchI = patches.findPatchID(patchNames[i]);
@ -269,7 +120,7 @@ int main(int argc, char *argv[])
}
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
@ -316,48 +167,181 @@ int main(int argc, char *argv[])
// Do the actual changes
// Note order in which faces are modified/added is so they end up correctly
// for cyclic patches (original faces first and then reversed faces)
// since otherwise it will have trouble matching baffles.
label nBaffled = 0;
PackedBoolList doneFace(mesh.nFaces());
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
forAll(newPatches, i)
{
if (facesToSplit.found(faceI))
{
createBaffles
(
mesh,
faceI,
-1, // oldPatchI,
newPatches,
doneFace,
meshMod
);
nBaffled++;
}
}
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
label newPatchI = newPatches[i];
forAll(pp, i)
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
label faceI = pp.start()+i;
if (facesToSplit.found(faceI))
{
createBaffles
(
mesh,
faceI,
patchI, // oldPatchI,
newPatches,
doneFace,
meshMod
);
const face& f = mesh.faces()[faceI];
label zoneID = faceZones.whichZone(faceI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
if (i == 0)
{
// First usage of face. Modify.
meshMod.setAction
(
polyModifyFace
(
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI], // owner
-1, // neighbour
false, // face flip
newPatchI, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
else
{
// Second or more usage of face. Add.
meshMod.setAction
(
polyAddFace
(
f, // modified face
mesh.faceOwner()[faceI], // owner
-1, // neighbour
-1, // master point
-1, // master edge
faceI, // master face
false, // face flip
newPatchI, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
nBaffled++;
}
}
// Add the reversed face.
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{
if (facesToSplit.found(faceI))
{
const face& f = mesh.faces()[faceI];
label zoneID = faceZones.whichZone(faceI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
label nei = mesh.faceNeighbour()[faceI];
meshMod.setAction
(
polyAddFace
(
f.reverseFace(), // modified face
nei, // owner
-1, // neighbour
-1, // masterPointID
-1, // masterEdgeID
faceI, // masterFaceID,
true, // face flip
newPatchI, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
nBaffled++;
}
}
// Modify any boundary faces
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
if (patches[newPatchI].coupled() && pp.coupled())
{
// Do not allow coupled faces to be moved to different coupled
// patches.
}
else
{
forAll(pp, i)
{
label faceI = pp.start()+i;
if (facesToSplit.found(faceI))
{
const face& f = mesh.faces()[faceI];
label zoneID = faceZones.whichZone(faceI);
bool zoneFlip = false;
if (zoneID >= 0)
{
const faceZone& fZone = faceZones[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
}
if (i == 0)
{
// First usage of face. Modify.
meshMod.setAction
(
polyModifyFace
(
f, // modified face
faceI, // label of face
mesh.faceOwner()[faceI],// owner
-1, // neighbour
false, // face flip
newPatchI, // patch for face
false, // remove from zone
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
else
{
// Second or more usage of face. Add.
meshMod.setAction
(
polyAddFace
(
f, // modified face
mesh.faceOwner()[faceI],// owner
-1, // neighbour
-1, // master point
-1, // master edge
faceI, // master face
false, // face flip
newPatchI, // patch for face
zoneID, // zone for face
zoneFlip // face flip in zone
)
);
}
nBaffled++;
}
}
}
}
}

View File

@ -539,7 +539,7 @@ int main(int argc, char *argv[])
# include "createTime.H"
runTime.functionObjects().off();
const bool overwrite = args.options().found("overwrite");
const bool overwrite = args.optionFound("overwrite");
Info<< "Reading createPatchDict." << nl << endl;

View File

@ -59,11 +59,10 @@ int main(int argc, char *argv[])
pointField zeroPoints(mesh.points());
runTime.setTime(Times[0], 0);
for (int i = 1; i<Times.size(); i++)
// skip "constant" time
for (label timeI = 1; timeI < Times.size(); ++timeI)
{
runTime.setTime(Times[i], i);
runTime.setTime(Times[timeI], timeI);
Info<< "Time = " << runTime.timeName() << endl;

View File

@ -231,9 +231,9 @@ int main(int argc, char *argv[])
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
bool split = args.options().found("split");
bool overwrite = args.options().found("overwrite");
bool detectOnly = args.options().found("detectOnly");
bool split = args.optionFound("split");
bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.optionFound("detectOnly");
// Collect all boundary faces
labelList boundaryFaces(mesh.nFaces() - mesh.nInternalFaces());

View File

@ -309,8 +309,8 @@ int main(int argc, char *argv[])
// Read/construct control dictionary
//
bool readDict = args.options().found("dict");
bool overwrite = args.options().found("overwrite");
bool readDict = args.optionFound("dict");
bool overwrite = args.optionFound("overwrite");
// List of cells to refine
labelList refCells;

View File

@ -386,8 +386,7 @@ int main(int argc, char *argv[])
# include "createMesh.H"
const word oldInstance = mesh.pointsInstance();
const bool blockOrder = args.options().found("blockOrder");
const bool blockOrder = args.optionFound("blockOrder");
if (blockOrder)
{
Info<< "Ordering cells into regions (using decomposition);"
@ -395,15 +394,14 @@ int main(int argc, char *argv[])
<< endl;
}
const bool orderPoints = args.options().found("orderPoints");
const bool orderPoints = args.optionFound("orderPoints");
if (orderPoints)
{
Info<< "Ordering points into internal and boundary points." << nl
<< endl;
}
const bool writeMaps = args.options().found("writeMaps");
const bool writeMaps = args.optionFound("writeMaps");
if (writeMaps)
{
@ -411,7 +409,7 @@ int main(int argc, char *argv[])
<< endl;
}
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
label band = getBand(mesh.faceOwner(), mesh.faceNeighbour());

View File

@ -591,24 +591,10 @@ commandStatus parseType
}
else if (setType == "time")
{
scalar time = readScalar(is);
scalar requestedTime = readScalar(is);
instantList Times = runTime.times();
int nearestIndex = -1;
scalar nearestDiff = Foam::GREAT;
forAll(Times, timeIndex)
{
if (Times[timeIndex].name() == "constant") continue;
scalar diff = fabs(Times[timeIndex].value() - time);
if (diff < nearestDiff)
{
nearestDiff = diff;
nearestIndex = timeIndex;
}
}
label nearestIndex = Time::findClosestTimeIndex(Times, requestedTime);
Pout<< "Changing time from " << runTime.timeName()
<< " to " << Times[nearestIndex].name()
@ -646,7 +632,8 @@ commandStatus parseType
}
default:
{
FatalErrorIn("parseType") << "Illegal mesh update state "
FatalErrorIn("parseType")
<< "Illegal mesh update state "
<< stat << abort(FatalError);
break;
}
@ -723,7 +710,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool writeVTK = !args.options().found("noVTK");
bool writeVTK = !args.optionFound("noVTK");
// Get times list
instantList Times = runTime.times();
@ -740,13 +727,13 @@ int main(int argc, char *argv[])
std::ifstream* fileStreamPtr(NULL);
if (args.options().found("batch"))
if (args.optionFound("batch"))
{
fileName batchFile(args.options()["batch"]);
fileName batchFile(args.option("batch"));
Pout<< "Reading commands from file " << batchFile << endl;
// we also cannot handle .gz files
// we cannot handle .gz files
if (!isFile(batchFile, false))
{
FatalErrorIn(args.executable())
@ -864,7 +851,7 @@ int main(int argc, char *argv[])
delete fileStreamPtr;
}
Pout << nl << "End" << endl;
Pout<< "\nEnd" << endl;
return 0;
}

View File

@ -64,8 +64,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H"
# include "createTime.H"
bool noFlipMap = args.options().found("noFlipMap");
bool noFlipMap = args.optionFound("noFlipMap");
// Get times list
instantList Times = runTime.times();
@ -73,9 +72,8 @@ int main(int argc, char *argv[])
label startTime = Times.size()-1;
label endTime = Times.size();
// check -time and -latestTime options
# include "checkTimeOption.H"
# include "checkLatestTimeOption.H"
runTime.setTime(Times[startTime], startTime);

View File

@ -126,7 +126,7 @@ int main(int argc, char *argv[])
word setName(args.additionalArgs()[0]);
word masterPatch(args.additionalArgs()[1]);
word slavePatch(args.additionalArgs()[2]);
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
// List of faces to split
faceSet facesSet(mesh, setName);

View File

@ -1239,20 +1239,20 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
word blockedFacesName;
if (args.options().found("blockedFaces"))
if (args.optionFound("blockedFaces"))
{
blockedFacesName = args.options()["blockedFaces"];
blockedFacesName = args.option("blockedFaces");
Info<< "Reading blocked internal faces from faceSet "
<< blockedFacesName << nl << endl;
}
bool makeCellZones = args.options().found("makeCellZones");
bool largestOnly = args.options().found("largestOnly");
bool insidePoint = args.options().found("insidePoint");
bool useCellZones = args.options().found("cellZones");
bool overwrite = args.options().found("overwrite");
bool detectOnly = args.options().found("detectOnly");
bool sloppyCellZones = args.options().found("sloppyCellZones");
bool makeCellZones = args.optionFound("makeCellZones");
bool largestOnly = args.optionFound("largestOnly");
bool insidePoint = args.optionFound("insidePoint");
bool useCellZones = args.optionFound("cellZones");
bool overwrite = args.optionFound("overwrite");
bool detectOnly = args.optionFound("detectOnly");
bool sloppyCellZones = args.optionFound("sloppyCellZones");
if (insidePoint && largestOnly)
{
@ -1771,7 +1771,7 @@ int main(int argc, char *argv[])
if (insidePoint)
{
point insidePoint(IStringStream(args.options()["insidePoint"])());
point insidePoint(args.optionLookup("insidePoint")());
label regionI = -1;

View File

@ -142,9 +142,9 @@ int main(int argc, char *argv[])
word masterPatchName(args.additionalArgs()[0]);
word slavePatchName(args.additionalArgs()[1]);
bool partialCover = args.options().found("partial");
bool perfectCover = args.options().found("perfect");
bool overwrite = args.options().found("overwrite");
bool partialCover = args.optionFound("partial");
bool perfectCover = args.optionFound("perfect");
bool overwrite = args.optionFound("overwrite");
if (partialCover && perfectCover)
{

View File

@ -162,7 +162,7 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance();
word setName(args.additionalArgs()[0]);
bool overwrite = args.options().found("overwrite");
bool overwrite = args.optionFound("overwrite");
Info<< "Reading cell set from " << setName << endl << endl;
@ -172,9 +172,9 @@ int main(int argc, char *argv[])
label patchI = -1;
if (args.options().found("patch"))
if (args.optionFound("patch"))
{
word patchName(args.options()["patch"]);
word patchName(args.option("patch"));
patchI = mesh.boundaryMesh().findPatchID(patchName);

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