From d55116bfa439b62dc84abe71cc84fb0f4601c031 Mon Sep 17 00:00:00 2001 From: ignis Date: Tue, 2 Oct 2018 20:57:35 +0900 Subject: [PATCH] diffusivityModel is compiled to a seperate libarary. added laminarReactingFoam for cases without electric field. --- .gitignore | 19 ++- EEqn.H | 12 +- Make/files | 13 --- Make/options | 14 +-- YEqn.H | 35 +++--- createElectricField.H | 2 + createFields.H | 2 - diffusivityModel/Make/files | 14 +++ diffusivityModel/Make/options | 38 ++++++ eReactingFoam.C | 3 +- laminarReactingFoam/Make/files | 3 + laminarReactingFoam/Make/options | 32 +++++ laminarReactingFoam/laminarReactingFoam.C | 135 ++++++++++++++++++++++ 13 files changed, 273 insertions(+), 49 deletions(-) create mode 100644 diffusivityModel/Make/files create mode 100644 diffusivityModel/Make/options create mode 100644 laminarReactingFoam/Make/files create mode 100644 laminarReactingFoam/Make/options create mode 100644 laminarReactingFoam/laminarReactingFoam.C diff --git a/.gitignore b/.gitignore index e8b9455..1193b2d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,19 @@ [._]*.sw[a-p] [._]s[a-v][a-z] [._]sw[a-p] -Make -!Make/file -!Make/option +lnInclude +/Make +!/Make/file +!/Make/option + +/diffusivityModel/Make/* +!/diffusivityModel/Make/file +!/diffusivityModel/Make/option + +/flameControllingVelocity/Make/* +!/flameControllingVelocity/Make/file +!/flameControllingVelocity/Make/option + +/laminarReactingFoam/Make/* +!/laminarReactingFoam/Make/file +!/laminarReactingFoam/Make/option diff --git a/EEqn.H b/EEqn.H index 236a797..70a923c 100644 --- a/EEqn.H +++ b/EEqn.H @@ -1,4 +1,14 @@ { + tmp> hConvection + ( + fv::convectionScheme::New + ( + mesh, + phi, + mesh.divScheme("div(phi,Yi_h)") + ) + ); + typedef multiComponentMixture MMix; MMix &janafComposition = dynamic_cast(composition); @@ -49,7 +59,7 @@ fvScalarMatrix EEqn ( - fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he) + fvm::ddt(rho, he) + hConvection->fvmDiv(phi, he) + fvc::ddt(rho, K) + fvc::div(phi, K) - dpdt - fvc::laplacian(diff.k(), T) diff --git a/Make/files b/Make/files index dc8e75e..de06199 100644 --- a/Make/files +++ b/Make/files @@ -1,16 +1,3 @@ -diffusivityModel/Particle/Particle.C -diffusivityModel/Neutral/Neutral.C -diffusivityModel/Ion/Ion.C -diffusivityModel/Electron/Electron.C - -diffusivityModel/Interaction/Interaction.C -diffusivityModel/Stockmayer/Stockmayer.C -diffusivityModel/Coulomb/Coulomb.C -diffusivityModel/N64/N64.C -diffusivityModel/CrossSection/CrossSection.C - -diffusivityModel/diffusivityModel/diffusivityModel.C - eReactingFoam.C EXE = $(FOAM_USER_APPBIN)/eReactingFoam diff --git a/Make/options b/Make/options index a84e016..d392304 100644 --- a/Make/options +++ b/Make/options @@ -1,14 +1,4 @@ EXE_INC = \ - -g \ - -IdiffusivityModel/Particle \ - -IdiffusivityModel/Electron \ - -IdiffusivityModel/Neutral \ - -IdiffusivityModel/Ion \ - -IdiffusivityModel/Interaction \ - -IdiffusivityModel/Stockmayer \ - -IdiffusivityModel/Coulomb \ - -IdiffusivityModel/N64 \ - -IdiffusivityModel/CrossSection \ -IdiffusivityModel/diffusivityModel \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ @@ -36,4 +26,6 @@ EXE_LIBS = \ -lfluidThermophysicalModels \ -lchemistryModel \ -lODE \ - -lcombustionModels + -lcombustionModels \ + -L$(FOAM_USER_LIBBIN) \ + -ldiffusivityModel diff --git a/YEqn.H b/YEqn.H index 07b0699..8a574ab 100644 --- a/YEqn.H +++ b/YEqn.H @@ -1,10 +1,24 @@ +Vc = dimensionedVector("zero", dimLength/dimTime, U[0]*0.0); + +phiC = dimensionedScalar("zero", dimDensity*dimVelocity*dimArea, 0.0); + +forAll(Y, i) +{ + Vc += diff.D(i) * fvc::grad(Y[i]); +} + +forAll(Y, i) +{ + phiC += linearInterpolate(rho * diff.D(i)) * fvc::snGrad(Y[i]) * mesh.magSf(); +} + tmp> mvConvection ( fv::convectionScheme::New ( mesh, fields, - phi, + phi + phiC, mesh.divScheme("div(phi,Yi_h)") ) ); @@ -15,21 +29,6 @@ tmp> mvConvection label inertIndex = -1; volScalarField Yt(0.0*Y[0]); - // volVectorField Vc(U); - Vc = dimensionedVector("zero", dimLength/dimTime, U[0]*0.0); - - phiC = dimensionedScalar("zero", dimDensity*dimVelocity*dimArea, 0.0); - - forAll(Y, i) - { - Vc += diff.D(i) * fvc::grad(Y[i]); - } - - forAll(Y, i) - { - phiC += linearInterpolate(rho * diff.D(i)) * fvc::snGrad(Y[i]) * mesh.magSf(); - } - forAll(Y, i) { if (Y[i].name() != inertSpecie) @@ -39,8 +38,8 @@ tmp> mvConvection fvScalarMatrix YiEqn ( fvm::ddt(rho, Yi) - + mvConvection->fvmDiv(phi, Yi) - - fvm::laplacian(turbulence->muEff(), Yi) + + mvConvection->fvmDiv(phi + phiC, Yi) + - fvm::laplacian(rho * diff.D(i), Yi) == reaction->R(Yi) + fvOptions(rho, Yi) diff --git a/createElectricField.H b/createElectricField.H index ef8c7e5..02bd427 100644 --- a/createElectricField.H +++ b/createElectricField.H @@ -17,10 +17,12 @@ dimensionedScalar epsilon0 physicalProperties.lookup("epsilon0") ); +/* dimensionedScalar k ( physicalProperties.lookup("k") ); +*/ Info<< "Reading field Phi\n" << endl; diff --git a/createFields.H b/createFields.H index 5bd9265..b69d6a9 100644 --- a/createFields.H +++ b/createFields.H @@ -1,5 +1,3 @@ -#include "createElectricField.H" - Info<< "Creating reaction model\n" << endl; autoPtr reaction diff --git a/diffusivityModel/Make/files b/diffusivityModel/Make/files new file mode 100644 index 0000000..8297da0 --- /dev/null +++ b/diffusivityModel/Make/files @@ -0,0 +1,14 @@ +Particle/Particle.C +Neutral/Neutral.C +Ion/Ion.C +Electron/Electron.C + +Interaction/Interaction.C +Stockmayer/Stockmayer.C +Coulomb/Coulomb.C +N64/N64.C +CrossSection/CrossSection.C + +diffusivityModel/diffusivityModel.C + +LIB = $(FOAM_USER_LIBBIN)/libdiffusivityModel diff --git a/diffusivityModel/Make/options b/diffusivityModel/Make/options new file mode 100644 index 0000000..aef5940 --- /dev/null +++ b/diffusivityModel/Make/options @@ -0,0 +1,38 @@ +EXE_INC = \ + -IParticle \ + -IElectron \ + -INeutral \ + -IIon \ + -IInteraction \ + -IStockmayer \ + -ICoulomb \ + -IN64 \ + -ICrossSection \ + -IdiffusivityModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lfvOptions \ + -lmeshTools \ + -lsampling \ + -lturbulenceModels \ + -lcompressibleTurbulenceModels \ + -lreactionThermophysicalModels \ + -lspecie \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lchemistryModel \ + -lODE \ + -lcombustionModels diff --git a/eReactingFoam.C b/eReactingFoam.C index 23097d0..194bab7 100644 --- a/eReactingFoam.C +++ b/eReactingFoam.C @@ -56,6 +56,7 @@ int main(int argc, char *argv[]) #include "createTimeControls.H" #include "createRDeltaT.H" #include "initContinuityErrs.H" + #include "createElectricField.H" #include "createFields.H" #include "createFieldRefs.H" #include "createFvOptions.H" @@ -95,7 +96,7 @@ int main(int argc, char *argv[]) while (pimple.loop()) { #include "PhiEqn.H" - + diff.correct(); #include "UEqn.H" diff --git a/laminarReactingFoam/Make/files b/laminarReactingFoam/Make/files new file mode 100644 index 0000000..2fda645 --- /dev/null +++ b/laminarReactingFoam/Make/files @@ -0,0 +1,3 @@ +laminarReactingFoam.C + +EXE = $(FOAM_USER_APPBIN)/laminarReactingFoam diff --git a/laminarReactingFoam/Make/options b/laminarReactingFoam/Make/options new file mode 100644 index 0000000..ba00d26 --- /dev/null +++ b/laminarReactingFoam/Make/options @@ -0,0 +1,32 @@ +EXE_INC = \ + -I.. \ + -I../diffusivityModel/diffusivityModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/combustionModels/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lfvOptions \ + -lmeshTools \ + -lsampling \ + -lturbulenceModels \ + -lcompressibleTurbulenceModels \ + -lreactionThermophysicalModels \ + -lspecie \ + -lcompressibleTransportModels \ + -lfluidThermophysicalModels \ + -lchemistryModel \ + -lODE \ + -lcombustionModels \ + -L$(FOAM_USER_LIBBIN) \ + -ldiffusivityModel diff --git a/laminarReactingFoam/laminarReactingFoam.C b/laminarReactingFoam/laminarReactingFoam.C new file mode 100644 index 0000000..7234f2a --- /dev/null +++ b/laminarReactingFoam/laminarReactingFoam.C @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2016 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 + reactingFoam + +Description + Solver for combustion with chemical reactions. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "turbulentFluidThermoModel.H" +#include "psiCombustionModel.H" +#include "multivariateScheme.H" +#include "pimpleControl.H" +#include "fvOptions.H" +#include "localEulerDdtScheme.H" +#include "fvcSmooth.H" + +#include "thermoPhysicsTypes.H" +#include "multiComponentMixture.H" + +#include "diffusivityModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + #include "postProcess.H" + + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "createControl.H" + #include "createTimeControls.H" + #include "createRDeltaT.H" + #include "initContinuityErrs.H" + #include "createFields.H" + #include "createFieldRefs.H" + #include "createFvOptions.H" + + turbulence->validate(); + + if (!LTS) + { + #include "compressibleCourantNo.H" + #include "setInitialDeltaT.H" + } + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { + #include "readTimeControls.H" + + if (LTS) + { + #include "setRDeltaT.H" + } + else + { + #include "compressibleCourantNo.H" + #include "setDeltaT.H" + } + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + #include "rhoEqn.H" + + while (pimple.loop()) + { + diff.correct(); + + #include "UEqn.H" + #include "YEqn.H" + #include "EEqn.H" + + // --- Pressure corrector loop + while (pimple.correct()) + { + if (pimple.consistent()) + { + #include "pcEqn.H" + } + else + { + #include "pEqn.H" + } + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* //