Contrib reactingFoam

From OpenFOAMWiki

This is a very simple way to add ignition by just increasing the enthalpy, but the idea should be clear for anyone wanting to make a better ignition model.

Go to the reactionFoam directory under applications/solvers/combustion.

Open file Make/options

Add

    -I$(LIB_SRC)/engine/lnInclude

to EXE_INC

Add

   -lengine 

to EXE_LIBS

Open file reactingFoam.C

Add the ignition include after the multivariateScheme

  #include "multivariateScheme.H"
  #include "ignition.H"

Add the readCombustionProperties.H after readChemistryProperties

  #   include "readChemistryProperties.H"
  #   include "readCombustionProperties.H"

Add the include ignite line before hEqn.H

  #           define Db turbulence->alphaEff()
  #           include "ignite.H"
  #           include "hEqn.H"

Create the file readCombustionProperties.H and save it in the same directory as reactingFoam.C. It should look like this

   Info<< "Reading combustion properties\n" << endl;

   IOdictionary combustionProperties
   (
       IOobject
       (
           "combustionProperties",
           runTime.constant(),
           mesh,
           IOobject::MUST_READ,
           IOobject::NO_WRITE
       )
   );

   ignition ign(combustionProperties, runTime, mesh);

In the same directory create the file ignite.H. It should look like this

  if (ign.ignited())
  {
      forAll(ign.sites(), i)
      {
          const ignitionSite& ignSite = ign.sites()[i];
          if (ignSite.igniting())
          {
              forAll(ignSite.cells(), icelli)
              {
                  label ignCell = ignSite.cells()[icelli];
                  if (T[ignCell] < 2000.0)
                  {
                      Info << "Igniting cell " << ignCell << endl;
              
                      // do whatever....here we just increase the enthalpy in the cell
                      scalar magH = mag(h[ignCell]);
                      h[ignCell] += ignSite.strength()*magH;
                  }
              }
          }
      }
  }

These are all the code changes you need to do, now you can compile it with wmake.

reactingFoam now needs the combustionProperties file which you need to create and save under the constant directory. An example can look like this

\*---------------------------------------------------------------------------*/
FoamFile
{
   version     2.0;
   format      ascii;
   class       dictionary;
   object      combustionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 

ignite              on;

ignitionSites   
(
   
   {
       location        (0.0 0.05 0.0);
       diameter        0.001;
       start           0;
       duration        0.001;
       strength        1.5;
   }
);

// ************************************************************************* //

--Niklas 12:57, 2 December 2008 (CET)