Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
7b5de802
Commit
7b5de802
authored
Nov 25, 2010
by
Mark Olesen
Browse files
Merge remote branch 'OpenCFD/master' into olesenm
parents
a2ef9cdc
95bc0572
Changes
150
Hide whitespace changes
Inline
Side-by-side
applications/solvers/combustion/chemFoam/Make/files
0 → 100644
View file @
7b5de802
chemFoam.C
EXE = $(FOAM_APPBIN)/chemFoam
applications/solvers/combustion/chemFoam/Make/options
0 → 100644
View file @
7b5de802
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude\
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
EXE_LIBS = \
-lfiniteVolume \
-lcompressibleRASModels \
-lreactionThermophysicalModels \
-lbasicThermophysicalModels \
-lchemistryModel \
-lODE \
-lthermophysicalFunctions \
-lspecie
applications/solvers/combustion/chemFoam/YEqn.H
0 → 100644
View file @
7b5de802
{
forAll
(
Y
,
specieI
)
{
volScalarField
&
Yi
=
Y
[
specieI
];
solve
(
fvm
::
ddt
(
rho
,
Yi
)
-
chemistry
.
RR
(
specieI
),
mesh
.
solver
(
"Yi"
)
);
}
}
\ No newline at end of file
applications/solvers/combustion/chemFoam/chemFoam.C
0 → 100644
View file @
7b5de802
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 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 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
chemFoam
Description
Solver for chemistry problems
- designed for use on single cell cases to provide comparison against
other chemistry solvers
- single cell mesh created on-the-fly
- fields created on the fly from the initial conditions
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "hCombustionThermo.H"
#include "turbulenceModel.H"
#include "psiChemistryModel.H"
#include "chemistrySolver.H"
#include "OFstream.H"
#include "thermoPhysicsTypes.H"
#include "basicMultiComponentMixture.H"
#include "cellModeller.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int
main
(
int
argc
,
char
*
argv
[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createSingleCellMesh.H"
#include "createFields.H"
#include "readInitialConditions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info
<<
"
\n
Starting time loop
\n
"
<<
endl
;
while
(
runTime
.
run
())
{
#include "readControls.H"
#include "setDeltaT.H"
runTime
++
;
Info
<<
"Time = "
<<
runTime
.
timeName
()
<<
nl
<<
endl
;
#include "solveChemistry.H"
{
#include "YEqn.H"
#include "hEqn.H"
#include "pEqn.H"
}
#include "output.H"
Info
<<
"ExecutionTime = "
<<
runTime
.
elapsedCpuTime
()
<<
" s"
<<
" ClockTime = "
<<
runTime
.
elapsedClockTime
()
<<
" s"
<<
nl
<<
endl
;
}
Info
<<
"Number of steps = "
<<
runTime
.
timeIndex
()
<<
endl
;
Info
<<
"End"
<<
nl
<<
endl
;
return
(
0
);
}
// ************************************************************************* //
applications/solvers/combustion/chemFoam/createBaseFields.H
0 → 100644
View file @
7b5de802
// write base thermo fields - not registered since will be re-read by
// thermo package
Info
<<
"Creating base fields for time "
<<
runTime
.
timeName
()
<<
endl
;
{
volScalarField
Ydefault
(
IOobject
(
"Ydefault"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
NO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
"Ydefault"
,
dimless
,
1
)
);
Ydefault
.
write
();
volScalarField
p
(
IOobject
(
"p"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
NO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
"p"
,
dimPressure
,
p0
)
);
p
.
write
();
volScalarField
T
(
IOobject
(
"T"
,
runTime
.
timeName
(),
mesh
,
IOobject
::
READ_IF_PRESENT
,
IOobject
::
NO_WRITE
,
false
),
mesh
,
dimensionedScalar
(
"T"
,
dimTemperature
,
T0
)
);
T
.
write
();
}
applications/solvers/combustion/chemFoam/createFields.H
0 → 100644
View file @
7b5de802
if
(
mesh
.
nCells
()
!=
1
)
{
FatalErrorIn
(
args
.
executable
())
<<
"Solver only applicable to single cell cases"
<<
exit
(
FatalError
);
}
Info
<<
"Reading initial conditions.
\n
"
<<
endl
;
IOdictionary
initialConditions
(
IOobject
(
"initialConditions"
,
runTime
.
constant
(),
runTime
,
IOobject
::
MUST_READ_IF_MODIFIED
,
IOobject
::
NO_WRITE
)
);
scalar
p0
=
readScalar
(
initialConditions
.
lookup
(
"p"
));
scalar
T0
=
readScalar
(
initialConditions
.
lookup
(
"T"
));
#include "createBaseFields.H"
Info
<<
nl
<<
"Reading thermophysicalProperties"
<<
endl
;
autoPtr
<
psiChemistryModel
>
pChemistry
(
psiChemistryModel
::
New
(
mesh
));
psiChemistryModel
&
chemistry
=
pChemistry
();
scalar
dtChem
=
refCast
<
const
psiChemistryModel
>
(
chemistry
).
deltaTChem
()[
0
];
hsCombustionThermo
&
thermo
=
chemistry
.
thermo
();
basicMultiComponentMixture
&
composition
=
thermo
.
composition
();
PtrList
<
volScalarField
>&
Y
=
composition
.
Y
();
volScalarField
rho
(
IOobject
(
"rho"
,
runTime
.
timeName
(),
runTime
,
IOobject
::
NO_READ
,
IOobject
::
AUTO_WRITE
),
thermo
.
rho
()
);
volScalarField
&
p
=
thermo
.
p
();
volScalarField
&
hs
=
thermo
.
hs
();
volVectorField
U
(
IOobject
(
"U"
,
runTime
.
timeName
(),
runTime
,
IOobject
::
NO_READ
,
IOobject
::
NO_WRITE
),
mesh
,
dimensionedVector
(
"zero"
,
dimVelocity
,
vector
::
zero
),
p
.
boundaryField
().
types
()
);
#include "createPhi.H"
Info
<<
"Creating turbulence model.
\n
"
<<
endl
;
autoPtr
<
compressible
::
turbulenceModel
>
turbulence
(
compressible
::
turbulenceModel
::
New
(
rho
,
U
,
phi
,
thermo
)
);
OFstream
post
(
args
.
path
()
/
"chemFoam.out"
);
post
<<
"# Time"
<<
token
::
TAB
<<
"Temperature [K]"
<<
token
::
TAB
<<
"Pressure [Pa]"
<<
endl
;
applications/solvers/combustion/chemFoam/createSingleCellMesh.H
0 → 100644
View file @
7b5de802
Info
<<
"Constructing single cell mesh"
<<
nl
<<
endl
;
labelList
owner
(
6
,
0
);
labelList
neighbour
(
0
);
pointField
points
(
8
);
points
[
0
]
=
vector
(
0
,
0
,
0
);
points
[
1
]
=
vector
(
1
,
0
,
0
);
points
[
2
]
=
vector
(
1
,
1
,
0
);
points
[
3
]
=
vector
(
0
,
1
,
0
);
points
[
4
]
=
vector
(
0
,
0
,
1
);
points
[
5
]
=
vector
(
1
,
0
,
1
);
points
[
6
]
=
vector
(
1
,
1
,
1
);
points
[
7
]
=
vector
(
0
,
1
,
1
);
const
cellModel
&
hexa
=
*
(
cellModeller
::
lookup
(
"hex"
));
faceList
faces
=
hexa
.
modelFaces
();
fvMesh
mesh
(
IOobject
(
fvMesh
::
defaultRegion
,
runTime
.
timeName
(),
runTime
,
IOobject
::
NO_READ
),
xferMove
<
Field
<
vector
>
>
(
points
),
faces
.
xfer
(),
owner
.
xfer
(),
neighbour
.
xfer
()
);
List
<
polyPatch
*>
patches
(
1
);
patches
[
0
]
=
new
emptyPolyPatch
(
"boundary"
,
6
,
0
,
0
,
mesh
.
boundaryMesh
());
mesh
.
addFvPatches
(
patches
);
applications/solvers/combustion/chemFoam/hEqn.H
0 → 100644
View file @
7b5de802
{
if
(
constProp
==
"volume"
)
{
hs
[
0
]
=
u0
+
p
[
0
]
/
rho
[
0
]
+
integratedHeat
;
}
else
{
hs
[
0
]
=
hs0
+
integratedHeat
;
}
}
\ No newline at end of file
applications/solvers/combustion/chemFoam/output.H
0 → 100644
View file @
7b5de802
runTime
.
write
();
Info
<<
"Sh = "
<<
Sh
<<
", T = "
<<
thermo
.
T
()[
0
]
<<
", p = "
<<
thermo
.
p
()[
0
]
<<
", "
<<
Y
[
0
].
name
()
<<
" = "
<<
Y
[
0
][
0
]
<<
endl
;
post
<<
runTime
.
value
()
<<
token
::
TAB
<<
thermo
.
T
()[
0
]
<<
token
::
TAB
<<
thermo
.
p
()[
0
]
<<
endl
;
applications/solvers/combustion/chemFoam/pEqn.H
0 → 100644
View file @
7b5de802
{
thermo
.
correct
();
rho
=
thermo
.
rho
();
if
(
constProp
==
"volume"
)
{
p
[
0
]
=
rho0
*
R0
*
thermo
.
T
()[
0
];
rho
[
0
]
=
rho0
;
}
}
\ No newline at end of file
applications/solvers/combustion/chemFoam/readControls.H
0 → 100644
View file @
7b5de802
if
(
runTime
.
controlDict
().
lookupOrDefault
(
"suppressSolverInfo"
,
false
))
{
lduMatrix
::
debug
=
0
;
}
Switch
adjustTimeStep
(
runTime
.
controlDict
().
lookup
(
"adjustTimeStep"
));
scalar
maxDeltaT
(
readScalar
(
runTime
.
controlDict
().
lookup
(
"maxDeltaT"
)));
applications/solvers/combustion/chemFoam/readInitialConditions.H
0 → 100644
View file @
7b5de802
word
constProp
(
initialConditions
.
lookup
(
"constantProperty"
));
if
(
constProp
==
"pressure"
||
constProp
==
"volume"
)
{
Info
<<
constProp
<<
" will be held constant."
<<
nl
<<
" p = "
<<
p
[
0
]
<<
" [Pa]"
<<
nl
<<
" T = "
<<
thermo
.
T
()[
0
]
<<
" [K] "
<<
nl
<<
" rho = "
<<
rho
[
0
]
<<
" [kg/m3]"
<<
nl
<<
endl
;
}
else
{
FatalError
<<
"in initialConditions, unknown constantProperty type "
<<
constProp
<<
nl
<<
" Valid types are: pressure volume."
<<
abort
(
FatalError
);
}
word
fractionBasis
(
initialConditions
.
lookup
(
"fractionBasis"
));
if
((
fractionBasis
!=
"mass"
)
&&
(
fractionBasis
!=
"mole"
))
{
FatalError
<<
"in initialConditions, unknown fractionBasis type "
<<
nl
<<
"Valid types are: mass or mole."
<<
fractionBasis
<<
abort
(
FatalError
);
}
label
nSpecie
=
Y
.
size
();
PtrList
<
gasThermoPhysics
>
specieData
(
Y
.
size
());
forAll
(
specieData
,
i
)
{
specieData
.
set
(
i
,
new
gasThermoPhysics
(
dynamic_cast
<
const
reactingMixture
<
gasThermoPhysics
>&>
(
thermo
).
speciesData
()[
i
]
)
);
}
scalarList
Y0
(
nSpecie
,
0
.
0
);
scalarList
X0
(
nSpecie
,
0
.
0
);
dictionary
fractions
(
initialConditions
.
subDict
(
"fractions"
));
if
(
fractionBasis
==
"mole"
)
{
forAll
(
Y
,
i
)
{
const
word
&
name
=
Y
[
i
].
name
();
if
(
fractions
.
found
(
name
))
{
X0
[
i
]
=
readScalar
(
fractions
.
lookup
(
name
));
}
}
scalar
mw
=
0
.
0
;
const
scalar
mTot
=
sum
(
X0
);
forAll
(
Y
,
i
)
{
X0
[
i
]
/=
mTot
;
mw
+=
specieData
[
i
].
W
()
*
X0
[
i
];
}
forAll
(
Y
,
i
)
{
Y0
[
i
]
=
X0
[
i
]
*
specieData
[
i
].
W
()
/
mw
;
}
}
else
// mass fraction
{
forAll
(
Y
,
i
)
{
const
word
&
name
=
Y
[
i
].
name
();
if
(
fractions
.
found
(
name
))
{
Y0
[
i
]
=
readScalar
(
fractions
.
lookup
(
name
));
}
}
scalar
invW
=
0
.
0
;
const
scalar
mTot
=
sum
(
Y0
);
forAll
(
Y
,
i
)
{
Y0
[
i
]
/=
mTot
;
invW
+=
Y0
[
i
]
/
specieData
[
i
].
W
();
}
const
scalar
mw
=
1
.
0
/
invW
;
forAll
(
Y
,
i
)
{
X0
[
i
]
=
Y0
[
i
]
*
mw
/
specieData
[
i
].
W
();
}
}
scalar
hs0
=
0
.
0
;
forAll
(
Y
,
i
)
{
Y
[
i
]
=
Y0
[
i
];
hs0
+=
Y0
[
i
]
*
specieData
[
i
].
Hs
(
T0
);
}
hs
=
dimensionedScalar
(
"hs"
,
dimEnergy
/
dimMass
,
hs0
);
thermo
.
correct
();
rho
=
thermo
.
rho
();
scalar
rho0
=
rho
[
0
];
scalar
u0
=
hs0
-
p0
/
rho0
;
scalar
R0
=
p0
/
(
rho0
*
T0
);
scalar
integratedHeat
=
0
.
0
;
applications/solvers/combustion/chemFoam/setDeltaT.H
0 → 100644
View file @
7b5de802
if
(
adjustTimeStep
)
{
runTime
.
setDeltaT
(
min
(
dtChem
,
maxDeltaT
));
Info
<<
"deltaT = "
<<
runTime
.
deltaT
().
value
()
<<
endl
;
}
applications/solvers/combustion/chemFoam/solveChemistry.H
0 → 100644
View file @
7b5de802
dtChem
=
chemistry
.
solve
(
runTime
.
value
()
-
runTime
.
deltaT
().
value
(),
runTime
.
deltaT
().
value
()
);
scalar
Sh
=
chemistry
.
Sh
()()[
0
]
/
rho
[
0
];
integratedHeat
+=
Sh
*
runTime
.
deltaT
().
value
();
applications/test/nearWallDist-wave/Test-WallDist2.C
View file @
7b5de802
...
...
@@ -29,7 +29,7 @@ Description
#include "fvCFD.H"
#include "wallFvPatch.H"
#include "
Mesh
Wave.H"
#include "
FaceCell
Wave.H"
#include "wallPoint.H"
...
...
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
forAll
(
allCellInfo
,
cellI
)
{
scalar
dist
=
allCellInfo
[
cellI
].
distSqr
();
if
(
allCellInfo
[
cellI
].
valid
())
if
(
allCellInfo
[
cellI
].
valid
(
wallDistCalc
.
data
()
))
{
wallDistUncorrected
[
cellI
]
=
Foam
::
sqrt
(
dist
);
}
...
...
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
const
label
meshFaceI
=
patchField
.
patch
().
start
()
+
patchFaceI
;
scalar
dist
=
allFaceInfo
[
meshFaceI
].
distSqr
();
if
(
allFaceInfo
[
meshFaceI
].
valid
())
if
(
allFaceInfo
[
meshFaceI
].
valid
(
wallDistCalc
.
data
()
))
{
patchField
[
patchFaceI
]
=
Foam
::
sqrt
(
dist
);
}
...
...
applications/utilities/mesh/advanced/selectCells/selectCells.C
View file @
7b5de802
...
...
@@ -299,7 +299,7 @@ label selectOutsideCells
mesh
,
outsideFaces
.
shrink
(),
outsideFacesInfo
.
shrink
(),
mesh
.
globalData
().
nTotalCells
()
+
1
// max iterations
mesh
.
globalData
().
nTotalCells
()
+
1
// max iterations
);
// Now regionCalc should hold info on cells that are reachable from
...
...
applications/utilities/mesh/generation/blockMesh/blockMeshApp.C
View file @
7b5de802
...
...
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
blockMesh
::
verbose
(
true
);
IOdictionary
meshDict
(
meshDictIoPtr
());
blockMesh
blocks
(
meshDict
);
blockMesh
blocks
(
meshDict
,
regionName
);
if
(
args
.
optionFound
(
"blockTopology"
))
...
...
applications/utilities/mesh/manipulation/checkMesh/checkTopology.C
View file @
7b5de802
...
...
@@ -147,8 +147,8 @@ Foam::label Foam::checkTopology
}
}
fa
ceSet
oneCells
(
mesh
,
"oneInternalFaceCells"
,
mesh
.
nCells
()
/
100
);
fa
ceSet
twoCells
(
mesh
,
"twoInternalFacesCells"
,
mesh
.
nCells
()
/
100
);
ce
ll
Set
oneCells
(
mesh
,
"oneInternalFaceCells"
,
mesh
.
nCells
()
/
100
);
ce
ll
Set
twoCells
(
mesh
,
"twoInternalFacesCells"
,
mesh
.
nCells
()
/
100
);
forAll
(
nInternalFaces
,
cellI
)
{
...
...
applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/vtkPV3blockMesh/vtkPV3blockMesh.C
View file @
7b5de802
...
...
@@ -321,7 +321,7 @@ void Foam::vtkPV3blockMesh::updateFoamMesh()
)
);
meshPtr_
=
new
blockMesh
(
meshDict
);
meshPtr_
=
new
blockMesh
(
meshDict
,
polyMesh
::
defaultRegion
);
}
...
...
applications/utilities/postProcessing/lagrangian/steadyParticleTracks/steadyParticleTracksTemplates.C
View file @
7b5de802
...
...
@@ -83,7 +83,7 @@ PtrList<List<Type> > readFields
{
Info
<<
" reading field "
<<
obj
.
name
()
<<
endl
;
IOField
<
Type
>
newField
(
obj
);
values
.
set
(
fieldI
++
,
new
List
<
Type
>
(
newField
.
xfer
List
()));
values
.
set
(
fieldI
++
,
new
List
<
Type
>
(
newField
.
xfer
()));
break
;
}
}
...
...
Prev
1
2
3
4
5
…
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment