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. General Public License terms under which you can copy the files.
* System requirements * System requirements
OpenFOAM is developed and tested on Linux, but should work with other Unix OpenFOAM is developed and tested on Linux, but should work with other POSIX
style systems. To check your system setup, execute the foamSystemCheck script systems. To check your system setup, execute the foamSystemCheck script in
in the bin/ directory of the OpenFOAM installation. If no problems are the bin/ directory of the OpenFOAM installation. If no problems are reported,
reported, proceed to "3. Installation"; otherwise contact your system proceed to "3. Installation"; otherwise contact your system administrator.
administrator.
If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the If the user wishes to run OpenFOAM in 32/64-bit mode they should consult the
section "Running OpenFOAM in 32-bit mode". 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/combustion/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
EXE_LIBS = \ EXE_LIBS = \
-llagrangian \ -llagrangian \

View File

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

View File

@ -97,7 +97,7 @@ int main(int argc, char *argv[])
U.write(); U.write();
phi.write(); phi.write();
if (args.options().found("writep")) if (args.optionFound("writep"))
{ {
p.write(); 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 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

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

View File

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

View File

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

View File

@ -106,6 +106,23 @@
scalar pdRefValue = 0.0; scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue); 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 // Construct interface from alpha1 distribution
interfaceProperties interface(alpha1, U, twoPhaseProperties); interfaceProperties interface(alpha1, U, twoPhaseProperties);

View File

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

View File

@ -68,6 +68,23 @@
scalar pdRefValue = 0.0; scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue); 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 // Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence autoPtr<incompressible::turbulenceModel> turbulence

View File

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

View File

@ -95,6 +95,23 @@
scalar pdRefValue = 0.0; scalar pdRefValue = 0.0;
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue); 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 // Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence autoPtr<incompressible::turbulenceModel> turbulence

View File

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

View File

@ -160,18 +160,33 @@ int main(int argc, char *argv[])
<< " " << lstB.size() << endl; << " " << lstB.size() << endl;
Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: " Info<< "<dlD>" << dlD << "</dlD>" << nl << "sizes: "
<< " " << dlD.size() << "/" << dlD.capacity() << endl; << " " << dlD.size() << "/" << dlD.capacity() << endl;
DynamicList<label,10> dlE1(10); DynamicList<label,10> dlE1(10);
DynamicList<label> dlE2(dlE1); DynamicList<label> dlE2(dlE1); // construct dissimilar
Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: " Info<< "<dlE1>" << dlE1 << "</dlE1>" << nl << "sizes: "
<< " " << dlE1.size() << "/" << dlE1.capacity() << endl; << " " << dlE1.size() << "/" << dlE1.capacity() << endl;
Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: " Info<< "<dlE2>" << dlE2 << "</dlE2>" << nl << "sizes: "
<< " " << dlE2.size() << "/" << dlE2.capacity() << endl; << " " << 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; 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"; Info<< "\nEnd\n";
return 0; return 0;

View File

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

View File

@ -29,6 +29,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "OSspecific.H" #include "OSspecific.H"
#include "argList.H"
#include "wordReList.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "IStringStream.H" #include "IStringStream.H"
@ -38,11 +40,21 @@ Description
using namespace Foam; using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
int main(int argc, char *argv[]) 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))")()); List<vector> list1(IStringStream("1 ((0 1 2))")());
Info<< "list1: " << list1 << endl; Info<< "list1: " << list1 << endl;
@ -69,6 +81,43 @@ int main(int argc, char *argv[])
Info<< "Elements " << map << " out of " << list3 Info<< "Elements " << map << " out of " << list3
<< " => " << subList3 << endl; << " => " << 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; 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() int main()
{ {
HASHTABLE_CLASS<double> table1(100); HASHTABLE_CLASS<double> table1(13);
table1.insert("aaa", 1.0); table1.insert("aaa", 1.0);
table1.insert("aba", 2.0); table1.insert("aba", 2.0);
@ -56,7 +56,8 @@ int main()
table1.erase("abs"); table1.erase("abs");
Info<< "\ntable1 toc: " << table1.toc() << endl; Info<< "\ntable1 toc: " << table1.toc() << endl;
Info<< "\ntable1 [" << table1.size() << "] " << endl; table1.printInfo(Info)
<< "table1 [" << table1.size() << "] " << endl;
forAllIter(HASHTABLE_CLASS<double>, table1, iter) forAllIter(HASHTABLE_CLASS<double>, table1, iter)
{ {
Info<< iter.key() << " => " << iter() << nl; Info<< iter.key() << " => " << iter() << nl;
@ -97,7 +98,7 @@ int main()
<< "transfer table1 -> table3 via the xfer() method" << nl; << "transfer table1 -> table3 via the xfer() method" << nl;
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table1 << nl << "\ntable2" << table2 << nl
<< "\ntable3" << table3 << nl; << "\ntable3" << table3 << nl;
Info<< "\nerase table2 by iterator" << nl; Info<< "\nerase table2 by iterator" << nl;
@ -113,10 +114,14 @@ int main()
<< "\ntable3" << table3 << nl; << "\ntable3" << table3 << nl;
table3.resize(1); table3.resize(1);
Info<< "\nresize(1) table3" << table3 << nl; Info<< "\nresize(1) table3" << nl;
table3.printInfo(Info)
<< table3 << nl;
table3.resize(10000); table3.resize(10000);
Info<< "\nresize(10000) table3" << table3 << nl; Info<< "\nresize(10000) table3" << nl;
table3.printInfo(Info)
<< table3 << nl;
HASHTABLE_CLASS<double> table4; HASHTABLE_CLASS<double> table4;
@ -134,26 +139,27 @@ int main()
table1.erase(table1.begin()); table1.erase(table1.begin());
Info<< "removed an element - test table1 != table3 : " Info<< "removed an element - test table1 != table3 : "
<< (table1 != table3) << nl; << (table1 != table3) << nl;
// insert a few things into table2 // insert a few things into table2
table2.set("ada", 14.0); table2.set("ada", 14.0);
table2.set("aeq", 15.0); table2.set("aeq", 15.0);
table2.set("aaw", 16.0); table2.set("aaw", 16.0);
table2.set("abs", 17.0); table2.set("abs", 17.0);
table2.set("adx", 20.0); table2.set("adx", 20.0);
Info<< "\ntable1" << table1 << nl Info<< "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl; << "\ntable2" << table2 << nl;
label nErased = table1.erase(table2); label nErased = table1.erase(table2);
Info<< "\nerase table2 keys from table1 (removed " Info<< "\nerase table2 keys from table1 (removed "
<< nErased << " elements)" << nl << nErased << " elements)" << nl
<< "\ntable1" << table1 << nl << "\ntable1" << table1 << nl
<< "\ntable2" << table2 << nl; << "\ntable2" << table2 << nl;
Info<< "\nclearStorage table3 ... "; Info<< "\ntable3" << table3
<< "\nclearStorage table3 ... ";
table3.clearStorage(); table3.clearStorage();
Info<< table3 << nl; Info<< table3 << nl;
@ -162,4 +168,5 @@ int main()
return 0; return 0;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -27,6 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "UIndirectList.H" #include "UIndirectList.H"
#include "DynamicList.H"
#include "IOstreams.H" #include "IOstreams.H"
#include "ListOps.H" #include "ListOps.H"
#include "OFstream.H" #include "OFstream.H"
@ -58,11 +59,11 @@ int main(int argc, char *argv[])
idl[1] = -666; idl[1] = -666;
Info<< "idl[1] changed:" << idl << endl; Info<< "idl[1] changed: " << idl << endl;
idl = -999; idl = -999;
Info<< "idl changed:" << idl << endl; Info<< "idl changed: " << idl << endl;
UIndirectList<double> idl2(idl); UIndirectList<double> idl2(idl);
@ -79,17 +80,26 @@ int main(int argc, char *argv[])
idl = ident; 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; Info << "\nEnd\n" << endl;
return 0; 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 Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << nl
<< "dict2.toc(): " << dict2.name() << " " << dict2.toc() << endl; << "dict2.toc(): " << dict2.name() << " " << dict2.toc() << endl;
// copy back // copy back
dict1 = dict2; dict1 = dict2;
Info<< "dict1.toc(): " << dict1.name() << " " << dict1.toc() << endl; 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++ -*---------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | ========= | |
| \\ / OpenFOAM | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / | | \\ / O peration | Version: Any |
| \\ / The Open Source CFD Toolbox | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ http://www.OpenFOAM.org | | \\/ M anipulation | |
\*-------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format ascii; format ascii;
class dictionary; class dictionary;
object testDict; object testDict;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#inputMode merge #inputMode merge
dimensions [ 0 2 -2 0 0 0 0 ];
internalField uniform 1; internalField uniform 1;
// use 'protect' to supply defaults
#inputMode protect
internalField uniform 10;
dimensions [ 0 2 -2 0 0 0 0 ];
#inputMode merge
active active
{ {
type turbulentIntensityKineticEnergyInlet; type turbulentIntensityKineticEnergyInlet;
@ -31,6 +36,7 @@ inactive
type zeroGradient; type zeroGradient;
} }
boundaryField boundaryField
{ {
Default_Boundary_Region Default_Boundary_Region
@ -101,4 +107,4 @@ baz
// this should work too // this should work too
#remove ( bar baz ) #remove ( bar baz )
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[])
boundaryMesh bMesh; boundaryMesh bMesh;
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); 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); 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); instantList timeDirs = timeSelector::select0(runTime, args);
# include "createNamedPolyMesh.H" # include "createNamedPolyMesh.H"
const bool noTopology = args.options().found("noTopology"); const bool noTopology = args.optionFound("noTopology");
const bool allGeometry = args.options().found("allGeometry"); const bool allGeometry = args.optionFound("allGeometry");
const bool allTopology = args.options().found("allTopology"); const bool allTopology = args.optionFound("allTopology");
forAll(timeDirs, timeI) 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: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -215,22 +64,23 @@ int main(int argc, char *argv[])
const word oldInstance = mesh.pointsInstance(); const word oldInstance = mesh.pointsInstance();
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
const faceZoneMesh& faceZones = mesh.faceZones();
// Faces to baffle // Faces to baffle
word setName(args.additionalArgs()[0]); word setName(args.additionalArgs()[0]);
Pout<< "Reading faceSet from " << setName << nl << endl; Info<< "Reading faceSet from " << setName << nl << endl;
faceSet facesToSplit(mesh, setName); faceSet facesToSplit(mesh, setName);
// Make sure set is synchronised across couples // Make sure set is synchronised across couples
facesToSplit.sync(mesh); facesToSplit.sync(mesh);
Pout<< "Read " << facesToSplit.size() << " faces from " << setName Info<< "Read " << returnReduce(facesToSplit.size(), sumOp<label>())
<< nl << endl; << " faces from " << setName << nl << endl;
// Patches to put baffles into // Patches to put baffles into
labelList newPatches(1); DynamicList<label> newPatches(1);
word patchName(args.additionalArgs()[1]); word patchName(args.additionalArgs()[1]);
newPatches[0] = patches.findPatchID(patchName); newPatches.append(patches.findPatchID(patchName));
Pout<< "Using patch " << patchName Pout<< "Using patch " << patchName
<< " at index " << newPatches[0] << endl; << " at index " << newPatches[0] << endl;
@ -243,13 +93,14 @@ int main(int argc, char *argv[])
// Additional patches // Additional patches
if (args.options().found("additionalPatches")) if (args.optionFound("additionalPatches"))
{ {
const wordList patchNames const wordList patchNames
( (
IStringStream(args.options()["additionalPatches"])() args.optionLookup("additionalPatches")()
); );
newPatches.reserve(patchNames.size() + 1);
forAll(patchNames, i) forAll(patchNames, i)
{ {
label patchI = patches.findPatchID(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 // 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; label nBaffled = 0;
PackedBoolList doneFace(mesh.nFaces());
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++) forAll(newPatches, i)
{ {
if (facesToSplit.found(faceI)) label newPatchI = newPatches[i];
{
createBaffles
(
mesh,
faceI,
-1, // oldPatchI,
newPatches,
doneFace,
meshMod
);
nBaffled++;
}
}
forAll(patches, patchI)
{
const polyPatch& pp = patches[patchI];
forAll(pp, i) for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
{ {
label faceI = pp.start()+i;
if (facesToSplit.found(faceI)) if (facesToSplit.found(faceI))
{ {
createBaffles const face& f = mesh.faces()[faceI];
( label zoneID = faceZones.whichZone(faceI);
mesh, bool zoneFlip = false;
faceI, if (zoneID >= 0)
patchI, // oldPatchI, {
newPatches, const faceZone& fZone = faceZones[zoneID];
doneFace, zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
meshMod }
);
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++; 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" # include "createTime.H"
runTime.functionObjects().off(); runTime.functionObjects().off();
const bool overwrite = args.options().found("overwrite"); const bool overwrite = args.optionFound("overwrite");
Info<< "Reading createPatchDict." << nl << endl; Info<< "Reading createPatchDict." << nl << endl;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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