diff --git a/applications/solvers/combustion/chemFoam/Allwmake b/applications/solvers/combustion/chemFoam/Allwmake new file mode 100755 index 00000000..1404ebcd --- /dev/null +++ b/applications/solvers/combustion/chemFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake +wmake plasmaChemFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/combustion/chemFoam/plasmaChemFoam/Make/files b/applications/solvers/combustion/chemFoam/plasmaChemFoam/Make/files new file mode 100644 index 00000000..e6f1f3d1 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/plasmaChemFoam/Make/files @@ -0,0 +1,3 @@ +plasmaChemFoam.C + +EXE = $(FOAM_APPBIN)/plasmaChemFoam diff --git a/applications/solvers/combustion/chemFoam/plasmaChemFoam/Make/options b/applications/solvers/combustion/chemFoam/plasmaChemFoam/Make/options new file mode 100644 index 00000000..3272b91c --- /dev/null +++ b/applications/solvers/combustion/chemFoam/plasmaChemFoam/Make/options @@ -0,0 +1,24 @@ +EXE_INC = \ + -I$(FOAM_SOLVERS)/combustion/chemFoam \ + -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 \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lcompressibleTurbulenceModel \ + -lcompressibleRASModels \ + -lreactionThermophysicalModels \ + -lfluidThermophysicalModels \ + -lchemistryModel \ + -lODE \ + -lthermophysicalFunctions \ + -lspecie \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/solvers/combustion/chemFoam/plasmaChemFoam/createBaseFields.H b/applications/solvers/combustion/chemFoam/plasmaChemFoam/createBaseFields.H new file mode 100644 index 00000000..0762f270 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/plasmaChemFoam/createBaseFields.H @@ -0,0 +1,57 @@ +// 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(); +} + diff --git a/applications/solvers/combustion/chemFoam/plasmaChemFoam/createFields.H b/applications/solvers/combustion/chemFoam/plasmaChemFoam/createFields.H new file mode 100644 index 00000000..8855e450 --- /dev/null +++ b/applications/solvers/combustion/chemFoam/plasmaChemFoam/createFields.H @@ -0,0 +1,105 @@ + 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 pChemistry(psiChemistryModel::New(mesh)); + + psiChemistryModel& chemistry = pChemistry(); + scalar dtChem = refCast(chemistry).deltaTChem()[0]; + + psiReactionThermo& thermo = chemistry.thermo(); + thermo.validate(args.executable(), "h"); + + basicMultiComponentMixture& composition = thermo.composition(); + PtrList& Y = composition.Y(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + + volScalarField& p = thermo.p(); + + volScalarField Rspecific + ( + IOobject + ( + "Rspecific", + runTime.timeName(), + runTime, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar + ( + "zero", + dimensionSet(dimEnergy/dimMass/dimTemperature), + 0.0 + ) + ); + + 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 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; + + diff --git a/applications/solvers/combustion/chemFoam/plasmaChemFoam/plasmaChemFoam.C b/applications/solvers/combustion/chemFoam/plasmaChemFoam/plasmaChemFoam.C new file mode 100644 index 00000000..4183045a --- /dev/null +++ b/applications/solvers/combustion/chemFoam/plasmaChemFoam/plasmaChemFoam.C @@ -0,0 +1,90 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2012 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 . + +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 "psiReactionThermo.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[]) +{ + argList::noParallel(); + + #include "setRootCase.H" + #include "createTime.H" + #include "createSingleCellMesh.H" + #include "createFields.H" + #include "readInitialConditions.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting 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); +} + + +// ************************************************************************* //