CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

How to implement reduced mechanism in OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 10, 2017, 17:14
Default How to implement reduced mechanism in OpenFOAM
  #1
New Member
 
Join Date: Mar 2013
Posts: 21
Rep Power: 6
Slanth is on a distinguished road
Hi, guys, I am working on how to implement reduced mechanisms in OpenFOAM. Could anyone give me some hints? Thank you very much.

So far, I know the CKWYP from chemkin II could compute specie net production rate, which is realized by omega function in ODEChemistryModel. So I am wondering should I use some sort of extern C method to link the fortran CKWYP.

Have anyone solved this problem? I am really appreciate if someone could give me some suggestions.
Slanth is offline   Reply With Quote

Old   January 12, 2017, 13:32
Default Tabulation of Dynamic Adaptive Chemistry (TDAC) model
  #2
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 55
Rep Power: 6
arvindpj is on a distinguished road
Check out the new Tabulation of Dynamic Adaptive Chemistry (TDAC) model in both openfoam-dev and openfoam-plus. This has methods such as DRG, DAC, DRGEP, PFA, EFA. There is also a tutorial.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  plus                                  |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "constant";
    object      chemistryProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

chemistryType
{
    chemistrySolver   ode;
    chemistryThermo   psi;
    TDAC              on;
}

chemistry       on;

initialChemicalTimeStep 1e-7;

odeCoeffs
{
    solver          seulex;
    absTol          1e-12;
    relTol          1e-1;
}

reduction
{
    // Activate reduction
    active  on;

    // Switch logging of the reduction statistics and performance
    log         on;

    // Tolerance depends on the reduction method, see details for each method
    tolerance   1e-4;

    // Available methods: DRG, DAC, DRGEP, PFA, EFA
    method DAC;

    // Search initiating set (SIS) of species, needed for most methods
    initialSet
    {
        CO;
        CH4;
        HO2;
    }

    // For DAC, option to automatically change the SIS switch from HO2 to H2O
    // and CO to CO2, + disable fuel
    automaticSIS    off;

    // When automaticSIS, the method needs to know the fuel
    fuelSpecies
    {
        CH4 1;
    }
}

tabulation
{
    // Activate tabulation
    active      on;

    // Switch logging of the tabulation statistics and performance
    log         on;

    printProportion    off;

    printNumRetrieve   off;

    // Tolerance used for retrieve and grow
    tolerance   1e-4;

    // ISAT is the only method currently available
    method    ISAT;

    // Scale factors used in the definition of the ellipsoid of accuracy
    scaleFactor
    {
        otherSpecies 1;
        Temperature  2500;
        Pressure     1e15;
    }

    // Maximum number of leafs stored in the binary tree
    maxNLeafs  2000;

    // Maximum life time of the leafs (in time steps) used in unsteady
    // simulations to force renewal of the stored chemPoints and keep the tree
    // small
    chPMaxLifeTime 100;

    // Maximum number of growth allowed on a chemPoint to avoid distorted
    // chemPoints
    maxGrowth  10;

    // Number of time steps between analysis of the tree to remove old
    // chemPoints or try to balance it
    checkEntireTreeInterval  5;

    // Parameters used to decide whether to balance or not if the tree's depth
    // is larger than maxDepthFactor*log2(nLeafs) then balance the tree
    maxDepthFactor   2;

    // Try to balance the tree only if the size of the tree is greater
    minBalanceThreshold 30;

    // Activate the use of a MRU (most recently used) list
    MRURetrieve false;

    // Maximum size of the MRU list
    maxMRUSize 0;

    // Allow to grow points
    growPoints  true;

    // When mechanism reduction is used, new dimensions might be added
    // maxNumNewDim set the maximum number of new dimensions added during a
    // growth
    maxNumNewDim 10;
}


// ************************************************************************* //
Cheers,
arvindpj is offline   Reply With Quote

Old   January 12, 2017, 17:00
Default
  #3
New Member
 
Join Date: Mar 2013
Posts: 21
Rep Power: 6
Slanth is on a distinguished road
Hi, arvindpj, Thanks so much for quick reply. I have several question about IST-CK7-Cnatera.


1. Can it be running in parallel?
2. Waht's the odest openfoam version that IST-CK&-Cantera can couple with? Because my own developed solver could only be used in openfoam-2.4, a higher version openfoam might be not okay for me.
3. As i think, the IST is only for replacing the original ODE and speeding chemistry solving using cantera and redcution method, So PasR combustion model can be still used for turbulence combustion modeling, right? (for example, chemistry.tc() function is still there and can be used)
4. My external CKWYP can be used in chemkin. So should I make some revision for IST-CK7-Cantera?
Slanth is offline   Reply With Quote

Old   January 12, 2017, 17:42
Default
  #4
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 55
Rep Power: 6
arvindpj is on a distinguished road
Quote:
Originally Posted by Slanth View Post
Hi, arvindpj, Thanks so much for quick reply. I have several question about IST-CK7-Cnatera.


1. Can it be running in parallel?

YES

2. Waht's the odest openfoam version that IST-CK&-Cantera can couple with? Because my own developed solver could only be used in openfoam-2.4, a higher version openfoam might be not okay for me.

YES, Tested on OpenFOAM 2.3.x

3. As i think, the IST is only for replacing the original ODE and speeding chemistry solving using cantera and redcution method, So PasR combustion model can be still used for turbulence combustion modeling, right? (for example, chemistry.tc() function is still there and can be used)

YES

4. My external CKWYP can be used in chemkin. So should I make some revision for IST-CK7-Cantera?
Not, sure! I have not used external CKWYP before. Based on the input keyword in the chemistryProperties files, CKWYP can be read. Please try and report.

Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
     \\/     M anipulation  | Copyright (C) 2014 Karl-Johan Nogenmyr
-------------------------------------------------------------------------------
License
    This file is a derivative work 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/>.

Class
    Foam::ISAT

Description
    An solver for chemistry using ISAT-CK7
    General note: ISAT-CK7 uses CGS units, so a conversion is done
    before calling. If OpenFOAM is operated using other than SI units,
    this conversion will fail.
    
    ISATCoeffs
    {
        saveISATtree off; //Each processor saves it's generated table if on
        externalCKWYP off; //If you want to use a ckwyp.f file for rates
        constantPressure off; //ISAT can run more efficient if pressure is const
        ISATABabsErr 1e-5; // Abs error for ISAT-tabulation
        ISATABrelErr 0; // Rel error for ISAT-tabulation
        DDASACabsErr 1e-8; // Abs error for chemistry integrator
        DDASACrelErr 1e-9; // Rel error for chemistry integrator
        ISATABsizeMB 500; // Size in megabytes for generated ISAT-table
    }
    

SourceFiles
    ISAT.C
arvindpj is offline   Reply With Quote

Old   January 12, 2017, 18:57
Default
  #5
New Member
 
Join Date: Mar 2013
Posts: 21
Rep Power: 6
Slanth is on a distinguished road
Hi, arvindpj, your reply so quick. Thank you so much again
It seems that IST-CK is so appealing. I will give it a try. If I manage to use external CKWYP, I will report here.
Slanth is offline   Reply With Quote

Old   January 14, 2017, 23:56
Default
  #6
New Member
 
Join Date: Mar 2013
Posts: 21
Rep Power: 6
Slanth is on a distinguished road
Hi,I finally implement the ISAT-ck7-Cantera successfully. As I ran the h2 and gri tutorials. It seems okay which means that my installation is just okay.


But I found that computaion time is somewhat longer than native openfoam ODE solvers. (Does that make sense? Maybe because so many funtions calls using extra cantera). I will also try some larger case. Maybe speeding effect of ISAT will be more obvious, I hope so.


Another two problems are about parallel run and CKWYP implementation.


1.As I test counterFlow2D case using 2,4,8 cores. The speeding up is not that obvious. So I think it might because the grid number is small. So parallel run does not help much. Or my mpi implemetation is not ok. As
As i read the readme.txt in ISAT-ck7-Cantera,
"Makefiles for Linux are configured to use mpif90. On the Lonestarcluster, before calling make please ensure that you have loaded themkl module (the intel module should be loaded by default): "


While openfoam generally uses openmpi, is that Okay? Do I need extra intel mpi?



2.About how to implement CKWYP in reactingFoam + ISAT-CK7-Cantera (From github's answers).
  1. change 'cklib_ext_stub.f ' and rebuild libraries.
  2. In chemistryProperties, 'externalCKWYP' is 'on'.
  3. In chem.inp, REACTIONS are 'fake' for making .cti files and convert to mech.xml file.
  4. for chemkinreader, REACTIONS are also 'fake'.
    • fake example : CH4 + 2H + H2O => 4H2 + CO 0.000E+00 0.000 0.00
  5. Calculate
I have done this according to above steps. But chemistry does not happen although pragram runs smoothly. Is this step right? Could you give any advice? Or in the first step, I should clean the libraries and then rebuild again?
Slanth is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM v3.0+ ?? SBusch OpenFOAM 22 December 26, 2016 15:24
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 10:04
Propane combustion - reduced reaction mechanism usergk OpenFOAM 7 November 7, 2012 03:58
Reduced mechanism for Ethylene Combustion Chaitanya FLUENT 1 May 9, 2011 06:40


All times are GMT -4. The time now is 09:04.