Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry
2013-02-07 12:31:25 +00:00
33 changed files with 566 additions and 171 deletions

View File

@ -31,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "psiThermo.H" #include "rhoThermo.H"
#include "RASModel.H" #include "RASModel.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "simpleControl.H" #include "simpleControl.H"

View File

@ -1,10 +1,10 @@
Info<< "Reading thermophysical properties\n" << endl; Info<< "Reading thermophysical properties\n" << endl;
autoPtr<psiThermo> pThermo autoPtr<rhoThermo> pThermo
( (
psiThermo::New(mesh) rhoThermo::New(mesh)
); );
psiThermo& thermo = pThermo(); rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e"); thermo.validate(args.executable(), "h", "e");
volScalarField rho volScalarField rho

View File

@ -0,0 +1,34 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + fvm::div(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ (
he.name() == "e"
? fvc::div
(
fvc::absolute(phi/fvc::interpolate(rho), U),
p,
"div(phiv,p)"
)
: -dpdt
)
- fvm::laplacian(alphaEff, he)
==
radiation->Sh(thermo)
+ fvOptions(rho, he)
);
EEqn.relax();
fvOptions.constrain(EEqn);
EEqn.solve();
fvOptions.correct(he);
thermo.correct();
radiation->correct();
}

View File

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

View File

@ -0,0 +1,24 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lsampling \
-lmeshTools \
-lfvOptions \
-lfluidThermophysicalModels \
-lradiationModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -0,0 +1,54 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<rhoThermo> pThermo(rhoThermo::New(mesh));
rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
thermo.rho()
);
volScalarField& p = thermo.p();
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
#include "setAlphaEff.H"
Info<< "Creating field dpdt\n" << endl;
volScalarField dpdt
(
IOobject
(
"dpdt",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("dpdt", p.dimensions()/dimTime, 0)
);
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));

View File

@ -0,0 +1,93 @@
Info<< "Creating turbulence model\n" << endl;
tmp<volScalarField> talphaEff;
IOobject turbulenceHeader
(
"turbulenceProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ
);
IOobject RASHeader
(
"RASProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ
);
IOobject LESHeader
(
"LESProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ
);
if (turbulenceHeader.headerOk())
{
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
talphaEff = turbulence->alphaEff();
}
else if (RASHeader.headerOk())
{
autoPtr<compressible::RASModel> turbulence
(
compressible::RASModel::New
(
rho,
U,
phi,
thermo
)
);
talphaEff = turbulence->alphaEff();
}
else if (LESHeader.headerOk())
{
autoPtr<compressible::LESModel> turbulence
(
compressible::LESModel::New
(
rho,
U,
phi,
thermo
)
);
talphaEff = turbulence->alphaEff();
}
else
{
talphaEff = tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"alphaEff",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("0", dimMass/dimLength/dimTime, 0.0)
)
);
}
const volScalarField& alphaEff = talphaEff();

View File

@ -0,0 +1,107 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
thermoFoam
Description
Evolves the thermodynamics on a forzen flow field
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "rhoThermo.H"
#include "turbulenceModel.H"
#include "RASModel.H"
#include "LESModel.H"
#include "radiationModel.H"
#include "fvIOoptionList.H"
#include "simpleControl.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createRadiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nEvolving thermodynamics\n" << endl;
if (mesh.solutionDict().found("SIMPLE"))
{
simpleControl simple(mesh);
while (simple.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;
while (simple.correctNonOrthogonal())
{
#include "EEqn.H"
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
runTime.write();
}
}
else
{
pimpleControl pimple(mesh);
while (runTime.run())
{
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
while (pimple.correctNonOrthogonal())
{
#include "EEqn.H"
}
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
runTime.write();
}
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,11 +42,20 @@ int main(int argc, char *argv[])
argList::validArgs.append("CHEMKINThermodynamicsFile"); argList::validArgs.append("CHEMKINThermodynamicsFile");
argList::validArgs.append("FOAMChemistryFile"); argList::validArgs.append("FOAMChemistryFile");
argList::validArgs.append("FOAMThermodynamicsFile"); argList::validArgs.append("FOAMThermodynamicsFile");
argList::addBoolOption
(
"newFormat",
"read Chemkin thermo file in new format"
);
argList args(argc, argv); argList args(argc, argv);
bool newFormat = args.optionFound("newFormat");
speciesTable species; speciesTable species;
chemkinReader cr(args[1], species, args[2]); chemkinReader cr(args[1], species, args[2], newFormat);
OFstream reactionsFile(args[3]); OFstream reactionsFile(args[3]);
reactionsFile reactionsFile

View File

@ -219,7 +219,7 @@ case ThirdParty:
case Gcc++0x: case Gcc++0x:
case Gcc46: case Gcc46:
case Gcc46++0x: case Gcc46++0x:
set gcc_version=gcc-4.6.2 set gcc_version=gcc-4.6.1
set gmp_version=gmp-5.0.4 set gmp_version=gmp-5.0.4
set mpfr_version=mpfr-3.1.0 set mpfr_version=mpfr-3.1.0
set mpc_version=mpc-0.9 set mpc_version=mpc-0.9
@ -238,17 +238,6 @@ case ThirdParty:
set mpfr_version=mpfr-2.4.2 set mpfr_version=mpfr-2.4.2
set mpc_version=mpc-0.8.1 set mpc_version=mpc-0.8.1
breaksw breaksw
case Gcc44:
case Gcc44++0x:
set gcc_version=gcc-4.4.3
set gmp_version=gmp-5.0.1
set mpfr_version=mpfr-2.4.2
breaksw
case Gcc43:
set gcc_version=gcc-4.3.3
set gmp_version=gmp-4.2.4
set mpfr_version=mpfr-2.4.1
breaksw
case Clang: case Clang:
# using clang - not gcc # using clang - not gcc
setenv WM_CC 'clang' setenv WM_CC 'clang'

View File

@ -240,12 +240,6 @@ fi
case "${foamCompiler}" in case "${foamCompiler}" in
OpenFOAM | ThirdParty) OpenFOAM | ThirdParty)
case "$WM_COMPILER" in case "$WM_COMPILER" in
Gcc463)
gcc_version=gcc-4.6.3
gmp_version=gmp-5.0.2
mpfr_version=mpfr-3.0.1
mpc_version=mpc-0.9
;;
Gcc | Gcc++0x | Gcc46 | Gcc46++0x) Gcc | Gcc++0x | Gcc46 | Gcc46++0x)
gcc_version=gcc-4.6.1 gcc_version=gcc-4.6.1
gmp_version=gmp-5.0.4 gmp_version=gmp-5.0.4
@ -264,16 +258,6 @@ OpenFOAM | ThirdParty)
mpfr_version=mpfr-2.4.2 mpfr_version=mpfr-2.4.2
mpc_version=mpc-0.8.1 mpc_version=mpc-0.8.1
;; ;;
Gcc44 | Gcc44++0x)
gcc_version=gcc-4.4.3
gmp_version=gmp-5.0.1
mpfr_version=mpfr-2.4.2
;;
Gcc43)
gcc_version=gcc-4.3.3
gmp_version=gmp-4.2.4
mpfr_version=mpfr-2.4.1
;;
Clang) Clang)
# using clang - not gcc # using clang - not gcc
export WM_CC='clang' export WM_CC='clang'

View File

@ -52,6 +52,13 @@ Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::baseDir() const
} }
template<class Type>
Foam::fileName Foam::externalCoupledMixedFvPatchField<Type>::lockFile() const
{
return fileName(baseDir()/(lockName + ".lock"));
}
template<class Type> template<class Type>
void Foam::externalCoupledMixedFvPatchField<Type>::createLockFile() const void Foam::externalCoupledMixedFvPatchField<Type>::createLockFile() const
{ {
@ -65,7 +72,7 @@ void Foam::externalCoupledMixedFvPatchField<Type>::createLockFile() const
Info<< type() << ": creating lock file" << endl; Info<< type() << ": creating lock file" << endl;
} }
OFstream os(baseDir()/(lockName + ".lock")); OFstream os(lockFile());
os << "waiting"; os << "waiting";
os.flush(); os.flush();
} }
@ -84,7 +91,7 @@ void Foam::externalCoupledMixedFvPatchField<Type>::removeLockFile() const
Info<< type() << ": removing lock file" << endl; Info<< type() << ": removing lock file" << endl;
} }
rm(baseDir()/(lockName + ".lock")); rm(lockFile());
} }
@ -153,15 +160,13 @@ void Foam::externalCoupledMixedFvPatchField<Type>::writeAndWait
os.flush(); os.flush();
} }
const fileName lockFile(baseDir()/(lockName + ".lock"));
// remove lock file, signalling external source to execute // remove lock file, signalling external source to execute
removeLockFile(); removeLockFile();
if (log_) if (log_)
{ {
Info<< type() << ": beginning wait for lock file " << lockFile Info<< type() << ": beginning wait for lock file " << lockFile()
<< endl; << endl;
} }
@ -189,13 +194,13 @@ void Foam::externalCoupledMixedFvPatchField<Type>::writeAndWait
<< " s" << abort(FatalError); << " s" << abort(FatalError);
} }
IFstream is(lockFile); IFstream is(lockFile());
if (is.good()) if (is.good())
{ {
if (log_) if (log_)
{ {
Info<< type() << ": found lock file " << lockFile << endl; Info<< type() << ": found lock file " << lockFile() << endl;
} }
found = true; found = true;
@ -438,8 +443,7 @@ void Foam::externalCoupledMixedFvPatchField<Type>::write(Ostream& os) const
os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl; os.writeKeyword("fileName") << fName_ << token::END_STATEMENT << nl;
os.writeKeyword("waitInterval") << waitInterval_ << token::END_STATEMENT os.writeKeyword("waitInterval") << waitInterval_ << token::END_STATEMENT
<< nl; << nl;
os.writeKeyword("timeOut") << timeOut_ << token::END_STATEMENT os.writeKeyword("timeOut") << timeOut_ << token::END_STATEMENT << nl;
<< nl;
os.writeKeyword("calcFrequency") << calcFrequency_ << token::END_STATEMENT os.writeKeyword("calcFrequency") << calcFrequency_ << token::END_STATEMENT
<< nl; << nl;
os.writeKeyword("log") << log_ << token::END_STATEMENT << nl; os.writeKeyword("log") << log_ << token::END_STATEMENT << nl;

View File

@ -47,7 +47,7 @@ Description
$FOAM_CASE/comms/patchName/data.out $FOAM_CASE/comms/patchName/data.out
The lock file is then removed, instructing the exterbal source to take The lock file is then removed, instructing the external source to take
control of the program execution. When ready, the external program control of the program execution. When ready, the external program
should create the return values, e.g. to file should create the return values, e.g. to file
@ -62,9 +62,9 @@ Description
\table \table
Property | Description | Required | Default value Property | Description | Required | Default value
commsDir | communications folder | yes | commsDir | communications folder | yes |
fileName | data transfer file name | yes | fileName | transfer file name | yes |
waitInterval | interval [s] between file checks | no | 1 waitInterval | interval [s] between file checks | no | 1
timeOut | time after which error invoked | no | 100*waitInterval timeOut | time after which error invoked [s] |no |100*waitInterval
calcFrequency | calculation frequency | no | 1 calcFrequency | calculation frequency | no | 1
log | log program control | no | no log | log program control | no | no
\endtable \endtable
@ -137,6 +137,9 @@ protected:
//- Return the file path to the base communications folder //- Return the file path to the base communications folder
fileName baseDir() const; fileName baseDir() const;
//- Return the file path to the lock file
fileName lockFile() const;
//- Create lock file //- Create lock file
void createLockFile() const; void createLockFile() const;

View File

@ -372,8 +372,14 @@ inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration
} }
// lists of parcels mass and distance from initial injection point // lists of parcels mass and distance from initial injection point
List<scalar> mass(nParcel, 0.0); List<List<scalar> > procMass(Pstream::nProcs());
List<scalar> dist(nParcel, 0.0); List<List<scalar> > procDist(Pstream::nProcs());
List<scalar>& mass = procMass[Pstream::myProcNo()];
List<scalar>& dist = procDist[Pstream::myProcNo()];
mass.setSize(nParcel);
dist.setSize(nParcel);
label i = 0; label i = 0;
scalar mSum = 0.0; scalar mSum = 0.0;
@ -392,75 +398,86 @@ inline Foam::scalar Foam::KinematicCloud<CloudType>::penetration
// calculate total mass across all processors // calculate total mass across all processors
reduce(mSum, sumOp<scalar>()); reduce(mSum, sumOp<scalar>());
Pstream::gatherList(procMass);
Pstream::gatherList(procDist);
// flatten the mass list if (Pstream::master())
List<scalar> allMass(nParcelSum, 0.0);
SubList<scalar>
(
allMass,
globalParcels.localSize(Pstream::myProcNo()),
globalParcels.offset(Pstream::myProcNo())
).assign(mass);
// flatten the distance list
SortableList<scalar> allDist(nParcelSum, 0.0);
SubList<scalar>
(
allDist,
globalParcels.localSize(Pstream::myProcNo()),
globalParcels.offset(Pstream::myProcNo())
).assign(dist);
// sort allDist distances into ascending order
// note: allMass masses are left unsorted
allDist.sort();
if (nParcelSum > 1)
{ {
const scalar mLimit = fraction*mSum; // flatten the mass lists
const labelList& indices = allDist.indices(); List<scalar> allMass(nParcelSum, 0.0);
SortableList<scalar> allDist(nParcelSum, 0.0);
if (mLimit > (mSum - allMass[indices.last()])) for (label procI = 0; procI < Pstream::nProcs(); procI++)
{ {
distance = allDist.last(); SubList<scalar>
(
allMass,
globalParcels.localSize(procI),
globalParcels.offset(procI)
).assign(procMass[procI]);
// flatten the distance list
SubList<scalar>
(
allDist,
globalParcels.localSize(procI),
globalParcels.offset(procI)
).assign(procDist[procI]);
} }
else
// sort allDist distances into ascending order
// note: allMass masses are left unsorted
allDist.sort();
if (nParcelSum > 1)
{ {
// assuming that 'fraction' is generally closer to 1 than 0, loop const scalar mLimit = fraction*mSum;
// through in reverse distance order const labelList& indices = allDist.indices();
const scalar mThreshold = (1.0 - fraction)*mSum;
scalar mCurrent = 0.0;
label i0 = 0;
forAllReverse(indices, i) if (mLimit > (mSum - allMass[indices.last()]))
{
label indI = indices[i];
mCurrent += allMass[indI];
if (mCurrent > mThreshold)
{
i0 = i;
break;
}
}
if (i0 == indices.size() - 1)
{ {
distance = allDist.last(); distance = allDist.last();
} }
else else
{ {
// linearly interpolate to determine distance // assuming that 'fraction' is generally closer to 1 than 0,
scalar alpha = (mCurrent - mThreshold)/allMass[indices[i0]]; // loop through in reverse distance order
distance = allDist[i0] + alpha*(allDist[i0+1] - allDist[i0]); const scalar mThreshold = (1.0 - fraction)*mSum;
scalar mCurrent = 0.0;
label i0 = 0;
forAllReverse(indices, i)
{
label indI = indices[i];
mCurrent += allMass[indI];
if (mCurrent > mThreshold)
{
i0 = i;
break;
}
}
if (i0 == indices.size() - 1)
{
distance = allDist.last();
}
else
{
// linearly interpolate to determine distance
scalar alpha = (mCurrent - mThreshold)/allMass[indices[i0]];
distance =
allDist[i0] + alpha*(allDist[i0+1] - allDist[i0]);
}
} }
} }
else
{
distance = allDist.first();
}
} }
else
{ Pstream::scatter(distance);
distance = allDist.first();
}
return distance; return distance;
} }

View File

@ -171,12 +171,7 @@ Foam::tmp<Foam::vectorField> Foam::axesRotation::transform
const vectorField& st const vectorField& st
) const ) const
{ {
notImplemented return (R_ & st);
(
"tmp<vectorField> Foam::axesRotation:: "
"transform(const vectorField& st) const"
);
return tmp<vectorField>(NULL);
} }
@ -185,12 +180,7 @@ Foam::tmp<Foam::vectorField> Foam::axesRotation::invTransform
const vectorField& st const vectorField& st
) const ) const
{ {
notImplemented return (Rtr_ & st);
(
"tmp<vectorField> Foam::axesRotation::"
"invTransform(const vectorField& st) const"
);
return tmp<vectorField>(NULL);
} }

View File

@ -146,6 +146,7 @@ Foam::scalarTransport::scalarTransport
active_(true), active_(true),
phiName_("phi"), phiName_("phi"),
UName_("U"), UName_("U"),
rhoName_("rho"),
DT_(0.0), DT_(0.0),
userDT_(false), userDT_(false),
resetOnStartUp_(false), resetOnStartUp_(false),
@ -192,6 +193,7 @@ void Foam::scalarTransport::read(const dictionary& dict)
phiName_ = dict.lookupOrDefault<word>("phiName", "phi"); phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
UName_ = dict.lookupOrDefault<word>("UName", "U"); UName_ = dict.lookupOrDefault<word>("UName", "U");
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
userDT_ = false; userDT_ = false;
if (dict.readIfPresent("DT", DT_)) if (dict.readIfPresent("DT", DT_))
@ -237,24 +239,59 @@ void Foam::scalarTransport::execute()
relaxCoeff = mesh_.equationRelaxationFactor(schemeVar); relaxCoeff = mesh_.equationRelaxationFactor(schemeVar);
} }
// solve if (phi.dimensions() == dimMass/dimTime)
for (label i = 0; i <= nCorr_; i++)
{ {
fvScalarMatrix TEqn const volScalarField& rho =
( mesh_.lookupObject<volScalarField>(rhoName_);
fvm::ddt(T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(T_)
);
TEqn.relax(relaxCoeff); // solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix TEqn
(
fvm::ddt(rho, T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(rho, T_)
);
fvOptions_.constrain(TEqn); TEqn.relax(relaxCoeff);
TEqn.solve(mesh_.solverDict(UName_)); fvOptions_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(schemeVar));
}
} }
else if (phi.dimensions() == dimVolume/dimTime)
{
// solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix TEqn
(
fvm::ddt(T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(T_)
);
TEqn.relax(relaxCoeff);
fvOptions_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(schemeVar));
}
}
else
{
FatalErrorIn("void Foam::scalarTransport::execute()")
<< "Incompatible dimensions for phi: " << phi.dimensions() << nl
<< "Dimensions should be " << dimMass/dimTime << " or "
<< dimVolume/dimTime << endl;
}
Info<< endl; Info<< endl;
} }

View File

@ -90,6 +90,9 @@ class scalarTransport
//- Name of velocity field (optional) //- Name of velocity field (optional)
word UName_; word UName_;
//- Name of density field (optional)
word rhoName_;
//- Diffusion coefficient (optional) //- Diffusion coefficient (optional)
scalar DT_; scalar DT_;

View File

@ -439,20 +439,25 @@ bool finishReaction = false;
<readThermoSpecieName>{thermoSpecieName} { <readThermoSpecieName>{thermoSpecieName} {
string specieString(foamSpecieString(YYText())); string specieString(foamSpecieString(YYText()));
// Old format if (newFormat_)
size_t spacePos = specieString.find(' ');
if (spacePos != string::npos)
{ {
currentSpecieName = specieString(0, spacePos); specieString.replaceAll(" ", "_");
size_t strEnd = specieString.find_last_not_of('_');
currentSpecieName = specieString.substr(0, strEnd + 1);
} }
else else
{ {
currentSpecieName = specieString; size_t spacePos = specieString.find(' ');
if (spacePos != string::npos)
{
currentSpecieName = specieString(0, spacePos);
}
else
{
currentSpecieName = specieString;
}
} }
// New format
// specieString.replaceAll(" ", "_");
// size_t strEnd = specieString.find_last_not_of('_');
// currentSpecieName = specieString.substr(0, strEnd + 1);
BEGIN(readThermoDate); BEGIN(readThermoDate);
} }

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) 2013-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -862,13 +862,15 @@ Foam::chemkinReader::chemkinReader
( (
const fileName& CHEMKINFileName, const fileName& CHEMKINFileName,
speciesTable& species, speciesTable& species,
const fileName& thermoFileName const fileName& thermoFileName,
const bool newFormat
) )
: :
lineNo_(1), lineNo_(1),
specieNames_(10), specieNames_(10),
speciesTable_(species), speciesTable_(species),
reactions_(speciesTable_, speciesThermo_) reactions_(speciesTable_, speciesThermo_),
newFormat_(newFormat)
{ {
read(CHEMKINFileName, thermoFileName); read(CHEMKINFileName, thermoFileName);
} }
@ -883,8 +885,14 @@ Foam::chemkinReader::chemkinReader
lineNo_(1), lineNo_(1),
specieNames_(10), specieNames_(10),
speciesTable_(species), speciesTable_(species),
reactions_(speciesTable_, speciesThermo_) reactions_(speciesTable_, speciesThermo_),
newFormat_(thermoDict.lookupOrDefault("newFormat", false))
{ {
if (newFormat_)
{
Info<< "Reading CHEMKIN thermo data in new file format" << endl;
}
fileName chemkinFile(fileName(thermoDict.lookup("CHEMKINFile")).expand()); fileName chemkinFile(fileName(thermoDict.lookup("CHEMKINFile")).expand());
fileName thermoFile = fileName::null; fileName thermoFile = fileName::null;

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) 2013-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -39,6 +39,7 @@ SourceFiles
#include "chemistryReader.H" #include "chemistryReader.H"
#include "fileName.H" #include "fileName.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "Switch.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
#include "ReactionList.H" #include "ReactionList.H"
#include "DynamicList.H" #include "DynamicList.H"
@ -207,6 +208,9 @@ private:
//- List of the reactions //- List of the reactions
ReactionList<gasHThermoPhysics> reactions_; ReactionList<gasHThermoPhysics> reactions_;
//- Flag to indicate that file is in new format
Switch newFormat_;
// Private Member Functions // Private Member Functions
@ -319,7 +323,8 @@ public:
( (
const fileName& chemkinFile, const fileName& chemkinFile,
speciesTable& species, speciesTable& species,
const fileName& thermoFileName = fileName::null const fileName& thermoFileName = fileName::null,
const bool newFormat = false
); );
//- Construct by getting the CHEMKIN III file name from dictionary //- Construct by getting the CHEMKIN III file name from dictionary

View File

@ -33,8 +33,14 @@ porosity1
coordinateSystem coordinateSystem
{ {
e1 (0.70710678 0.70710678 0); type cartesian;
e3 (0 0 1); origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (0.70710678 0.70710678 0);
e3 (0 0 1);
}
} }
} }
} }

View File

@ -54,10 +54,17 @@ geometry
scale (1.0 1.0 2.1); scale (1.0 1.0 2.1);
transform transform
{ {
type cartesian; coordinateSystem
origin (2 2 0); {
e1 (1 0 0); type cartesian;
e3 (0 0 1); origin (2 2 0);
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
e3 (0 0 1);
}
}
} }
} }
herring herring
@ -66,10 +73,17 @@ geometry
scale (1.0 1.0 2.1); scale (1.0 1.0 2.1);
transform transform
{ {
type cartesian; coordinateSystem
origin (3.5 3 0); {
e1 (1 0 0); type cartesian;
e3 (0 0 1); origin (3.5 3 0);
coordinateRotation
{
type axesRotation;
e1 (1 0 0);
e3 (0 0 1);
}
}
} }
} }
} }

View File

@ -17,7 +17,7 @@ FoamFile
thermoType thermoType
{ {
type hePsiThermo; type heRhoThermo;
mixture pureMixture; mixture pureMixture;
transport const; transport const;
thermo hConst; thermo hConst;

View File

@ -42,16 +42,16 @@ solvers
SIMPLE SIMPLE
{ {
momentumPredictor yes; momentumPredictor no;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
pRefCell 0; pRefCell 0;
pRefValue 0; pRefValue 0;
residualControl residualControl
{ {
p_rgh 1e-2; p_rgh 1e-4;
U 1e-3; U 1e-4;
h 1e-3; h 1e-4;
// possibly check turbulence fields // possibly check turbulence fields
"(k|epsilon|omega)" 1e-3; "(k|epsilon|omega)" 1e-3;

View File

@ -17,7 +17,7 @@ FoamFile
thermoType thermoType
{ {
type hePsiThermo; type heRhoThermo;
mixture pureMixture; mixture pureMixture;
transport const; transport const;
thermo hConst; thermo hConst;

View File

@ -17,7 +17,7 @@ FoamFile
thermoType thermoType
{ {
type hePsiThermo; type heRhoThermo;
mixture pureMixture; mixture pureMixture;
transport const; transport const;
thermo hConst; thermo hConst;

View File

@ -17,7 +17,7 @@ FoamFile
thermoType thermoType
{ {
type hePsiThermo; type heRhoThermo;
mixture pureMixture; mixture pureMixture;
transport const; transport const;
thermo hConst; thermo hConst;

View File

@ -15,11 +15,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// thermoType hePsiThermo<pureMixture<const<hConst<perfectGas<specie>>,sensibleEnthalpy>>>;
thermoType thermoType
{ {
type hePsiThermo; type heRhoThermo;
mixture pureMixture; mixture pureMixture;
transport const; transport const;
thermo hConst; thermo hConst;

View File

@ -51,8 +51,14 @@ porosityBlockage
coordinateSystem coordinateSystem
{ {
e1 (0 1 0); type cartesian;
e2 (0 0 1); origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (0 1 0);
e2 (0 0 1);
}
} }
} }
} }

View File

@ -21,7 +21,7 @@ chemistryType
chemistryThermo psi; chemistryThermo psi;
} }
chemistry off; chemistry on;
initialChemicalTimeStep 1e-07; initialChemicalTimeStep 1e-07;

View File

@ -15,9 +15,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
combustionModel PaSR<psiChemistryCombustion>; combustionModel PaSR<psiChemistryCombustion>;
active false; active yes;
PaSRCoeffs PaSRCoeffs
{ {

View File

@ -28,7 +28,9 @@ thermoType
CHEMKINFile "$FOAM_CASE/chemkin/chem.inp"; CHEMKINFile "$FOAM_CASE/chemkin/chem.inp";
CHEMKINThermoFile "~OpenFOAM/thermoData/therm.dat"; CHEMKINThermoFile "$FOAM_CASE/chemkin/therm.dat";
newFormat yes;
inertSpecie N2; inertSpecie N2;

View File

@ -8,7 +8,7 @@
FoamFile FoamFile
{ {
version 2.0; version 2.0;
format binary; format ascii;
class dictionary; class dictionary;
location "system"; location "system";
object controlDict; object controlDict;