Compare commits

..

2 commits

Author SHA1 Message Date
Combustion Lab
cd6edbb818 Merge branch 'AllwmakeScript' 2017-08-18 22:23:06 +09:00
ignis
a06cbf56ab Allwmake script for compilation 2017-08-18 20:51:31 +09:00
15 changed files with 82 additions and 468 deletions

17
.gitignore vendored
View file

@ -82,20 +82,3 @@ doc/Doxygen/DTAGS
# Ignore the test directory
/tutorialsTest
.*.swp
*.gz
log.*
postProcessing
*~
processor*
[0-9]*
[0-9]*.[0-9]*
!0.org
constant/extendedFeatureEdgeMesh
*.eMesh
constant/polyMesh/*
!constant/polyMesh/blockMeshDict
constant/cellToRegion
*.OpenFOAM
*.foam

11
Allwmake Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
libs/Allwmake $targetType $*
solvers_post/Allwmake $targetType $*
#------------------------------------------------------------------------------

View file

@ -21,7 +21,7 @@ thermoType
mixture reactingMixture;
transport sutherland;
thermo janaf;
energy absoluteEnthalpy;
energy sensibleEnthalpy;
equationOfState perfectGas;
specie specie;
}

View file

@ -33,7 +33,7 @@ divSchemes
div(phi,U) Gauss linearUpwindV cellLimited Gauss linear 1;
div(phi,Yi_h) Gauss multivariateSelection
{
ha linearUpwind cellLimited Gauss linear 1;
h linearUpwind cellLimited Gauss linear 1;
H2 linearUpwind cellLimited Gauss linear 1;
H linearUpwind cellLimited Gauss linear 1;
O linearUpwind cellLimited Gauss linear 1;

View file

@ -46,14 +46,14 @@ solvers
relTol 0.0;
}
"(U|Yi|ha|k|epsilon|mf|mfVar|Fk)"
"(U|Yi|h|k|epsilon|mf|mfVar|Fk)"
{
solver PBiCG;
preconditioner DILU;
tolerance 1e-08;
relTol 0;
}
"(U|Yi|ha|k|epsilon|mf|mfVar|Fk)Final"
"(U|Yi|h|k|epsilon|mf|mfVar|Fk)Final"
{
solver PBiCG;
preconditioner DILU;

10
libs/Allwmake Executable file
View file

@ -0,0 +1,10 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake $targetType chemistryModel_POSTECH
wmake $targetType combustionModels_POSTECH
#------------------------------------------------------------------------------

View file

@ -1,3 +0,0 @@
thermoAdd.C
LIB = $(FOAM_USER_LIBBIN)/libthermoAdd

View file

@ -1,29 +0,0 @@
OFP_LIB_SRC = ../
EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(OFP_LIB_SRC)//chemistryModel_POSTECH/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/functions/Polynomial \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lreactionThermophysicalModels \
-lspecie \
-lthermophysicalFunctions \
-lODE \
-lfiniteVolume \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lsolidSpecie \
-lfiniteVolume \
-lOpenFOAM

View file

@ -1,384 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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/>.
Typedefs
Foam::thermoPhysicsTypes
Description
Type definitions for thermo-physics models
\*---------------------------------------------------------------------------*/
#include "specie.H"
#include "perfectGas.H"
#include "janafThermo.H"
#include "absoluteEnthalpy.H"
#include "absoluteInternalEnergy.H"
#include "thermo.H"
#include "sutherlandTransport.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// thermo physics types based on absoluteEnthalpy
typedef
sutherlandTransport
<
species::thermo
<
janafThermo
<
perfectGas<specie>
>,
absoluteEnthalpy
>
> gasHaThermoPhysics;
// thermo physics types based on absoluteInternalEnergy
typedef
sutherlandTransport
<
species::thermo
<
janafThermo
<
perfectGas<specie>
>,
absoluteInternalEnergy
>
> gasEaThermoPhysics;
} // End namespace Foam
/*---------------------------------------------------------------------------*\
Typedefs
Foam::reactionTypes
Description
Type definitions for reactions
\*---------------------------------------------------------------------------*/
#include "Reaction.H"
namespace Foam
{
// absolute enthalpy based reactions
typedef Reaction<gasHaThermoPhysics> gasHaReaction;
// absolute internal ennergy based reactions
typedef Reaction<gasEaThermoPhysics> gasEaReaction;
}
// ************************************************************************* //
#include "makeReactionThermo.H"
#include "chemistryReader.H"
#include "foamChemistryReader.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Gas chemistry readers based on absoluteEnthalpy
makeChemistryReader(gasHaThermoPhysics);
makeChemistryReaderType(foamChemistryReader, gasHaThermoPhysics);
// Gas chemistry readers based on absoluteInternalEnergy
makeChemistryReader(gasEaThermoPhysics);
makeChemistryReaderType(foamChemistryReader, gasEaThermoPhysics);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "makeReaction.H"
#include "ArrheniusReactionRate.H"
#include "infiniteReactionRate.H"
#include "LandauTellerReactionRate.H"
#include "thirdBodyArrheniusReactionRate.H"
#include "ChemicallyActivatedReactionRate.H"
#include "JanevReactionRate.H"
#include "powerSeriesReactionRate.H"
#include "FallOffReactionRate.H"
#include "LindemannFallOffFunction.H"
#include "SRIFallOffFunction.H"
#include "TroeFallOffFunction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makeReactions(Thermo, Reaction) \
\
defineTemplateTypeNameAndDebug(Reaction, 0); \
defineTemplateRunTimeSelectionTable(Reaction, Istream); \
defineTemplateRunTimeSelectionTable(Reaction, dictionary); \
\
makeIRNReactions(Thermo, ArrheniusReactionRate) \
makeIRNReactions(Thermo, infiniteReactionRate) \
makeIRNReactions(Thermo, LandauTellerReactionRate) \
makeIRNReactions(Thermo, thirdBodyArrheniusReactionRate) \
\
makeIRReactions(Thermo, JanevReactionRate) \
makeIRReactions(Thermo, powerSeriesReactionRate) \
\
makePressureDependentReactions \
( \
Thermo, \
ArrheniusReactionRate, \
LindemannFallOffFunction \
) \
\
makePressureDependentReactions \
( \
Thermo, \
ArrheniusReactionRate, \
TroeFallOffFunction \
) \
\
makePressureDependentReactions \
( \
Thermo, \
ArrheniusReactionRate, \
SRIFallOffFunction \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// absolute enthalpy based reactions
makeReactions(gasHaThermoPhysics, gasHaReaction)
makeReactions(gasEaThermoPhysics, gasEaReaction)
}
// ************************************************************************* //
#include "makeReactionThermo.H"
#include "psiReactionThermo.H"
#include "hePsiThermo.H"
#include "specie.H"
#include "perfectGas.H"
#include "janafThermo.H"
#include "absoluteEnthalpy.H"
#include "thermo.H"
#include "sutherlandTransport.H"
#include "homogeneousMixture.H"
#include "inhomogeneousMixture.H"
#include "veryInhomogeneousMixture.H"
#include "multiComponentMixture.H"
#include "reactingMixture.H"
#include "singleStepReactingMixture.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// sutherlandTransport, janafThermo
makeReactionThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
homogeneousMixture,
sutherlandTransport,
absoluteEnthalpy,
janafThermo,
perfectGas,
specie
);
makeReactionThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
inhomogeneousMixture,
sutherlandTransport,
absoluteEnthalpy,
janafThermo,
perfectGas,
specie
);
makeReactionThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
veryInhomogeneousMixture,
sutherlandTransport,
absoluteEnthalpy,
janafThermo,
perfectGas,
specie
);
// Multi-component thermo for absolute enthalpy
makeReactionMixtureThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
multiComponentMixture,
gasHaThermoPhysics
);
// Multi-component thermo for internal energy
makeReactionMixtureThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
multiComponentMixture,
gasEaThermoPhysics
);
// Multi-component reaction thermo for absolute enthalpy
makeReactionMixtureThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
reactingMixture,
gasHaThermoPhysics
);
makeReactionMixtureThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
singleStepReactingMixture,
gasHaThermoPhysics
);
// Multi-component reaction thermo for internal energy
makeReactionMixtureThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
reactingMixture,
gasEaThermoPhysics
);
makeReactionMixtureThermo
(
psiThermo,
psiReactionThermo,
hePsiThermo,
singleStepReactingMixture,
gasEaThermoPhysics
);
} // End namespace Foam
/*---------------------------------------------------------------------------*\
InClass
Foam::psiChemistryModel
Description
Creates chemistry model instances templated on the type of thermodynamics
\*---------------------------------------------------------------------------*/
#include "makeChemistryModel.H"
#include "psiChemistryModel.H"
#include "chemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Chemistry moldels based on absoluteEnthalpy
makeChemistryModel
(
chemistryModel,
psiChemistryModel,
gasHaThermoPhysics
);
// Chemistry moldels based on absoluteInternalEnergy
makeChemistryModel
(
chemistryModel,
psiChemistryModel,
gasEaThermoPhysics
);
}
// ************************************************************************* //
#include "makeChemistrySolverTypes.H"
#include "psiChemistryModel.H"
#include "rhoChemistryModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Chemistry solvers based on absoluteEnthalpy
makeChemistrySolverTypes(psiChemistryModel, gasHaThermoPhysics);
// makeChemistrySolverTypes(rhoChemistryModel, gasHaThermoPhysics);
// Chemistry solvers based on absoluteInternalEnergy
makeChemistrySolverTypes(psiChemistryModel, gasEaThermoPhysics);
// makeChemistrySolverTypes(rhoChemistryModel, gasEaThermoPhysics);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

12
solvers_post/Allwmake Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake SLFMFoam
wmake LagrangianCMCFoam
wmake LagrangianCMCSprayFoam
wmake LagrangianCMCdieselEngineFoam4x
#------------------------------------------------------------------------------

View file

@ -1,37 +1,50 @@
forAll(rho, celli)
{
if(F_total[celli] > 0)
{
scalarField Ytemp(Ysize, 0.0);
for(label i = 0 ; i < Ysize ; i++) //mass fraction integration over an eta-space for species i
if(F_total[celli] > 0)
{
for(label k=0 ; k<=group ; k++)
{
for(label j=0 ; j<=etamax ; j++)
scalarField Ytemp(Ysize, 0.0);
for(label i=0 ; i < Ysize ; i++) //reaction rate integration over an eta-space for species i
{
pdf[j] = Peta[j][celli];
f[j] = QiCMC[(k*(etamax+1)+j)*Ysize + i];
}
Ytemp[i] += Ffrac[k][celli]*integration(deltaftn[celli], MFcut, Neta, pdf, f);
}
}
for(label k=0 ; k<=group ; k++)
{
for(label j=0 ; j<= etamax ; j++)
{
pdf[j] = Peta[j][celli];
f[j] = QiCMC[(k*(etamax+1)+j)*Ysize + i];
}
Ytemp[i] += Ffrac[k][celli]*integration(deltaftn[celli], MFcut, Neta, pdf, f);
}
}
Switch ignoreOFIncrease = true;
Switch oxygenIncrease = Ytemp[o2index] > Y[o2index][celli];
Switch fuelIncrease = Ytemp[fuelindex] > Y[fuelindex][celli];
if( ignoreOFIncrease && (oxygenIncrease || fuelIncrease))
{
// Do not update Yi
if( Ytemp[o2index] > Y[o2index][celli] || Ytemp[fuelindex] > Y[fuelindex][celli])
{
SUMSh[celli] = 0;
//keep Yi value
}
else
{
scalarField ReactionRate(Ysize, 0.0);
scalar tShtemp(0);
for(label i = 0 ; i<Ysize ; i++)
{
ReactionRate[i] = rho[celli] * (Ytemp[i] - Y[i][celli]) / runTime.deltaT().value();
tShtemp -= chemistry->calculateShCMC( ReactionRate , i);
}
SUMSh[celli] = tShtemp;
for(label i = 0 ; i <Ysize ; i++)
{
Y[i][celli] = Ytemp[i];
}
}
}
else
{
for(label i = 0 ; i < Ysize ; i++)
{
Y[i][celli] = Ytemp[i];
}
SUMSh[celli] = 0;
}
}
}

View file

@ -6,7 +6,7 @@
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ (
he.name() == "ea"
he.name() == "e"
? fvc::div
(
fvc::absolute(phi/fvc::interpolate(rho), U),
@ -17,7 +17,8 @@
)
- fvm::laplacian(1.47*turbulence->mut(), he)
==
fvOptions(rho, he)
SUMSh
+fvOptions(rho, he)
);
EEqn.relax();

View file

@ -96,6 +96,7 @@ int main(int argc, char *argv[])
init_start_CMC = false;
}
#include "CMCequation.H" //Solve CMC equations
#include "YEqn.H"
#include "CMCintegration.H" //Conditional field integration and get reaction rate
#include "EEqn.H"

View file

@ -18,7 +18,6 @@ EXE_LIBS = \
-L$(FOAM_USER_LIBBIN) \
-lchemistryModel_POSTECH \
-lcombustionModels_POSTECH \
-lthermoAdd \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \

View file

@ -10,7 +10,7 @@ autoPtr<combustionModels::psiChemistryCombustion> reaction
autoPtr<psiChemistryModel> chemistry = reaction->chem();
psiReactionThermo& thermo = chemistry->thermo();
thermo.validate(args.executable(), "ha");
thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();